Beispiel #1
0
    def update_db_with_results(operation, sim_h5_filenames, metric_operation,
                               metric_h5_filename):
        # type: (Operation, list, Operation, str) -> (str, int)
        """
        Generate corresponding Index entities for the resulted H5 files and insert them in DB.
        """
        burst_service = BurstService()
        index_list = []
        is_group = operation.fk_operation_group is not None
        burst_config = burst_service.get_burst_for_operation_id(operation.id)
        if is_group:
            burst_config = burst_service.get_burst_for_operation_id(
                operation.fk_operation_group, True)
        all_indexes = burst_service.prepare_indexes_for_simulation_results(
            operation, sim_h5_filenames, burst_config)
        if is_group:
            # Update the operation group name
            operation_group = dao.get_operationgroup_by_id(
                metric_operation.fk_operation_group)
            operation_group.fill_operationgroup_name("DatatypeMeasureIndex")
            dao.store_entity(operation_group)

            metric_index = burst_service.prepare_index_for_metric_result(
                metric_operation, metric_h5_filename, burst_config)
            all_indexes.append(metric_index)

        for index in all_indexes:
            index = dao.store_entity(index)
            index_list.append(index)

        burst_service.update_burst_status(burst_config)
    def update_db_with_results(self, operation, sim_h5_filenames,
                               metric_operation, metric_h5_filename):
        # type: (Operation, list, Operation, str) -> (str, int)
        """
        Generate corresponding Index entities for the resulted H5 files and insert them in DB.
        """
        burst_service = BurstService()
        index_list = []

        burst_config = burst_service.get_burst_for_operation_id(operation.id)
        all_indexes = burst_service.prepare_indexes_for_simulation_results(
            operation, sim_h5_filenames, burst_config)
        if burst_config.fk_operation_group:
            metric_index = burst_service.prepare_index_for_metric_result(
                metric_operation, metric_h5_filename, burst_config)
            all_indexes.append(metric_index)

        for index in all_indexes:
            index = dao.store_entity(index)
            index_list.append(index)

        sim_adapter = SimulatorAdapter()
        sim_adapter.extract_operation_data(operation)
        sim_adapter.generic_attributes.parent_burst = burst_config.gid
        mesage, _ = sim_adapter._capture_operation_results(index_list)

        burst_service.update_burst_status(burst_config)
        # self.update_datatype_groups()
        return mesage