From df3401aae687ff26f67427cc4e12aa7c3631429a Mon Sep 17 00:00:00 2001 From: Audrius Mecionis Date: Wed, 21 Apr 2021 14:30:33 +0200 Subject: [PATCH 1/2] models: add new pending state closes https://github.com/reanahub/reana-workflow-controller/issues/363 --- reana_db/models.py | 11 +++++++++-- setup.py | 3 ++- tests/test_models.py | 10 ++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) 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..91c5bce 100755 --- a/setup.py +++ b/setup.py @@ -41,7 +41,8 @@ install_requires = [ "alembic>=1.4.2", "psycopg2-binary>=2.6.1", - "SQLAlchemy>=1.2.7", + 'SQLAlchemy>=1.2.7 ; python_version>="3"', + 'SQLAlchemy>=1.2.7,<1.4.0 ; python_version=="2.7"', '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), From 8b746685ff04e524ffb72ec78fa80d375fa77561 Mon Sep 17 00:00:00 2001 From: Audrius Mecionis Date: Tue, 27 Apr 2021 13:58:55 +0200 Subject: [PATCH 2/2] release: 0.8.0a12 --- reana_db/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reana_db/version.py b/reana_db/version.py index 46df7cc..8c0a8f1 100644 --- a/reana_db/version.py +++ b/reana_db/version.py @@ -14,4 +14,4 @@ from __future__ import absolute_import, print_function -__version__ = "0.8.0a11" +__version__ = "0.8.0a12"