Skip to content
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

feat/add jobid to name of logfiles #1106

Draft
wants to merge 1 commit into
base: release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/esm_runscripts/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,13 @@ def initialize_experiment_logfile(config):
if "trace_sink" in dir(logger):
experiment_dir = config["general"]["experiment_dir"]
expid = config["general"]["expid"]
jobid = config["general"].get("jobid", None)
jobid = f"_{jobid}" if jobid else ""
it_coupled_model_name = config["general"]["iterative_coupled_model"]
datestamp = config["general"]["run_datestamp"]
logfile_path = (
f"{experiment_dir}/log/"
f"{expid}_{it_coupled_model_name}esm_runscripts_{datestamp}.log"
f"{expid}_{it_coupled_model_name}esm_runscripts_{datestamp}{jobid}.log"
)

logger.trace_sink.def_path(logfile_path)
Expand Down
5 changes: 5 additions & 0 deletions src/esm_runscripts/logfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ def finalize_logfiles(config, org_jobtype):

def set_logfile_name(config, jobtype=None):

jobid = config["general"].get("jobid", None)
jobid = f"_{jobid}" if jobid else ""

if not jobtype:
jobtype = config["general"]["jobtype"]


filejobtype = jobtype
# if "observe" in filejobtype:
# filejobtype = filejobtype.replace("observe_", "")
Expand All @@ -92,6 +96,7 @@ def set_logfile_name(config, jobtype=None):
+ filejobtype
+ "_"
+ config["general"]["run_datestamp"]
+ jobid
+ ".log"
)

Expand Down
6 changes: 5 additions & 1 deletion src/esm_runscripts/prepexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ def initialize_experiment_logfile(config):

experiment_dir = config["general"]["experiment_dir"]
expid = config["general"]["expid"]
jobtype = config["general"].get("jobtype", None)
jobtype = f"_{jobtype}" if jobtype else ""
jobid = config["general"].get("jobid", None)
jobid = f"_{jobid}" if jobid else ""
it_coupled_model = config["general"]["iterative_coupled_model"]
datestamp = config["general"]["run_datestamp"]

Expand All @@ -272,7 +276,7 @@ def initialize_experiment_logfile(config):
if "trace_sink" in dir(logger):
logfile_path = (
f"{experiment_dir}/log/"
f"{expid}_{it_coupled_model}esm_runscripts_{datestamp}.log"
f"{expid}_{it_coupled_model}esm_runscripts{jobtype}_{datestamp}{jobid}.log"
)

logger.trace_sink.def_path(logfile_path)
Expand Down
Loading