The -a or --batch_args argument to case.submit didn't work for me

raeder

Member
I wanted to specify the earliest time my job would run (11:00 today) by passing "-a 1100" to qsub via the -a argument to case.submit.
I tried many combinations of quoting the 2 word argument, but could not find one that case.submit would accept.
I'm using a maint-5.8 cime (`git describe --tags` yields to-acme-2019-03-12-3420-gca503666c),
but I think these issues persisted into cesm2_3_beta17.

The command + error combinations included:
-a "-a 1100"
case.submit: error: argument -a/--batch-args: expected one argument
(It looks like one to naive users...)
Also, this error message should maybe report --batch_args instead of --batch-args.
There's more inconsistency with the long form of the argument:
`case.submit --help` yields "--batch_args BATCH_ARGS BATCH_ARGS",
but
--batch_args '-a 1100'
error: unrecognized arguments: --batch_args

The "expected one argument" led to me adding ' nargs=2,' to the case.submit: parser.add_argument("-a" command.
That helped, but caused

-a ' -a' 1100 and
--batch_args ' -a' 1100
env_batch.py (line 659): submitargs += " " + batch_args
TypeError: can only concatenate str (not "list") to str

This led me to replace line 659 with
args_list = [submitargs] + batch_args
submitargs = " ".join(args_list)

This appears to work, but is probably not the preferred solution, especially because of the hard-coding of nargs=2.
But I don't have the python+cime chops to propose a robust fix.

I'm guessing that this is not a high priority, but I want to bring it up in case other people run into it.

Kevin
 

jedwards

CSEG and Liaisons
Staff member
Hi Kevin,
I've tested that this works correctly for cesm3_0_beta02. The XML variable that should be changed is BATCH_COMMAND_FLAGS, and I changed it as follows:
./xmlchange BATCH_COMMAND_FLAGS="-a 1100" --append --subgroup=case.run
You can check the results of your change without actually submitting by running preview_run and examining the qsub presented there.

If you want to use an older cime version I think that the best way to do this is to manually edit the .case.run script and add
#PBS -a 1100
 

raeder

Member
I'm glad to read that it works in cesm3, and thanks for the suggestions.

I remember from years past that it's recommended to not change .case.run
(also indicated by the fact that it's a hidden file). Is that still generally true?
 

jedwards

CSEG and Liaisons
Staff member
Yes - this is only a suggested workaround for you and .case.run will be overwritten if you run case.setup
 
Back
Top