Skip to content

Commit

Permalink
more workflow status added; update setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SHuang-Broad committed Jun 17, 2024
1 parent 986eea7 commit 129aaf4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('test-requirements.txt', 'r') as fh:
test_dev_install = [l.rstrip('\n') for l in fh.readlines()]

version = "0.0.11"
version = "0.0.12"
setup(
name="lrmaCUX",
version=version,
Expand All @@ -20,7 +20,7 @@
long_description=open("README.md").read(),
long_description_content_type="text/markdown",

python_requires=">=3.7",
python_requires=">=3.9",
install_requires=to_be_installed,
tests_require=test_dev_install,

Expand All @@ -37,9 +37,9 @@
"License :: OSI Approved :: BSD 3-Clause",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)
30 changes: 27 additions & 3 deletions src/lrmaCU/terra/submission/submission_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,20 @@ def get_submissions_for_method_config(ns: str, ws: str, method_config: str, days
class WorkflowExeStatus(str, Enum):
"""
Modeling the status of a particular workflow execution.
The str values are taken from the Terra UI.
"""

# transition state
QUEUED = 'Queued'
SUBMITTED = 'Submitted'
LAUNCHING = 'Launching'
RUNN = 'Running'
ABORTING = 'Aborting'

# terminal state
FAIL = 'Failed'
SUCC = 'Succeeded'
RUNN = 'Running'
ABORTED = 'Aborted'
ABORTING = 'Aborting'


class EntityStatuses:
Expand Down Expand Up @@ -525,6 +533,10 @@ def get_entities_in_a_submission(ns: str, ws: str, submission_id: str,
aborted = list()
aborting = list()
running = list()
queued = list()
submitted = list()
launching = list()

for w in batch_submission_json['workflows']:
e = w['workflowEntity']['entityName']
t = parser.parse(w['statusLastChangedDate'])
Expand All @@ -539,14 +551,23 @@ def get_entities_in_a_submission(ns: str, ws: str, submission_id: str,
aborting.append((e, t))
elif WorkflowExeStatus.RUNN.value == st:
running.append((e, t))
elif WorkflowExeStatus.QUEUED.value == st:
queued.append((e, t))
elif WorkflowExeStatus.SUBMITTED.value == st:
submitted.append((e, t))
elif WorkflowExeStatus.LAUNCHING.value == st:
launching.append((e, t))
else:
raise ValueError(f"Seeing workflow execution status not seen before: {st}. lrmaCUX needs to be updated.")

return {WorkflowExeStatus.SUCC: success,
WorkflowExeStatus.FAIL: failure,
WorkflowExeStatus.ABORTED: aborted,
WorkflowExeStatus.ABORTING: aborting,
WorkflowExeStatus.RUNN: running}
WorkflowExeStatus.RUNN: running,
WorkflowExeStatus.QUEUED: queued,
WorkflowExeStatus.SUBMITTED: submitted,
WorkflowExeStatus.LAUNCHING: launching, }


# todo: this gather is quite slow, anyway to speed it up?
Expand Down Expand Up @@ -632,6 +653,9 @@ def update(dd: Dict[WorkflowExeStatus, List[Tuple[str, datetime.datetime]]],
update(dd, WorkflowExeStatus.SUCC)
update(dd, WorkflowExeStatus.FAIL)
update(dd, WorkflowExeStatus.ABORTED)
update(dd, WorkflowExeStatus.QUEUED)
update(dd, WorkflowExeStatus.SUBMITTED)
update(dd, WorkflowExeStatus.LAUNCHING)

return list( entity_statuses.values() )

Expand Down

0 comments on commit 129aaf4

Please sign in to comment.