Skip to content
Snippets Groups Projects
Commit 2c639e54 authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

TMSS-2934: allow workflow to finish on SU error/cancelled statuses

parent 5677150a
No related branches found
No related tags found
1 merge request!1332TMSS-2934: send data with 'unpin_data' flag to backend when performing 'Unpin...
...@@ -32,7 +32,7 @@ class SchedulingUnitEventMessageHandler(TMSSEventMessageHandler): ...@@ -32,7 +32,7 @@ class SchedulingUnitEventMessageHandler(TMSSEventMessageHandler):
def onSchedulingUnitBlueprintStatusChanged(self, id: int, status: str): def onSchedulingUnitBlueprintStatusChanged(self, id: int, status: str):
try: try:
# import here and not at top of module because we need the django.setup() to be run first, either from this module's main, or from the TMSSTestEnvironment # import here and not at top of module because we need the django.setup() to be run first, either from this module's main, or from the TMSSTestEnvironment
from lofar.sas.tmss.tmss.workflowapp.signals import scheduling_unit_blueprint_schedulable_signal, scheduling_unit_blueprint_scheduled_signal, scheduling_unit_blueprint_observing_signal, scheduling_unit_blueprint_observed_signal, scheduling_unit_blueprint_ingested_signal, scheduling_unit_blueprint_finished_signal from lofar.sas.tmss.tmss.workflowapp.signals import scheduling_unit_blueprint_schedulable_signal, scheduling_unit_blueprint_scheduled_signal, scheduling_unit_blueprint_observing_signal, scheduling_unit_blueprint_observed_signal, scheduling_unit_blueprint_ingested_signal, scheduling_unit_blueprint_done_signal
from lofar.sas.tmss.tmss.workflowapp.models import SchedulingUnitTask from lofar.sas.tmss.tmss.workflowapp.models import SchedulingUnitTask
from lofar.sas.tmss.tmss.tmssapp.models import SchedulingUnitBlueprint, SchedulingUnitStatus, TaskType, SubtaskType from lofar.sas.tmss.tmss.tmssapp.models import SchedulingUnitBlueprint, SchedulingUnitStatus, TaskType, SubtaskType
...@@ -53,9 +53,9 @@ class SchedulingUnitEventMessageHandler(TMSSEventMessageHandler): ...@@ -53,9 +53,9 @@ class SchedulingUnitEventMessageHandler(TMSSEventMessageHandler):
elif status == SchedulingUnitStatus.Choices.INGESTED.value: elif status == SchedulingUnitStatus.Choices.INGESTED.value:
logger.info("workflow scheduling_unit_blueprint id=%s is fully ingested, signalling workflow...", id) logger.info("workflow scheduling_unit_blueprint id=%s is fully ingested, signalling workflow...", id)
scheduling_unit_blueprint_ingested_signal.send(sender=self.__class__, scheduling_unit_blueprint=scheduling_unit_blueprint) scheduling_unit_blueprint_ingested_signal.send(sender=self.__class__, scheduling_unit_blueprint=scheduling_unit_blueprint)
elif status == SchedulingUnitStatus.Choices.FINISHED.value: elif status in SchedulingUnitStatus.DONE_STATUS_VALUES:
logger.info("workflow scheduling_unit_blueprint id=%s is fully finished, signalling workflow...", id) logger.info("workflow scheduling_unit_blueprint id=%s is fully done, signalling workflow...", id)
scheduling_unit_blueprint_finished_signal.send(sender=self.__class__, scheduling_unit_blueprint=scheduling_unit_blueprint) scheduling_unit_blueprint_done_signal.send(sender=self.__class__, scheduling_unit_blueprint=scheduling_unit_blueprint)
except Exception as e: except Exception as e:
logger.exception("Exception in workflow onSchedulingUnitBlueprintStatusChanged: %s" % (str(e),)) logger.exception("Exception in workflow onSchedulingUnitBlueprintStatusChanged: %s" % (str(e),))
......
...@@ -262,7 +262,7 @@ class SchedulingUnitFlow(Flow): ...@@ -262,7 +262,7 @@ class SchedulingUnitFlow(Flow):
wait_finished = ( wait_finished = (
Conditional( Conditional(
this.is_SUB_finished_state_or_beyond, this.is_SUB_finished_state_or_beyond,
scheduling_unit_blueprint_finished_signal, scheduling_unit_blueprint_done_signal,
task_loader=this.get_scheduling_unit_task task_loader=this.get_scheduling_unit_task
) )
.Next(this.end) .Next(this.end)
...@@ -356,6 +356,8 @@ class SchedulingUnitFlow(Flow): ...@@ -356,6 +356,8 @@ class SchedulingUnitFlow(Flow):
condition = scheduling_unit.status.value in SchedulingUnitStatus.ACTIVE_OR_FINISHED_STATUS_VALUES condition = scheduling_unit.status.value in SchedulingUnitStatus.ACTIVE_OR_FINISHED_STATUS_VALUES
elif expected_status == SchedulingUnitStatus.Choices.SCHEDULABLE.value: elif expected_status == SchedulingUnitStatus.Choices.SCHEDULABLE.value:
condition = scheduling_unit.status.value in SchedulingUnitStatus.SCHEDULABLE_ACTIVE_OR_FINISHED_STATUS_VALUES condition = scheduling_unit.status.value in SchedulingUnitStatus.SCHEDULABLE_ACTIVE_OR_FINISHED_STATUS_VALUES
elif expected_status == SchedulingUnitStatus.Choices.FINISHED.value:
condition = scheduling_unit.status.value in SchedulingUnitStatus.DONE_STATUS_VALUES
return condition return condition
......
...@@ -5,6 +5,6 @@ scheduling_unit_blueprint_scheduled_signal = django.dispatch.Signal() ...@@ -5,6 +5,6 @@ scheduling_unit_blueprint_scheduled_signal = django.dispatch.Signal()
scheduling_unit_blueprint_observing_signal = django.dispatch.Signal() scheduling_unit_blueprint_observing_signal = django.dispatch.Signal()
scheduling_unit_blueprint_observed_signal = django.dispatch.Signal() scheduling_unit_blueprint_observed_signal = django.dispatch.Signal()
scheduling_unit_blueprint_ingested_signal = django.dispatch.Signal() scheduling_unit_blueprint_ingested_signal = django.dispatch.Signal()
scheduling_unit_blueprint_finished_signal = django.dispatch.Signal() scheduling_unit_blueprint_done_signal = django.dispatch.Signal()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment