Skip to content

Commit

Permalink
Print settings (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 authored Sep 29, 2021
1 parent ade8fb7 commit 9d814ff
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zppy/amwg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pprint

import jinja2

Expand Down Expand Up @@ -42,6 +43,7 @@ def amwg(config, scriptDir):
c["prefix"] = prefix
scriptFile = os.path.join(scriptDir, "%s.csh" % (prefix))
statusFile = os.path.join(scriptDir, "%s.status" % (prefix))
settingsFile = os.path.join(scriptDir, "%s.settings" % (prefix))
skip = checkStatus(statusFile)
if skip:
continue
Expand All @@ -58,6 +60,11 @@ def amwg(config, scriptDir):
),
]

with open(settingsFile, "w") as sf:
p = pprint.PrettyPrinter(indent=2, stream=sf)
p.pprint(c)
p.pprint(s)

if not c["dry_run"]:
# Submit job
jobid = submitScript(
Expand Down
7 changes: 7 additions & 0 deletions zppy/climo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pprint
import re

import jinja2
Expand Down Expand Up @@ -62,6 +63,7 @@ def climo(config, scriptDir):
c["prefix"] = prefix
scriptFile = os.path.join(scriptDir, "%s.bash" % (prefix))
statusFile = os.path.join(scriptDir, "%s.status" % (prefix))
settingsFile = os.path.join(scriptDir, "%s.settings" % (prefix))
skip = checkStatus(statusFile)
if skip:
continue
Expand All @@ -70,6 +72,11 @@ def climo(config, scriptDir):
with open(scriptFile, "w") as f:
f.write(template.render(**c))

with open(settingsFile, "w") as sf:
p = pprint.PrettyPrinter(indent=2, stream=sf)
p.pprint(c)
p.pprint(s)

if not c["dry_run"]:
# Submit job
jobid = submitScript(scriptFile)
Expand Down
7 changes: 7 additions & 0 deletions zppy/e3sm_diags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pprint

import jinja2

Expand Down Expand Up @@ -46,6 +47,7 @@ def e3sm_diags(config, scriptDir):
c["prefix"] = prefix
scriptFile = os.path.join(scriptDir, "%s.bash" % (prefix))
statusFile = os.path.join(scriptDir, "%s.status" % (prefix))
settingsFile = os.path.join(scriptDir, "%s.settings" % (prefix))
skip = checkStatus(statusFile)
if skip:
continue
Expand Down Expand Up @@ -90,6 +92,11 @@ def e3sm_diags(config, scriptDir):
)
)

with open(settingsFile, "w") as sf:
p = pprint.PrettyPrinter(indent=2, stream=sf)
p.pprint(c)
p.pprint(s)

if not c["dry_run"]:
# Submit job
jobid = submitScript(
Expand Down
7 changes: 7 additions & 0 deletions zppy/e3sm_diags_vs_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pprint

import jinja2

Expand Down Expand Up @@ -52,6 +53,7 @@ def e3sm_diags_vs_model(config, scriptDir):
c["prefix"] = prefix
scriptFile = os.path.join(scriptDir, "%s.bash" % (prefix))
statusFile = os.path.join(scriptDir, "%s.status" % (prefix))
settingsFile = os.path.join(scriptDir, "%s.settings" % (prefix))
skip = checkStatus(statusFile)
if skip:
continue
Expand All @@ -68,6 +70,11 @@ def e3sm_diags_vs_model(config, scriptDir):
),
]

with open(settingsFile, "w") as sf:
p = pprint.PrettyPrinter(indent=2, stream=sf)
p.pprint(c)
p.pprint(s)

if not c["dry_run"]:
# Submit job
jobid = submitScript(
Expand Down
7 changes: 7 additions & 0 deletions zppy/global_time_series.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pprint

import jinja2

Expand Down Expand Up @@ -36,6 +37,7 @@ def global_time_series(config, scriptDir):
c["prefix"] = prefix
scriptFile = os.path.join(scriptDir, "%s.bash" % (prefix))
statusFile = os.path.join(scriptDir, "%s.status" % (prefix))
settingsFile = os.path.join(scriptDir, "%s.settings" % (prefix))
skip = checkStatus(statusFile)
if skip:
continue
Expand Down Expand Up @@ -92,6 +94,11 @@ def global_time_series(config, scriptDir):
)
)

with open(settingsFile, "w") as sf:
p = pprint.PrettyPrinter(indent=2, stream=sf)
p.pprint(c)
p.pprint(s)

if not c["dry_run"]:
# Submit job
jobid = submitScript(
Expand Down
7 changes: 7 additions & 0 deletions zppy/mpas_analysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pprint

import jinja2

Expand Down Expand Up @@ -76,6 +77,7 @@ def mpas_analysis(config, scriptDir):
c["prefix"] = prefix
scriptFile = os.path.join(scriptDir, "%s.bash" % (prefix))
statusFile = os.path.join(scriptDir, "%s.status" % (prefix))
settingsFile = os.path.join(scriptDir, "%s.settings" % (prefix))

# Check if we can skip because it completed successfully before
skip = checkStatus(statusFile)
Expand All @@ -88,6 +90,11 @@ def mpas_analysis(config, scriptDir):
with open(scriptFile, "w") as f:
f.write(template.render(**c))

with open(settingsFile, "w") as sf:
p = pprint.PrettyPrinter(indent=2, stream=sf)
p.pprint(c)
p.pprint(s)

if not c["dry_run"]:
# Submit job
jobid = submitScript(scriptFile, dependFiles=dependencies)
Expand Down
7 changes: 7 additions & 0 deletions zppy/ts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pprint
import re

import jinja2
Expand Down Expand Up @@ -70,6 +71,7 @@ def ts(config, scriptDir):
c["prefix"] = prefix
scriptFile = os.path.join(scriptDir, "%s.bash" % (prefix))
statusFile = os.path.join(scriptDir, "%s.status" % (prefix))
settingsFile = os.path.join(scriptDir, "%s.settings" % (prefix))
skip = checkStatus(statusFile)
if skip:
continue
Expand All @@ -78,6 +80,11 @@ def ts(config, scriptDir):
with open(scriptFile, "w") as f:
f.write(template.render(**c))

with open(settingsFile, "w") as sf:
p = pprint.PrettyPrinter(indent=2, stream=sf)
p.pprint(c)
p.pprint(s)

if not c["dry_run"]:
# Submit job
jobid = submitScript(scriptFile)
Expand Down

0 comments on commit 9d814ff

Please sign in to comment.