Skip to content

Commit

Permalink
Merge branch 'jgfouca/cime/fix_prev_run_env_vars' into next (PR #3139)
Browse files Browse the repository at this point in the history
preview_run: Fix case where mpirun cmd uses env vars

The mpirun cmd was being retrieved before the full environment was
being loaded, leading to unresolved env vars appearing in the command.

[BFB]

* origin/jgfouca/cime/fix_prev_run_env_vars:
  preview_run: Fix case where mpirun cmd uses env vars
  Update CIME to ESMCI cime5.8.7-2 (PR #3126)
  • Loading branch information
jgfouca committed Aug 16, 2019
2 parents 474ea21 + 6c8ef68 commit 61c0438
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cime/scripts/Tools/preview_run
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,23 @@ def _main_func(description):
job_id_to_cmd = case.submit_jobs(dry_run=True, job=job)
env_batch = case.get_env('batch')
for job_id, cmd in job_id_to_cmd:
overrides = env_batch.get_job_overrides(job_id, case)
print(" FOR JOB: {}".format(job_id))
print(" ENV:")
case.load_env(job=job_id, reset=True, verbose=True)

if "OMP_NUM_THREADS" in os.environ:
print(" Setting Environment OMP_NUM_THREADS={}".format(os.environ["OMP_NUM_THREADS"]))
print("")
print(" SUBMIT CMD:")
print(" {}".format(case.get_resolved_value(cmd)))
print("")

# get_job_overrides must come after the case.load_env since the cmd may use
# env vars.
overrides = env_batch.get_job_overrides(job_id, case)
print(" MPIRUN (job={}):".format(job_id))
print (" {}".format(overrides["mpirun"]))
print (" {}".format(case.get_resolved_value(overrides["mpirun"])))
print("")



if __name__ == "__main__":
_main_func(__doc__)

0 comments on commit 61c0438

Please sign in to comment.