Skip to content

Commit c256765

Browse files
committed
Fixes for 2tag
* config transfer needs to happen in new environment * ability to specify from_stage for async tag env
1 parent 6b464ad commit c256765

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

MC/bin/o2dpg_workflow_utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ def adjust_RECO_environment(workflowspec, package = ""):
274274
if len(package) == 0:
275275
return
276276

277+
# we try to extract the stage from the path (can be given via '@' separation)
278+
# example O2sim::daily-xxx@DIGI ---> apply this environment from the DIGI phase
279+
# example O2sim::daily-xxx@RECO ---> apply this environment from the RECO phase
280+
# example O2sim::daily-xxx ---> apply this environment from the RECO phase == default case
281+
from_stage = "RECO"
282+
if package.count('@') == 1:
283+
package, from_stage = package.split('@')
284+
277285
# We essentially need to go through the graph and apply the mapping
278286
# so take the workflow spec and see if the task itself or any child
279287
# is labeled RECO ---> typical graph traversal with caching
@@ -305,7 +313,7 @@ def matches_or_inherits_label(taskid, label, cache):
305313

306314
# fills the matches_label dictionary
307315
for taskid in range(len(workflowspec['stages'])):
308-
if (matches_or_inherits_label(taskid, "RECO", matches_label)):
316+
if (matches_or_inherits_label(taskid, from_stage, matches_label)):
309317
# now we do the final adjust (as annotation) in the workflow itself
310318
if workflowspec['stages'][taskid].get("alternative_alienv_package") == None:
311319
workflowspec['stages'][taskid]["alternative_alienv_package"] = package

MC/run/ANCHOR/anchorMC.sh

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ fi
187187
#<----- START OF part that should run under a clean alternative software environment if this was given ------
188188
if [ "${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG}" ]; then
189189
if [ "${LOADEDMODULES}" ]; then
190+
export > env_before_stashing.env
190191
echo "Stashing initial modules"
191192
module save initial_modules.list # we stash the current modules environment
192193
module list --no-pager
@@ -253,19 +254,6 @@ fi
253254
ALIEN_JDL_LPMPRODUCTIONTAG=$ALIEN_JDL_LPMPRODUCTIONTAG_KEEP
254255
echo_info "Setting back ALIEN_JDL_LPMPRODUCTIONTAG to $ALIEN_JDL_LPMPRODUCTIONTAG"
255256

256-
# now create the local MC config file --> config-json.json
257-
# we create the new config output with blacklist functionality
258-
ASYNC_CONFIG_BLACKLIST=${ASYNC_CONFIG_BLACKLIST:-${O2DPG_ROOT}/MC/run/ANCHOR/anchor-dpl-options-blacklist.json}
259-
${O2DPG_ROOT}/MC/bin/o2dpg_dpl_config_tools.py workflowconfig.log ${ASYNC_CONFIG_BLACKLIST} config-json.json
260-
ASYNC_WF_RC=${?}
261-
262-
# check if config reasonably created
263-
if [[ "${ASYNC_WF_RC}" != "0" || `grep "ConfigParams" config-json.json 2> /dev/null | wc -l` == "0" ]]; then
264-
echo_error "Problem in anchor config creation. Exiting."
265-
exit 1
266-
fi
267-
268-
269257
# get rid of the temporary software environment
270258
if [ "${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG}" ]; then
271259
module purge --no-pager
@@ -280,6 +268,18 @@ if [ "${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG}" ]; then
280268
fi
281269
#<----- END OF part that should run under a clean alternative software environment if this was given ------
282270

271+
# now create the local MC config file --> config-json.json
272+
# we create the new config output with blacklist functionality
273+
ASYNC_CONFIG_BLACKLIST=${ASYNC_CONFIG_BLACKLIST:-${O2DPG_ROOT}/MC/run/ANCHOR/anchor-dpl-options-blacklist.json}
274+
${O2DPG_ROOT}/MC/bin/o2dpg_dpl_config_tools.py workflowconfig.log ${ASYNC_CONFIG_BLACKLIST} config-json.json
275+
ASYNC_WF_RC=${?}
276+
277+
# check if config reasonably created
278+
if [[ "${ASYNC_WF_RC}" != "0" || `grep "ConfigParams" config-json.json 2> /dev/null | wc -l` == "0" ]]; then
279+
echo_error "Problem in anchor config creation. Exiting."
280+
exit 1
281+
fi
282+
283283
# -- CREATE THE MC JOB DESCRIPTION ANCHORED TO RUN --
284284

285285
MODULES="--skipModules ZDC"
@@ -300,7 +300,8 @@ remainingargs="${remainingargs} -productionTag ${ALIEN_JDL_LPMPRODUCTIONTAG:-ali
300300
remainingargs="${ALIEN_JDL_ANCHOR_SIM_OPTIONS} ${remainingargs} --anchor-config config-json.json"
301301
# apply software tagging choice
302302
# remainingargs="${remainingargs} ${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG:+--alternative-reco-software ${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG}}"
303-
remainingargs="${remainingargs} ${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG:+--alternative-reco-software ${PWD}/env_async.env}"
303+
ALIEN_JDL_O2DPG_ASYNC_RECO_FROMSTAGE=${ALIEN_JDL_O2DPG_ASYNC_RECO_FROMSTAGE:-RECO}
304+
remainingargs="${remainingargs} ${ALIEN_JDL_O2DPG_ASYNC_RECO_TAG:+--alternative-reco-software ${PWD}/env_async.env@${ALIEN_JDL_O2DPG_ASYNC_RECO_FROMSTAGE}}"
304305
# potentially add CCDB timemachine timestamp
305306
remainingargs="${remainingargs} ${ALIEN_JDL_CCDB_CONDITION_NOT_AFTER:+--condition-not-after ${ALIEN_JDL_CCDB_CONDITION_NOT_AFTER}}"
306307

0 commit comments

Comments
 (0)