-
Notifications
You must be signed in to change notification settings - Fork 216
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
Give users more info and control over key run commands #1359
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
af10dbe
New tool: get_key_commands
jgfouca 5065848
Rename to preview_run
jgfouca e790212
Add mpirun and batch overrides
jgfouca 7948d49
Improve error reporting
jgfouca e7319b0
Update documentation
jgfouca 845bf15
Changes based on review
jgfouca 670cf97
Merge remote-tracking branch 'origin/master' into jgfouca/new_query_t…
jgfouca 78cf98c
Fix merge problem
jgfouca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Script to query key CIME shell commands (mpirun and batch submission). | ||
|
||
To force a certain mpirun command, use: | ||
./xmlchange MPI_RUN_COMMAND=$your_cmd | ||
|
||
Example: | ||
./xmlchange MPI_RUN_COMMAND='mpiexec -np 16 --some-flag' | ||
|
||
To force a certain qsub command, use: | ||
./xmlchange --subgroup=case.run BATCH_COMMAND_FLAGS=$your_flags | ||
|
||
Example: | ||
./xmlchange --subgroup=case.run BATCH_COMMAND_FLAGS='--some-flag --other-flag' | ||
""" | ||
|
||
from standard_script_setup import * | ||
|
||
from CIME.case import Case | ||
|
||
############################################################################### | ||
def parse_command_line(args, description): | ||
############################################################################### | ||
parser = argparse.ArgumentParser( | ||
usage="""\n%s [--verbose] | ||
OR | ||
%s --help | ||
OR | ||
%s --test | ||
|
||
\033[1mEXAMPLES:\033[0m | ||
\033[1;32m# Run the tool \033[0m | ||
> %s | ||
""" % ((os.path.basename(args[0]), ) * 4), | ||
description=description, | ||
formatter_class=argparse.RawTextHelpFormatter | ||
) | ||
|
||
parser.add_argument("caseroot", nargs="?", default=os.getcwd(), | ||
help="Case directory to build") | ||
|
||
args = parser.parse_args(args[1:]) | ||
|
||
return args.caseroot | ||
|
||
############################################################################### | ||
def _main_func(description): | ||
############################################################################### | ||
if "--test" in sys.argv: | ||
test_results = doctest.testmod(verbose=True) | ||
sys.exit(1 if test_results.failed > 0 else 0) | ||
|
||
caseroot = parse_command_line(sys.argv, description) | ||
|
||
logging.disable(logging.CRITICAL) | ||
|
||
with Case(caseroot, read_only=False) as case: | ||
print "BATCH SUBMIT:" | ||
job = "case.test" if case.get_value("TEST") else "case.run" | ||
job_id_to_cmd = case.submit_jobs(dry_run=True, job=job) | ||
for job_id, cmd in job_id_to_cmd: | ||
print " ", job_id, "->", case.get_resolved_value(cmd) | ||
print "MPIRUN:", case.get_resolved_value(case.get_mpirun_cmd()) | ||
|
||
if __name__ == "__main__": | ||
_main_func(__doc__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 not just add dry_run to the condition on line 299?
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.
dry_run is the only case where we want to fake-out the BUILD_COMPLETE prereq.
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.
Oh, I see what you mean. We want to preserve the other prereqs besides the BUILD_COMPLETE one so that we get an accurate list of which jobs will be run.