Ejemplo n.º 1
0
    def build(analyzed_entity, operation, datatype_group, metrics='{"v": 3}'):
        measure = DatatypeMeasureIndex()
        measure.metrics = metrics
        measure.source = analyzed_entity
        measure.fk_from_operation = operation.id
        measure.fk_datatype_group = datatype_group.id
        measure = dao.store_entity(measure)

        return measure
Ejemplo n.º 2
0
 def prepare_index_for_metric_result(self, operation, result_filename,
                                     burst):
     self.logger.debug(
         "Preparing index for metric result in operation {}...".format(
             operation.id))
     index = DatatypeMeasureIndex()
     with DatatypeMeasureH5(result_filename) as dti_h5:
         index.gid = dti_h5.gid.load().hex
         index.metrics = json.dumps(dti_h5.metrics.load())
         index.fk_source_gid = dti_h5.analyzed_datatype.load().hex
     index.fk_from_operation = operation.id
     index.fk_parent_burst = burst.gid
     datatype_group = dao.get_datatypegroup_by_op_group_id(
         operation.fk_operation_group)
     self.logger.debug(
         "Found DatatypeGroup with id {} for operation {}".format(
             datatype_group.id, operation.id))
     index.fk_datatype_group = datatype_group.id
     self.logger.debug(
         "Prepared index {} for results in operation {}...".format(
             index.summary_info, operation.id))
     return index
Ejemplo n.º 3
0
    def build(analyzed_entity_index, analyzed_entity, operation, datatype_group, metrics='{"v": 3}'):
        measure = DatatypeMeasureIndex()
        measure.metrics = metrics
        measure.source = analyzed_entity_index
        measure.fk_from_operation = operation.id
        measure.fk_datatype_group = datatype_group.id
        measure = dao.store_entity(measure)

        dm = DatatypeMeasure(analyzed_datatype=analyzed_entity, metrics=json.loads(metrics))
        dm_path = h5.path_for_stored_index(measure)

        with DatatypeMeasureH5(dm_path) as dm_h5:
            dm_h5.store(dm)
            dm_h5.store_generic_attributes(GenericAttributes())

        return measure