Skip to content

Commit

Permalink
Merge pull request #20 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Added variables with the initial wall clock time and job_id if available.
  • Loading branch information
seamm authored Jul 25, 2024
2 parents a8196a3 + 3795341 commit a4a8b70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion seamm_exec/computational_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _slurm():
if "NTASKS_PER_NODE" not in ce:
ce["NTASKS_PER_NODE"] = int(ce["NTASKS"]) // int(ce["NNODES"])

# Expand `[i-k]` naming in nodelist
# Expand `[i-k]` naming in nodelist, eg. SLURM_NODELIST=tc[053,059,183,200]
nodes = ce["NODELIST"].split(",")
nodelist = []
npernode = ce["NTASKS_PER_NODE"]
Expand Down
8 changes: 6 additions & 2 deletions seamm_exec/exec_flowchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, flowchart=None):

self.flowchart = flowchart

def run(self, root=None):
def run(self, root=None, job_id=None):
logger.info("In ExecFlowchart.run()")
if not self.flowchart:
raise RuntimeError("There is no flowchart to run!")
Expand All @@ -77,6 +77,10 @@ def run(self, root=None):
logger.info("Creating global variables space")
seamm.flowchart_variables = seamm.Variables()

# Put the current time as a variable
seamm.flowchart_variables.set_variable("_start_time", time.time())
seamm.flowchart_variables.set_variable("_job_id", job_id)

# And add the printer
seamm.flowchart_variables.set_variable("printer", printer)

Expand Down Expand Up @@ -657,7 +661,7 @@ def run(
logger.info("Executing the flowchart")
try:
exec = ExecFlowchart(flowchart)
exec.run(root=wdir)
exec.run(root=wdir, job_id=job_id)
data["state"] = "finished"
except Exception as e:
data["state"] = "error"
Expand Down

0 comments on commit a4a8b70

Please sign in to comment.