Skip to content

Commit b4a073b

Browse files
committed
Allow arbitrary prodsplits in grid_submit
1 parent 5b7fb46 commit b4a073b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

GRID/utils/grid_submit.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,13 @@ export JOBLABEL
230230
export MATTERMOSTHOOK
231231
export CONTROLSERVER
232232

233-
[[ $PRODSPLIT -gt 100 ]] && echo "Production split needs to be smaller than 100 for the moment" && exit 1
233+
# Validate the production split level and derive the zero-padding width used for the
234+
# per-subjob OutputDir counter (#alien_counter_<W>i#) and for local fetching. The width
235+
# adapts to PRODSPLIT (minimum 3, so existing 3-digit layouts are unchanged), which lifts
236+
# the former hard cap of 100 while keeping OutputDir naming consistent at any scale.
237+
[[ ! $PRODSPLIT =~ ^[0-9]+$ || $PRODSPLIT -lt 1 ]] && echo "Production split must be a positive integer (got '${PRODSPLIT}')" && exit 1
238+
COUNTERWIDTH=${#PRODSPLIT}
239+
[[ $COUNTERWIDTH -lt 3 ]] && COUNTERWIDTH=3
234240

235241
# check for presence of jq (needed in code path to fetch output files)
236242
[[ "$FETCHOUTPUT" ]] && { which jq &> /dev/null || { echo "Could not find jq command. Please load or install" && exit 1; }; }
@@ -371,7 +377,7 @@ ${DATACOLLECTION:+InputDataListFormat = ${QUOT}txt-list${QUOT};}
371377
${DATACOLLECTION:+InputDataCollection = ${QUOT}LF:${MY_JOBWORKDIR}/collection.xml,nodownload${QUOT};}
372378
${PRODSPLIT:+Split = ${QUOT}${SPLITMODE}${QUOT};}
373379
${DATACOLLECTION:+SplitMaxInputFileNumber = 1;}
374-
OutputDir = "${MY_JOBWORKDIR}/${PRODSPLIT:+#alien_counter_03i#}";
380+
OutputDir = "${MY_JOBWORKDIR}/${PRODSPLIT:+#alien_counter_0${COUNTERWIDTH}i#}";
375381
Requirements = member(other.GridPartitions,"${GRIDPARTITION:-multicore_8}");
376382
CPUCores = "${CPUCORES}";
377383
MemorySize = "60GB";
@@ -504,7 +510,7 @@ EOF
504510
THIS_JOB=${SUBJOBIDS[jobindex]}
505511
echo "Fetching for job ${THIS_JOB}"
506512
if [ "${THIS_STATUS}" == "DONE" ]; then
507-
SPLITOUTDIR=$(printf "%03d" ${splitcounter})
513+
SPLITOUTDIR=$(printf "%0${COUNTERWIDTH}d" ${splitcounter})
508514
[ ! -f ${SPLITOUTDIR} ] && mkdir ${SPLITOUTDIR}
509515
echo "Fetching result files for subjob ${splitcounter} into ${PWD}"
510516
CPCMD="alien.py cp ${MY_JOBWORKDIR}/${SPLITOUTDIR}/* file:./${SPLITOUTDIR}"

0 commit comments

Comments
 (0)