diff --git a/reana_db/models.py b/reana_db/models.py index 5f2abe7..98a98c0 100644 --- a/reana_db/models.py +++ b/reana_db/models.py @@ -293,12 +293,19 @@ class RunStatus(enum.Enum): deleted = 4 stopped = 5 queued = 6 + pending = 7 ALLOWED_WORKFLOW_STATUS_TRANSITIONS = [ - # Creation + # Created (RunStatus.created, RunStatus.deleted), - (RunStatus.created, RunStatus.running), + (RunStatus.created, RunStatus.queued), + # Queued + (RunStatus.queued, RunStatus.deleted), + (RunStatus.queued, RunStatus.pending), + # Pending + (RunStatus.pending, RunStatus.running), + (RunStatus.pending, RunStatus.deleted), # Running (RunStatus.running, RunStatus.failed), (RunStatus.running, RunStatus.finished), diff --git a/setup.py b/setup.py index 06a1d3f..30d3ef0 100755 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ install_requires = [ "alembic>=1.4.2", "psycopg2-binary>=2.6.1", - "SQLAlchemy>=1.2.7", + "SQLAlchemy>=1.2.7,<1.4.0", 'sqlalchemy-utils>=0.35.0 ; python_version>="3"', 'sqlalchemy-utils<=0.36.3 ; python_version=="2.7"', "cryptography>=2.9.2", # Required by sqlalchemy_utils.EncryptedType diff --git a/tests/test_models.py b/tests/test_models.py index 8768cdd..1d5f664 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -89,6 +89,16 @@ def test_workflow_run_number_assignment(db, session, new_user): (RunStatus.created, RunStatus.failed, False), (RunStatus.created, RunStatus.finished, False), (RunStatus.created, RunStatus.stopped, False), + (RunStatus.created, RunStatus.running, False), + (RunStatus.created, RunStatus.pending, False), + (RunStatus.queued, RunStatus.failed, False), + (RunStatus.queued, RunStatus.finished, False), + (RunStatus.queued, RunStatus.stopped, False), + (RunStatus.queued, RunStatus.running, False), + (RunStatus.pending, RunStatus.failed, False), + (RunStatus.pending, RunStatus.finished, False), + (RunStatus.pending, RunStatus.stopped, False), + (RunStatus.pending, RunStatus.created, False), (RunStatus.deleted, RunStatus.created, False), (RunStatus.deleted, RunStatus.failed, False), (RunStatus.deleted, RunStatus.finished, False),