Skip to content

Commit 338d1be

Browse files
committed
grid_submit.sh: Basic support to split in InputFileCollections
1 parent 2fe012d commit 338d1be

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

GRID/utils/grid_submit.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ while [ $# -gt 0 ] ; do
208208
--cores) CPUCORES=$2; shift 2 ;; # allow to specify the CPU cores (check compatibility with partition !)
209209
--dry) DRYRUN="ON"; shift 1 ;; # do a try run and not actually interact with the GRID (just produce local jdl file)
210210
--o2tag) O2TAG=$2; shift 2 ;; #
211-
--packagespec) PACKAGESPEC=$2; shift 2 ;; # the alisw, cvmfs package list (command separated - example: '"VO_ALICE@FLUKA_VMC::4-1.1-vmc3-1","VO_ALICE@O2::daily-20230628-0200-1"')
211+
--packagespec) PACKAGESPEC=$2; shift 2 ;; # the alisw, cvmfs package list (command separated - example: '"VO_ALICE@FLUKA_VMC::4-1.1-vmc3-1","VO_ALICE@O2::daily-20230628-0200-1"')
212212
--asuser) ASUSER=$2; shift 2 ;; #
213213
--label) JOBLABEL=$2; shift 2 ;; # label identifying the production (e.g. as a production identifier)
214214
--mattermost) MATTERMOSTHOOK=$2; shift 2 ;; # if given, status and metric information about the job will be sent to this hook
@@ -218,7 +218,8 @@ while [ $# -gt 0 ] ; do
218218
--wait) WAITFORALIEN=ON; shift 1 ;; #wait for alien jobs to finish
219219
--wait-any) WAITFORALIENANY=ON; WAITFORALIEN=ON; shift 1 ;; #wait for any good==done alien jobs to return
220220
--outputspec) OUTPUTSPEC=$2; shift 2 ;; #provide comma separate list of JDL file specs to be put as part of JDL Output field (example '"*.log@disk=1","*.root@disk=2"')
221-
-h) Usage ; exit ;;
221+
--split-on-collection) DATACOLLECTION=$2; shift 2 ;; # this will split the jobs on InputDataCollection and "file" mode
222+
-h) Usage ; exit ;;
222223
--help) Usage ; exit ;;
223224
--fetch-output) FETCHOUTPUT=ON; shift 1 ;; # if to fetch all JOB output locally (to make this job as if it ran locally); only works when we block until all JOBS EXIT
224225
*) break ;;
@@ -355,13 +356,21 @@ if [[ "${IS_ALIEN_JOB_SUBMITTER}" ]]; then
355356
cd "${GRID_SUBMIT_WORKDIR}"
356357

357358
QUOT='"'
359+
SPLITMODE="production:1-${PRODSPLIT}"
360+
if [ "${DATACOLLECTION}" ]; then
361+
SPLITMODE="file"
362+
fi
358363
# ---- Generate JDL ----------------
359364
# TODO: Make this configurable or read from a preamble section in the jobfile
360365
cat > "${MY_JOBNAMEDATE}.jdl" <<EOF
361366
Executable = "${MY_BINDIR}/${MY_JOBNAMEDATE}.sh";
362367
Arguments = "${CONTINUE_WORKDIR:+"-c ${CONTINUE_WORKDIR}"} --local ${O2TAG:+--o2tag ${O2TAG}} --ttl ${JOBTTL} --label ${JOBLABEL:-label} --prodsplit ${PRODSPLIT} ${MATTERMOSTHOOK:+--mattermost ${MATTERMOSTHOOK}} ${CONTROLSERVER:+--controlserver ${CONTROLSERVER}}";
363368
InputFile = "LF:${MY_JOBWORKDIR}/alien_jobscript.sh";
364-
${PRODSPLIT:+Split = ${QUOT}production:1-${PRODSPLIT}${QUOT};}
369+
${DATACOLLECTION:+InputDataList = ${QUOT}input.list${QUOT};}
370+
${DATACOLLECTION:+InputDataListFormat = ${QUOT}txt-list${QUOT};}
371+
${DATACOLLECTION:+InputDataCollection = ${QUOT}LF:${MY_JOBWORKDIR}/collection.xml,nodownload${QUOT};}
372+
${PRODSPLIT:+Split = ${QUOT}${SPLITMODE}${QUOT};}
373+
${DATACOLLECTION:+SplitMaxInputFileNumber = 1;}
365374
OutputDir = "${MY_JOBWORKDIR}/${PRODSPLIT:+#alien_counter_03i#}";
366375
Requirements = member(other.GridPartitions,"${GRIDPARTITION:-multicore_8}");
367376
CPUCores = "${CPUCORES}";
@@ -382,6 +391,15 @@ EOF
382391
if [ ! "${DRYRUN}" ]; then
383392
command_file="alien_commands.txt"
384393

394+
if [ "$DATACOLLECTION" ]; then
395+
pok "Preparing data collection XML file"
396+
alien.py toXml $(cat ${DATACOLLECTION}) > collection.xml
397+
if [ "$?" != "0" ]; then
398+
per "Problem with data collection preparation"
399+
exit 1
400+
fi
401+
fi
402+
385403
pok "Preparing job \"$MY_JOBNAMEDATE\""
386404
(
387405
# assemble all GRID interaction in a single script / transaction
@@ -396,6 +414,9 @@ EOF
396414
echo "rm ${MY_BINDIR}/${MY_JOBNAMEDATE}.sh" >> ${command_file} # remove current job script
397415
echo "cp file:${PWD}/${MY_JOBNAMEDATE}.jdl alien://${MY_JOBWORKDIR}/${MY_JOBNAMEDATE}.jdl@DISK=1" >> ${command_file} # copy the jdl
398416
echo "cp file:${THIS_SCRIPT} alien://${MY_BINDIR}/${MY_JOBNAMEDATE}.sh@DISK=1" >> ${command_file} # copy current job script to AliEn
417+
if [ "${DATACOLLECTION}" ]; then
418+
echo "cp file:collection.xml alien://${MY_JOBWORKDIR}/collection.xml" >> ${command_file}
419+
fi
399420
[ ! "${CONTINUE_WORKDIR}" ] && echo "cp file:${MY_JOBSCRIPT} alien://${MY_JOBWORKDIR}/alien_jobscript.sh" >> ${command_file}
400421
) > alienlog.txt 2>&1
401422

0 commit comments

Comments
 (0)