Skip to content

Commit

Permalink
rest: set workflow status to pending after starting the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
audrium committed Apr 27, 2021
1 parent 24c3a62 commit dccd29a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions reana_workflow_controller/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def _update_workflow_status(workflow, status, logs):
RunStatus.created,
RunStatus.running,
RunStatus.queued,
RunStatus.pending,
]
if status not in alive_statuses:
_delete_workflow_engine_pod(workflow)
Expand Down
4 changes: 3 additions & 1 deletion reana_workflow_controller/rest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def start_workflow(workflow, parameters):
"""Start a workflow."""

def _start_workflow_db(workflow, parameters):
workflow.status = RunStatus.running
workflow.status = RunStatus.pending
if parameters:
workflow.input_parameters = parameters.get("input_parameters")
workflow.operational_options = parameters.get("operational_options")
Expand All @@ -71,6 +71,7 @@ def _start_workflow_db(workflow, parameters):
RunStatus.failed,
RunStatus.finished,
RunStatus.queued,
RunStatus.pending,
]:
raise REANAWorkflowControllerError(failure_message)
elif workflow.status not in [RunStatus.created, RunStatus.queued]:
Expand Down Expand Up @@ -193,6 +194,7 @@ def delete_workflow(workflow, all_runs=False, workspace=False):
RunStatus.deleted,
RunStatus.failed,
RunStatus.queued,
RunStatus.pending,
]:
try:
to_be_deleted = [workflow]
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
RunStatus.created,
RunStatus.failed,
RunStatus.finished,
RunStatus.pending,
RunStatus.stopped,
pytest.param(RunStatus.deleted, marks=pytest.mark.xfail),
pytest.param(RunStatus.running, marks=pytest.mark.xfail),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from reana_workflow_controller.workflow_run_manager import WorkflowRunManager

status_dict = {
START: RunStatus.running,
START: RunStatus.queued,
STOP: RunStatus.finished,
}

Expand Down Expand Up @@ -608,7 +608,7 @@ def test_start_already_started_workflow(
assert res.status_code == 409
expected_message = (
"Workflow {0} could not be started because"
" it is already running."
" it has been already queued."
).format(workflow_created_uuid)
assert json_response.get("message") == expected_message

Expand Down

0 comments on commit dccd29a

Please sign in to comment.