Skip to content
Snippets Groups Projects
Commit a6c1e445 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-190: estimate pipeline spec duration based on predecessor

parent b946a74c
No related branches found
No related tags found
1 merge request!252Resolve TMSS-190
...@@ -165,13 +165,16 @@ class Subtask(BasicCommon): ...@@ -165,13 +165,16 @@ class Subtask(BasicCommon):
@property @property
def specified_duration(self) -> timedelta: def specified_duration(self) -> timedelta:
'''get the specified (or estimated) duration of this subtask based on the specified task duration and the subtask type''' '''get the specified (or estimated) duration of this subtask based on the specified task duration and the subtask type'''
if self.specifications_template.type.value in [SubtaskType.Choices.OBSERVATION, SubtaskType.Choices.PIPELINE]: if self.specifications_template.type.value == SubtaskType.Choices.OBSERVATION:
# observations (and sometimes pipelines) have a specified duration, # observations have a specified duration, so grab it from the spec.
# so grab it from the spec.
return timedelta(seconds=self.task_blueprint.specifications_doc.get('duration', 0)) return timedelta(seconds=self.task_blueprint.specifications_doc.get('duration', 0))
if self.specifications_template.type.value == SubtaskType.Choices.PIPELINE:
# pipelines usually do not have a specified duration, so make a guess (half the obs duration?).
return timedelta(seconds=self.task_blueprint.specifications_doc.get('duration', max(p.specified_duration for p in self.predecessors)/2))
# other subtasktypes usually depend on cpu/data/network etc. So, make a guess (for now) # other subtasktypes usually depend on cpu/data/network etc. So, make a guess (for now)
return timedelta(seconds=600) return timedelta(minutes=5)
@staticmethod @staticmethod
def _send_state_change_event_message(subtask_id:int, old_state: str, new_state: str): def _send_state_change_event_message(subtask_id:int, old_state: str, new_state: str):
......
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