Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions CrocoDash/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def __init__(
ntasks_ocn : int, optional
Number of tasks for the ocean model. If None, defaults to VisualCaseGen Grid Calculation.
job_queue: str, optional
The queue to submit the CESM case to. If None, defaults to the CESM defaults (usually main)
The queue to submit the CESM case to. If None, defaults to the CESM defaults (usually main).
Ignored, with a warning, on a machine with no batch system (e.g. ubuntu-latest).
job_wallclock_time: str, optional
Must be in the form hh:mm:ss. If None, defaults to the CESM defaults
"""
Expand Down Expand Up @@ -1105,7 +1106,15 @@ def _apply_final_xmlchanges(
xmlchange("NTASKS_OCN", ntasks_ocn, is_non_local=self.cc._is_non_local())
# This will trigger for both the run and the archiver.
if job_queue is not None:
xmlchange("JOB_QUEUE", job_queue, is_non_local=self.cc._is_non_local())
# A machine with no batch system (e.g. ubuntu-latest) has no queues,
# and xmlchange rejects any JOB_QUEUE there.
if self._cime_case.get_value("BATCH_SYSTEM") == "none":
Comment thread
alperaltuntas marked this conversation as resolved.
Resolved
Comment thread
alperaltuntas marked this conversation as resolved.
Resolved
print(
f"WARNING: ignoring job_queue={job_queue!r}: machine "
f"{self.machine} has no batch system."
)
else:
xmlchange("JOB_QUEUE", job_queue, is_non_local=self.cc._is_non_local())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not introduced by this PR, but related: when this xmlchange fails, all the user sees is Error running ./xmlchange JOB_QUEUE=mian. because visualCaseGen's xmlchange captures stderr and doesn't include it in the RuntimeError. So the CIME message is lost, and the case is deleted. Checking the queue name up front (see above) would avoid this for JOB_QUEUE. Including runout.stderr in that error message in visualCaseGen would help for the other variables too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like ESMCI/visualCaseGen#51 allows errors passing to the user

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also not introduced here: job_queue goes unquoted into a shell=True command (cmd = f"./xmlchange {var}={val}" in visualCaseGen case_tools.py), and init_args_check only checks that it is a str. A value with a space, ;, or $ would break the command or run something else in caseroot. Same for job_wallclock_time. Probably best fixed in visualCaseGen with shlex.quote. (These can be a separate PR).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like ESMCI/visualCaseGen#51 solves this

Comment thread
alperaltuntas marked this conversation as resolved.
Resolved
if job_wallclock_time is not None:
xmlchange(
"JOB_WALLCLOCK_TIME",
Expand Down
Loading