Skip to content

Commit 42a6e24

Browse files
committed
Fix of an environment problem affecting 2stage processing
Under certain conditions, the environment for tasks running under an alternative (2nd-stage) software tag lacked variables from the global-init section. This affected for instance the CCDB caching and led to inconsistent MC workflows. This is now fixed with this commit. Thanks to @shahor02 for finding the issue.
1 parent f1a5935 commit 42a6e24

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

MC/bin/o2_dpg_workflow_runner.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,12 @@ def __init__(self, workflowfile, args, jmax=100):
10291029
self.do_early_file_removal = True
10301030
self.file_removal_candidates = filegraph_expand_timeframes(filegraph_data, self.timeframeset, self.full_target_namelist)
10311031

1032+
def apply_global_env(self, environ_dict):
1033+
for e in self.globalinit['env']:
1034+
if environ_dict.get(e, None) == None:
1035+
value = self.globalinit['env'][e]
1036+
actionlogger.info("Applying global environment from init section " + str(e) + " : " + str(value))
1037+
environ_dict[e] = str(value)
10321038

10331039
def perform_early_file_removal(self, taskids):
10341040
"""
@@ -1259,9 +1265,13 @@ def submit(self, tid, nice):
12591265
if self.workflowspec['stages'][tid].get('env')!=None:
12601266
taskenv.update(self.workflowspec['stages'][tid]['env'])
12611267

1262-
# envfilename = "taskenv_" + str(tid) + ".json"
1263-
# with open(envfilename, "w") as file:
1264-
# json.dump(taskenv, file, indent=2)
1268+
# add global workflow environment
1269+
self.apply_global_env(taskenv)
1270+
1271+
if os.environ.get('PIPELINE_RUNNER_DUMP_TASKENVS') != None:
1272+
envfilename = "taskenv_" + str(tid) + ".log"
1273+
with open(envfilename, "w") as file:
1274+
json.dump(taskenv, file, indent=2)
12651275

12661276
p = psutil.Popen(['/bin/bash','-c',c], cwd=workdir, env=taskenv)
12671277
try:

0 commit comments

Comments
 (0)