Skip to content

Commit 23d985d

Browse files
committed
Grid_submit: Provide prodsplit and subjob id to workload
provide environment variables ``` export ALIEN_O2DPG_GRIDSUBMIT_PRODSPLIT=${PRODSPLIT} export ALIEN_O2DPG_GRIDSUBMIT_SUBJOBID=${SUBJOBID} ``` which contain the total jobs submitted for the workload and the assigned subjod id. These numbers can be used by the workload to contextualize.
1 parent 6e14ba1 commit 23d985d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

GRID/utils/grid_submit.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ export JOBTTL
227227
export JOBLABEL
228228
export MATTERMOSTHOOK
229229
export CONTROLSERVER
230-
export PRODSPLIT
231230
[[ $PRODSPLIT -gt 100 ]] && echo "Production split needs to be smaller than 100 for the moment" && exit 1
232231

233232
# check for presence of jq (needed in code path to fetch output files)
@@ -346,7 +345,7 @@ if [[ "${IS_ALIEN_JOB_SUBMITTER}" ]]; then
346345
# TODO: Make this configurable or read from a preamble section in the jobfile
347346
cat > "${MY_JOBNAMEDATE}.jdl" <<EOF
348347
Executable = "${MY_BINDIR}/${MY_JOBNAMEDATE}.sh";
349-
Arguments = "${CONTINUE_WORKDIR:+"-c ${CONTINUE_WORKDIR}"} --local ${O2TAG:+--o2tag ${O2TAG}} --ttl ${JOBTTL} --label ${JOBLABEL:-label} ${MATTERMOSTHOOK:+--mattermost ${MATTERMOSTHOOK}} ${CONTROLSERVER:+--controlserver ${CONTROLSERVER}}";
348+
Arguments = "${CONTINUE_WORKDIR:+"-c ${CONTINUE_WORKDIR}"} --local ${O2TAG:+--o2tag ${O2TAG}} --ttl ${JOBTTL} --label ${JOBLABEL:-label} --prodsplit ${PRODSPLIT} ${MATTERMOSTHOOK:+--mattermost ${MATTERMOSTHOOK}} ${CONTROLSERVER:+--controlserver ${CONTROLSERVER}}";
350349
InputFile = "LF:${MY_JOBWORKDIR}/alien_jobscript.sh";
351350
${PRODSPLIT:+Split = ${QUOT}production:1-${PRODSPLIT}${QUOT};}
352351
OutputDir = "${MY_JOBWORKDIR}/${PRODSPLIT:+#alien_counter_03i#}";
@@ -536,6 +535,15 @@ if [ "${ONGRID}" = "1" ]; then
536535
ALIEN_JOB_OUTPUTDIR=$(grep "OutputDir" this_jdl.jdl | awk '//{print $3}' | sed 's/"//g' | sed 's/;//')
537536
ALIEN_DRIVER_SCRIPT=$0
538537

538+
# determine subjob id from the structure of the outputfolder
539+
# can use basename tool since this is like a path
540+
SUBJOBID=$(echo $(basename "${ALIEN_JOB_OUTPUTDIR}") | sed 's/^0*//') # Remove leading zeros if present
541+
542+
# we expose some information about prodsplit and subjob id to the jobs
543+
# so that they can adjust/contextualise the payload
544+
export ALIEN_O2DPG_GRIDSUBMIT_PRODSPLIT=${PRODSPLIT}
545+
export ALIEN_O2DPG_GRIDSUBMIT_SUBJOBID=${SUBJOBID}
546+
539547
#notify_mattermost "ALIEN JOB OUTDIR IS ${ALIEN_JOB_OUTPUTDIR}"
540548

541549
export ALIEN_JOB_OUTPUTDIR

0 commit comments

Comments
 (0)