Skip to content

Commit

Permalink
using separated output-dir for automated and GUI runs
Browse files Browse the repository at this point in the history
  • Loading branch information
heikoklein committed Dec 10, 2024
1 parent b7a3e9c commit 0a80c8f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions utils/SnapPy/Snappy/Resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Resources(ResourcesCommon):

# OUTPUTDIR = "/disk1/tmp"
_OUTPUTDIR = "{LUSTREDIR}/project/fou/kl/snap/runs"
_OUTPUTDIR_AUTOMATED = "{LUSTREDIR}/project/fou/kl/snap/automated_runs"
_ECINPUTDIRS = ["{LUSTREDIR}/project/metproduction/products/cwf-input/"]
# ECINPUTDIRS = ["/lustre/storeB/users/heikok/Meteorology/ecdis2cwf/"]
EC_FILENAME_PATTERN = "meteo{year:04d}{month:02d}{day:02d}_{dayoffset:02d}.nc"
Expand Down Expand Up @@ -508,8 +509,21 @@ def getBSnapInputFile(self):
return filename

def getSnapOutputDir(self):
"""Output directory of SNAP-runs for manual runs through the front-end.
This directory is available for all SnapPy users.
:return: path as directory, adapted for LUSTREDIR
"""
return self._OUTPUTDIR.format(LUSTREDIR=self.getLustreDir())

def getSnapOutputDirAutomated(self):
"""Output directory of SNAP-runs for automated runs, e.g. run through cron.
This directory is available for group snap-op.
:return: path as directory, adapted for LUSTREDIR
"""
return self._OUTPUTDIR_AUTOMATED.format(LUSTREDIR=self.getLustreDir())

def _findFileInPathes(self, file, pathes):
for path in pathes:
filename = os.path.join(path, file)
Expand Down
2 changes: 1 addition & 1 deletion utils/SnapPy/snapRunnerNpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def runsnap(npp_tag, met_model, outdir, release_dt, runtime, plot_from_file=None
npp = get_tag_NPP(npp_tag)
res = Resources()
dirname = os.path.join(
res.getSnapOutputDir(),
res.getSnapOutputDirAutomated(),
"{0}_{1}".format(npp, strftime("%Y-%m-%dT%H%M%S", tag_time)),
)

Expand Down
2 changes: 1 addition & 1 deletion utils/SnapPy/snapRunnerNpps
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def runsnap(npps, outdir):
release_dt.timestamp() + i
) # ensure a few secs difference for tags
nppdir[tag] = os.path.join(
res.getSnapOutputDir(),
res.getSnapOutputDirAutomated(),
"{0}_{1}".format(tag, strftime("%Y-%m-%dT%H%M%S", tag_time)),
)
runparams.append([npp_tag, release_dt, tag_time, nppdir[tag], res])
Expand Down

0 comments on commit 0a80c8f

Please sign in to comment.