Skip to content

Commit

Permalink
models: add new pending state
Browse files Browse the repository at this point in the history
  • Loading branch information
audrium committed Apr 22, 2021
1 parent a3adc68 commit 4c7a369
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
11 changes: 9 additions & 2 deletions reana_db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 4c7a369

Please sign in to comment.