diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/populate.py b/SAS/TMSS/backend/src/tmss/tmssapp/populate.py index 7bfb6223571a99061da97f72a4e5e62730638547..9f9c8a64b9f020e0c31c10273f0ebed83b030573 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/populate.py @@ -189,14 +189,14 @@ def populate_subtask_allowed_state_transitions(apps, schema_editor): def populate_subtask_allowed_state_transitions_extra(apps, schema_editor): '''populate the SubtaskAllowedStateTransitions table with additional allowed state transitions''' DEFINED = SubtaskState.objects.get(value=SubtaskState.Choices.DEFINED.value) - CANCELLED = SubtaskState.objects.get(value=SubtaskState.Choices.CANCELLED.value) + CANCELLING = SubtaskState.objects.get(value=SubtaskState.Choices.CANCELLING.value) ERROR = SubtaskState.objects.get(value=SubtaskState.Choices.ERROR.value) UNSCHEDULABLE = SubtaskState.objects.get(value=SubtaskState.Choices.UNSCHEDULABLE.value) SubtaskAllowedStateTransitions.objects.bulk_create([ SubtaskAllowedStateTransitions(old_state=DEFINED, new_state=UNSCHEDULABLE), SubtaskAllowedStateTransitions(old_state=UNSCHEDULABLE, new_state=DEFINED), - SubtaskAllowedStateTransitions(old_state=UNSCHEDULABLE, new_state=CANCELLED), + SubtaskAllowedStateTransitions(old_state=UNSCHEDULABLE, new_state=CANCELLING), SubtaskAllowedStateTransitions(old_state=UNSCHEDULABLE, new_state=ERROR) ]) diff --git a/SAS/TMSS/backend/test/t_subtasks.py b/SAS/TMSS/backend/test/t_subtasks.py index 53d98a77b916deb19018831a5d3295c2fdf7a645..04432b0f5c967e760fb7c23129e875a7b6dfc387 100755 --- a/SAS/TMSS/backend/test/t_subtasks.py +++ b/SAS/TMSS/backend/test/t_subtasks.py @@ -722,6 +722,7 @@ class SubtaskAllowedStateTransitionsTest(unittest.TestCase): for state_value in (SubtaskState.Choices.DEFINING.value, SubtaskState.Choices.DEFINED.value, SubtaskState.Choices.SCHEDULING.value, + SubtaskState.Choices.UNSCHEDULABLE.value, SubtaskState.Choices.SCHEDULED.value, SubtaskState.Choices.QUEUEING.value, SubtaskState.Choices.QUEUED.value, @@ -740,6 +741,7 @@ class SubtaskAllowedStateTransitionsTest(unittest.TestCase): for intermediate_state_value in (SubtaskState.Choices.DEFINING.value, SubtaskState.Choices.SCHEDULING.value, SubtaskState.Choices.UNSCHEDULING.value, + SubtaskState.Choices.UNSCHEDULABLE.value, SubtaskState.Choices.QUEUEING.value, SubtaskState.Choices.STARTING.value, SubtaskState.Choices.STARTED.value, @@ -769,6 +771,7 @@ class SubtaskAllowedStateTransitionsTest(unittest.TestCase): def test_helper_method_set_subtask_state_following_allowed_transitions_cancel_path(self): for desired_end_state_value in (SubtaskState.Choices.CANCELLING.value,SubtaskState.Choices.CANCELLED.value): for state_value in (SubtaskState.Choices.DEFINED.value, + SubtaskState.Choices.UNSCHEDULABLE.value, SubtaskState.Choices.SCHEDULED.value, SubtaskState.Choices.QUEUED.value, SubtaskState.Choices.STARTED.value): diff --git a/SAS/TMSS/backend/test/t_tasks.py b/SAS/TMSS/backend/test/t_tasks.py index 63ab80d6203ecc66f3902f74b5420f10b8bb829a..1a127c3da5b53ee9b62b4d4130120527bb315e57 100755 --- a/SAS/TMSS/backend/test/t_tasks.py +++ b/SAS/TMSS/backend/test/t_tasks.py @@ -305,12 +305,23 @@ class TaskBlueprintStateTest(unittest.TestCase): ("finished", "finished") ], [ ("defining", "defined"), - ("error", "error") + ("error", "error") + ], [ + ("defining", "defined"), + ("defined", "schedulable"), + ("unschedulable","unschedulable"), + ("error", "error") ], [ ("defining", "defined"), ("defined", "schedulable"), ("cancelling", "cancelled"), ("cancelled", "cancelled") + ], [ + ("defining", "defined"), + ("defined", "schedulable"), + ("unschedulable","unschedulable"), + ("cancelling", "cancelled"), + ("cancelled", "cancelled") ]] for test_table in test_tables: @@ -356,7 +367,14 @@ class TaskBlueprintStateTest(unittest.TestCase): ], [ ("cancelling", "defined", "cancelled"), ("cancelled", "defined", "cancelled") - ] , [ + ], [ + ("unschedulable", "defined", "unschedulable"), + ("cancelling", "defined", "cancelled"), + ("cancelled", "defined", "cancelled"), + ], [ + ("error", "defined", "error") + ], [ + ("unschedulable","defined", "unschedulable"), ("error", "defined", "error") ], [ # qa finishing/finished should be not observed