Skip to content

Commit

Permalink
made deep copies of objects in calls to --all and --summary are disti…
Browse files Browse the repository at this point in the history
…nct and only -w ane -d are re-used
  • Loading branch information
tmcguinness committed May 14, 2024
1 parent 0d68041 commit 6425410
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
name: Run unit tests on CI system
permissions:
checks: write
pull-requests: write

steps:
- name: Checkout code
Expand Down
20 changes: 11 additions & 9 deletions ci/scripts/utils/rocotostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import sys
import os
import copy

from wxflow import which, Logger, CommandNotFoundError
from argparse import ArgumentParser, FileType
Expand Down Expand Up @@ -55,7 +56,7 @@ def rocotostat_summary(rocotostat):
Output:
rocoto_status - A dictionary with the total number of cycles and the number of cycles marked as 'Done'.
"""

rocotostat = copy.deepcopy(rocotostat)
rocotostat.add_default_arg('--summary')
rocotostat_output = rocotostat(output=str)
rocotostat_output = rocotostat_output.splitlines()[1:]
Expand All @@ -70,9 +71,9 @@ def rocotostat_summary(rocotostat):

def rocoto_statcount(rocotostat):
"""
ROCOTO_STATCOUNT Run rocotostat and process its output.
rocoto_statcount Run rocotostat and process its output.
ROCOTO_STATCOUNT(rocotostat) adds a default argument '--all' to the rocotostat
rocoto_statcount(rocotostat) adds a default argument '--all' to the rocotostat
command, runs it, and processes its output to return a dictionary with the count
of each status case.
Expand All @@ -83,6 +84,7 @@ def rocoto_statcount(rocotostat):
rocoto_status - A dictionary with the count of each status case.
"""

rocotostat = copy.deepcopy(rocotostat)
rocotostat.add_default_arg('--all')

rocotostat_output = rocotostat(output=str)
Expand All @@ -102,9 +104,9 @@ def rocoto_statcount(rocotostat):

def is_done(rocoto_status):
"""
IS_DONE Check if all cycles are done.
is_done Check if all cycles are done.
IS_DONE(rocoto_status) checks if the total number of cycles equals the number of
is_done(rocoto_status) checks if the total number of cycles equals the number of
done cycles in the rocoto_status dictionary.
Input:
Expand All @@ -122,9 +124,9 @@ def is_done(rocoto_status):

def is_stalled(rocoto_status):
"""
IS_STALLED Check if all cycles are stalled.
is_stalled Check if all cycles are stalled.
IS_STALLED(rocoto_status) checks if all cycles are stalled by verifying if
is_stalled(rocoto_status) checks if all cycles are stalled by verifying if
there are no jobs that are RUNNING, SUBMITTING, or QUEUED.
Input:
Expand All @@ -142,9 +144,9 @@ def is_stalled(rocoto_status):

if __name__ == '__main__':
"""
MAIN Execute the script.
main Execute the script.
MAIN() parses the input arguments, checks if the rocotostat command is available,
main() parses the input arguments, checks if the rocotostat command is available,
adds default arguments to the rocotostat command, and runs it and reports
out to stdout spcific information of rocoto workflow.
"""
Expand Down

0 comments on commit 6425410

Please sign in to comment.