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

TMSS-854: added simple aggregation of obsolete states. ToDo in TMSS-850...

TMSS-854: added simple aggregation of obsolete states. ToDo in TMSS-850 implement the various conditional aggregations for the 'obsolete' vs 'finished' states
parent 03810cd6
No related branches found
No related tags found
3 merge requests!634WIP: COBALT commissioning delta,!495TMSS-854: OBSOLETE state,!481Draft: SW-971 SW-973 SW-975: Various fixes to build LOFAR correctly.
...@@ -496,6 +496,7 @@ class SchedulingUnitBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, NamedCo ...@@ -496,6 +496,7 @@ class SchedulingUnitBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, NamedCo
INGESTING = "ingesting" INGESTING = "ingesting"
SCHEDULED = "scheduled" SCHEDULED = "scheduled"
SCHEDULABLE = "schedulable" SCHEDULABLE = "schedulable"
OBSOLETE = "obsolete"
# todo: are many of these fields supposed to be immutable in the database? # todo: are many of these fields supposed to be immutable in the database?
# Or are we fine to just not allow most users to change them? # Or are we fine to just not allow most users to change them?
...@@ -652,6 +653,9 @@ class SchedulingUnitBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, NamedCo ...@@ -652,6 +653,9 @@ class SchedulingUnitBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, NamedCo
return SchedulingUnitBlueprint.Status.CANCELLED.value return SchedulingUnitBlueprint.Status.CANCELLED.value
elif self._any_task_error(status_overview_counter): elif self._any_task_error(status_overview_counter):
return SchedulingUnitBlueprint.Status.ERROR.value return SchedulingUnitBlueprint.Status.ERROR.value
elif self._any_task_obsolete(status_overview_counter):
# TODO: in TMSS-850 implement the various conditional aggregations for the 'obsolete' vs 'finished' states
return SchedulingUnitBlueprint.Status.OBSOLETE.value
elif self._any_task_started_observed_finished(status_overview_counter): elif self._any_task_started_observed_finished(status_overview_counter):
if not self._all_observation_task_observed_finished(status_overview_counter_per_type): if not self._all_observation_task_observed_finished(status_overview_counter_per_type):
return SchedulingUnitBlueprint.Status.OBSERVING.value return SchedulingUnitBlueprint.Status.OBSERVING.value
...@@ -688,6 +692,10 @@ class SchedulingUnitBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, NamedCo ...@@ -688,6 +692,10 @@ class SchedulingUnitBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, NamedCo
def _any_task_error(status_overview_counter): def _any_task_error(status_overview_counter):
return status_overview_counter["error"] > 0 return status_overview_counter["error"] > 0
@staticmethod
def _any_task_obsolete(status_overview_counter):
return status_overview_counter["obsolete"] > 0
@staticmethod @staticmethod
def _any_task_started_observed_finished(status_overview_counter): def _any_task_started_observed_finished(status_overview_counter):
return (status_overview_counter["started"] + status_overview_counter["observed"] + status_overview_counter["finished"]) > 0 return (status_overview_counter["started"] + status_overview_counter["observed"] + status_overview_counter["finished"]) > 0
...@@ -1050,6 +1058,10 @@ class TaskBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, NamedCommon): ...@@ -1050,6 +1058,10 @@ class TaskBlueprint(ProjectPropertyMixin, TemplateSchemaMixin, NamedCommon):
if any(s for s in subtasks if s['state'] == 'error'): if any(s for s in subtasks if s['state'] == 'error'):
return "error" return "error"
# TODO: in TMSS-850 implement the various conditional aggregations for the 'obsolete' vs 'finished' states
if any(s for s in subtasks if s['state'] == 'obsolete'):
return "obsolete"
observations = [s for s in subtasks if s['specifications_template__type_id'] == 'observation'] observations = [s for s in subtasks if s['specifications_template__type_id'] == 'observation']
if observations and all(obs and obs['state'] in ('finishing', 'finished') for obs in observations): if observations and all(obs and obs['state'] in ('finishing', 'finished') for obs in observations):
return "observed" return "observed"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment