Skip to content

Commit

Permalink
Raise error if resub_states and no_resub_failed both set
Browse files Browse the repository at this point in the history
  • Loading branch information
akremin committed Aug 30, 2024
1 parent 2665747 commit 75a2b18
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/desi_resubmit_queue_failures
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,26 @@ def parse_args(): # options=None):
"OUT_OF_MEMORY, PREEMPTED, TIMEOUT, CANCELLED, FAILED.")
parser.add_argument("--no-resub-failed", action="store_true", required=False,
help="Give this flag if you do NOT want to resubmit " +
"jobs with Slurm status 'FAILED' by default.")
"jobs with Slurm status 'FAILED' by default. " +
"This should not be used if defining " +
"--resub-states explicitly.")

args = parser.parse_args()

if args.resub_states is not None:
## User should never provide custom list of states and request to remove FAILED
if args.no_resub_failed:
log = get_logger()
msg = f"Provided user-defined resubmision states {args.resub_states} but " \
+ f"also requested args.no_resub_failed. Please choose one or the other."
log.critical(msg)
raise ValueError(msg)
## Clean up the input string into a list of strings
args.resub_states = [state.strip().upper() for state in args.resub_states.split(',')]

return args


if __name__ == '__main__':
args = parse_args()
log = get_logger()
Expand Down

0 comments on commit 75a2b18

Please sign in to comment.