From 3850771bc39da63dc3feceecbbdd973918402954 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Fri, 16 Oct 2020 17:00:21 +0200 Subject: [PATCH] TMSS-190: bug fix: compare .value of Enum's and add seconds, not timedeltas --- SAS/TMSS/src/tmss/tmssapp/models/scheduling.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py b/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py index f250406f6e3..63e35b38b17 100644 --- a/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py +++ b/SAS/TMSS/src/tmss/tmssapp/models/scheduling.py @@ -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) -- GitLab