Skip to content
Snippets Groups Projects
Commit fc8079ea authored by Adriaan Renting's avatar Adriaan Renting
Browse files

Task #9192: Merged resource estimator service.py from...

Task #9192: Merged resource estimator service.py from RA1_0_Integration-Task9192 after a problem in the 34853 merge
parent 7278db89
No related branches found
No related tags found
No related merge requests found
......@@ -18,10 +18,10 @@ class ResourceEstimatorHandler(MessageHandlerInterface):
def __init__(self, **kwargs):
super(ResourceEstimatorHandler, self).__init__(**kwargs)
self.observation = ObservationResourceEstimator()
#self.longbaseline_pipeline = LongBaselinePipelineResourceEstimator()
#self.calibration_pipeline = CalibrationPipelineResourceEstimator()
#self.pulsar_pipeline = PulsarPipelineResourceEstimator()
#self.imaging_pipeline = ImagePipelineResourceEstimator()
self.longbaseline_pipeline = LongBaselinePipelineResourceEstimator()
self.calibration_pipeline = CalibrationPipelineResourceEstimator()
self.pulsar_pipeline = PulsarPipelineResourceEstimator()
self.imaging_pipeline = ImagePipelineResourceEstimator()
def handle_message(self, content):
specification_tree = content["specification_tree"]
......@@ -48,7 +48,6 @@ class ResourceEstimatorHandler(MessageHandlerInterface):
for branch in specification_tree['predecessors']:
branch_estimates.update(self.get_subtree_estimate(branch))
logger.info(str(branch_estimates))
if specification_tree['task_subtype'] in ['averaging pipeline', 'calibration pipeline']:
for id, estimate in branch_estimates.iteritems():
input_files = {}
......@@ -60,30 +59,28 @@ class ResourceEstimatorHandler(MessageHandlerInterface):
elif 'im' in estimate.values()[0]['storage']['output_files']:
input_files['im'] = estimate.values()[0]['storage']['output_files']['im']
return {str(otdb_id): self.add_id(self.calibration_pipeline.verify_and_estimate(parset, input_files), otdb_id)}
if specification_tree['task_subtype'] in ['imaging pipeline', 'imaging pipeline msss']:
if len(branch_estimates) > 1:
logger.error('Imaging pipeline %d should not have multiple predecessors: %s' % (otdb_id, branch_estimates.keys() ) )
input_files = branch_estimates.values()[0].values()[0]['storage']['output_files']
return {str(otdb_id): self.add_id(self.imaging_pipeline.verify_and_estimate(parset, input_files), otdb_id)}
if specification_tree['task_subtype'] in ['long baseline pipeline']:
if len(branch_estimates) > 1:
logger.error('Long baseline pipeline %d should not have multiple predecessors: %s' % (otdb_id, branch_estimates.keys() ) )
input_files = branch_estimates.values()[0].values()[0]['storage']['output_files']
return {str(otdb_id): self.add_id(self.longbaseline_pipeline.verify_and_estimate(parset, input_files), otdb_id)}
if specification_tree['task_subtype'] in ['pulsar pipeline']:
if len(branch_estimates) > 1:
logger.error('Pulsar pipeline %d should not have multiple predecessors: %s' % (otdb_id, branch_estimates.keys() ) )
input_files = branch_estimates.values()[0].values()[0]['storage']['output_files']
return {str(otdb_id): self.add_id(self.pulsar_pipeline.verify_and_estimate(parset, input_files), otdb_id)}
#else: # reservation, maintenance, system tasks?
#logger.info("It's not a pipeline or observation: %s" % otdb_id)
#return {str(otdb_id): {}}
else: # reservation, maintenance, system tasks?
logger.info("It's not a pipeline or observation: %s" % otdb_id)
return {str(otdb_id): {}}
def _get_estimated_resources(self, specification_tree):
""" Input is like:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment