-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add skip-preview-namelist to case.submit and case_run #1471
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in template.case.run needs to be made on the cesm side as well.
scripts/Tools/case.submit
Outdated
description=description, | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter | ||
) | ||
parser = argparse.ArgumentParser(description=description) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this code removed?
scripts/Tools/case.submit
Outdated
parser.add_argument("-a", "--batch-args", | ||
help="Used to pass additional arguments to batch system. ") | ||
|
||
args = parser.parse_args(args[1:]) | ||
args = parser.parse_args() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in conflict with master - I recommend that you rebase and update the PR.
scripts/Tools/case.submit
Outdated
|
||
CIME.utils.expect(args.prereq is None, "--prereq not currently supported") | ||
|
||
CIME.utils.handle_standard_logging_options(args) | ||
|
||
return args.caseroot, args.job, args.no_batch, args.resubmit, args.batch_args | ||
return args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer the old method of passing the individual fields of args not the args object itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"We" is overly broad here. Some of us prefer passing the args object itself :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am asking for some uniformity across scripts and we have chosen to pass individual fields rather than the args object. Same issue with format - we have standardized around %s and I see no reason to change it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jedwards4b I see your point about uniformity. I think what's going on here (if I can try to speak somewhat for @erichlf and somewhat for myself) is that there are certain coding standards like these that were put in place when the list of cime developers was very small (basically you and Jim F), and now, as there get to be more cime developers, we're not all in agreement about these coding standards.
Could I suggest, @erichlf - for now leave this as it was, but either open an issue for discussion or put this on the agenda of an upcoming Wednesday cime telecon to revisit our coding standards on these points (%
vs. format and returning an args object vs. a big list of components).
@@ -43,7 +43,7 @@ def set_value(self, item, value, subgroup=None, ignore_type=False): | |||
elif value.count(":") == 2: | |||
t_spec = "%H:%M:%S" | |||
else: | |||
expect(False, "could not interpret format for wallclock time %s"%value) | |||
expect(False, "could not interpret format for wallclock time {}".format(value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why these changes from %s to format were made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is for python3 compatibility. Yes, we aren't using python3, but it is an easy change that doesn't hurt things and will make any future switch to python3 that much easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer the new-style format
, because I find it more readable. That said, I'm pretty sure that both are supported by python3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right that both are currently supported, but if I recall the plan is not to support the old style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not object to changes that bring us closer to python3 compatibility - however I do object to having a mixture of %s and format and we are about to do a release. I would prefer to wait until after the release and then apply this change uniformly throughout the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{}
and format
this is already many instances where this has been implemented throughout the code and not by me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erichlf , I will approve these changes, and I think @jedwards4b will too, if your next PR is a global update to the new string format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely happy to do so.
863f30f
to
bb6fecc
Compare
I believe I have addressed all issues, and now things should be working with no conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still like to see these format changes reverted to %s
|
||
if args.caseroot is not None: | ||
os.chdir(args.caseroot) | ||
|
||
return args.caseroot | ||
if args.skip_preview_namelist is None: | ||
args.skip_preview_namelist = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use 4-space indents in CIME's python. You should probably configure your editor to do it this way so we stay consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doh!
> %s | ||
""" % ((os.path.basename(args[0]), ) * 4), | ||
> {} | ||
""".format(((os.path.basename(args[0]), ) * 4), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought one of the benefits of the new-style string formatting is that you don't have to repeat yourself when inserting the same string. Something like {1} {1} {1}.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix. In this case it would be {0}
since lists/arrays start at 0 in python.
scripts/Tools/case.submit
Outdated
> %s | ||
""" % ((os.path.basename(args[0]), ) * 4), | ||
> {0} | ||
""".format(os.path.basename(args[0], )), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the argument to format still need to be a tuple if it's only one thing?
@@ -43,7 +43,7 @@ def set_value(self, item, value, subgroup=None, ignore_type=False): | |||
elif value.count(":") == 2: | |||
t_spec = "%H:%M:%S" | |||
else: | |||
expect(False, "could not interpret format for wallclock time %s"%value) | |||
expect(False, "could not interpret format for wallclock time {}".format(value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erichlf , I will approve these changes, and I think @jedwards4b will too, if your next PR is a global update to the new string format.
scripts/lib/CIME/case_run.py
Outdated
@@ -120,7 +121,7 @@ def _run_model_impl(case, lid): | |||
restore_from_archive(case) | |||
|
|||
orig_cont = case.get_value("CONTINUE_RUN") | |||
if not orig_cont: | |||
if not (orig_cont or skip_pnl): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @jedwards4b can help me here. I don't know if skipping create_namelists here is safe if orig_cont is False. run_model can be invoked several times for certain tests and in other situations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still want to change the CONTINUE_RUN value in either case, so the skip_pnl should be a seperate conditional
if not orig_cont:
case.set_value("CONTINUE_RUN", True)
if not skp_pnl:
create_namelists(case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix.
scripts/lib/CIME/case_run.py
Outdated
@@ -122,6 +123,7 @@ def _run_model_impl(case, lid): | |||
orig_cont = case.get_value("CONTINUE_RUN") | |||
if not orig_cont: | |||
case.set_value("CONTINUE_RUN", True) | |||
if not skip_pnl: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still isn't right. You've changed the original intent which was to re-run create_namelists if CONTINUE_RUN was False. For now, let's not worry about skip_pnl in this code. This code is for recovery from node failures which is a rare corner case and we don't need to worry about how it performs.
Added the '--skip-preview-namelist' option to case.submit so that we only build the namelist when needed. The default is false. However, when running scripts/tests/scripts_regression_tests.py test_save_timings fails. I am currently debugging this issue.
While converting many of the python2.7 style strings to python3 I made a mistake in a regex and have fixed those mistakes.
The unpacking of args wasn't working correctly for some strange reason, so I have now switched to packed args. Additionally, I converted '--test' to be a proper argument parsed by argparser. This is still failing `./scripts/tests/scripts_regression_tests.py L_TestSaveTimings`
Added '--skip-preview-namelist' to case.build. This will allow the user to specify if the namelist should be rebuilt from user_nl_8. In this particular commit I added '--skip-preview-namelist' to the call for case.build in the testing suite, since building namelists during tests isn't done. Test suite: scripts_regression_tests.py Test baseline: Test namelist changes: Test status: bit for bit Fixes #1276, E3SM-Project/E3SM#1466 (comment) User interface changes?: Added --skip-preview-namelist to case.build and template.case.run Code review: @jgfouca, @rljacob
After a rebase from master a few issues reappeared. Most issues were typos or wrong function handle used. I have fixed these issues. Test suite: scripts_regression_tests.py Test baseline: Test namelist changes: Test status: bit for bit Fixes #1276 User interface changes?: Added skip-preview-namelist option Code review: @rljacob, @jgfouca
Fixed some indentation inconsistencies, removed the tuple from usage in parser, fixed logical for skip_pnl and continue_run, and finally fixed some consistency in strings. Test suite: scripts_regression_tests.py Test baseline: Test namelist changes: Test status: bit for bit Fixes #1276, E3SM-Project/E3SM#1466 User interface changes?: Added --skip-preview-namelist to case.build and template.case.run Code review: @jgfouca, @rljacob
Removed the logic for skip_pnl in the CONTINUE_RUN portion of the code as per @jgfouca Test suite: scripts_regression_tests.py Test baseline: Test namelist changes: Test status: bit for bit Fixes #1276, E3SM-Project/E3SM#1466 User interface changes?: Added --skip-preview-namelist option to case.submit Code review: @jgfouca, @rljacob
f94d6fd
to
5a6d393
Compare
This should be ready now. |
@jgfouca Because he was on the origin issue. |
With the new reviewing system in github, I'm not sure it matters. As long as you or Jim review it. But to get it merged quickly, probably want to re-assign it. |
When might we see this in ACME? |
We are currently a little past alpha.10 we'd need alpha.12 to get this. |
Added '--skip-preview-namelist' to case.build
Added '--skip-preview-namelist' to case.build. This will allow the user
to specify if the namelist should be rebuilt from user_nl_*.
Test suite: scripts_regression_tests.py
Test baseline:
Test namelist changes:
Test status: bit for bit
Fixes #1276, E3SM-Project/E3SM#1466
User interface changes?: Added --skip-preview-namelist to case.build and
template.case.run
Code review: @jgfouca, @rljacob