Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/workflow_manager/tests/test_stats_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def test_workflow_run_status_counts_returns_200(self):
"failed",
"resolved",
"deprecated",
"cancelled",
"draft",
"ongoing",
},
Expand Down
10 changes: 6 additions & 4 deletions app/workflow_manager/viewsets/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ class StateTransitionValidationMixin:
refer:
"Resolved" -- https://github.com/umccr/orcabus/issues/593
"Deprecated" -- https://github.com/umccr/orcabus/issues/695
"Cancelled" -- https://github.com/OrcaBus/service-workflow-manager/pull/169
"""

states_transition_validation_map = {
"RESOLVED": ["FAILED"], # Only FAILED can transition to RESOLVED
"DEPRECATED": {
"excluded_states": ["FAILED", "ABORTED", "RESOLVED", "DEPRECATED"]
}, # All states except these can transition to DEPRECATED
"RESOLVED": ["FAILED"], # Only FAILED can transition to RESOLVED, refer: https://github.com/umccr/orcabus/issues/593.
"DEPRECATED": ["SUCCEEDED"], # Only SUCCEEDED to transition to DEPRECATED, refer https://github.com/OrcaBus/service-workflow-manager/issues/163.
# Ongoing states can transition to CANCELLED, but not terminal states or RESOLVED/DEPRECATED. This is to prevent accidentally canceling completed workflow runs or those that have already been marked as resolved/deprecated.
# refer https://github.com/OrcaBus/service-workflow-manager/pull/169.
"CANCELLED": {'excluded_states': ["SUCCEEDED", "FAILED", "ABORTED", "RESOLVED", "DEPRECATED"]},
}

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions app/workflow_manager/viewsets/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def _workflow_run_status_counts(self, query_params):
"FAILED",
"RESOLVED",
"DEPRECATED",
"CANCELLED",
"DRAFT",
],
termination_statuses=RUN_LATEST_STATE_TERMINATION_STATUSES,
Expand Down
1 change: 1 addition & 0 deletions app/workflow_manager/viewsets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def compare_versions(a: str, b: str) -> int:
"SUCCEEDED",
"RESOLVED",
"DEPRECATED",
"CANCELLED",
)


Expand Down
2 changes: 1 addition & 1 deletion app/workflow_manager/viewsets/workflow_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class WorkflowRunViewSet(BaseViewSet):
serializer_class = WorkflowRunDetailSerializer
search_fields = WorkflowRun.get_base_fields()
queryset = WorkflowRun.objects.all()
termination_statuses = ["FAILED", "ABORTED", "SUCCEEDED", "RESOLVED", "DEPRECATED"]
termination_statuses = ["FAILED", "ABORTED", "SUCCEEDED", "RESOLVED", "DEPRECATED", "CANCELLED"]
http_method_names = ["get", "head", "options", "trace"]
# Ordering and search are handled in get_queryset / filtered_workflow_runs_queryset;
# DRF filter_backends are disabled to avoid double-filtering.
Expand Down
Loading