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

TMSS-190: bug fix: compare .value of Enum's and add seconds, not timedeltas

parent a7cca3e2
No related branches found
No related tags found
1 merge request!252Resolve TMSS-190
......@@ -162,13 +162,13 @@ class Subtask(BasicCommon):
@property
def specified_duration(self) -> timedelta:
'''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 == SubtaskType.Choices.OBSERVATION:
if self.specifications_template.type.value == SubtaskType.Choices.OBSERVATION.value:
# observations have a specified duration, so grab it from the spec.
return timedelta(seconds=self.task_blueprint.specifications_doc.get('duration', 0))
if self.specifications_template.type.value == SubtaskType.Choices.PIPELINE:
if self.specifications_template.type.value == SubtaskType.Choices.PIPELINE.value:
# 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))
return timedelta(seconds=self.task_blueprint.specifications_doc.get('duration', max(p.specified_duration.total_seconds() for p in self.predecessors)/2))
# other subtasktypes usually depend on cpu/data/network etc. So, make a guess (for now)
return timedelta(minutes=5)
......
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