Skip to content

Commit dbe4e0d

Browse files
sawenzelclaude
andcommitted
grid_submit.sh: allow setting the JDL Price
This adds a way to set the AliEn JDL Price (job priority) when submitting with grid_submit.sh. - A new preamble directive #JDL_PRICE=<number> and a new option --price <number>. - The option overrides the directive, as for the other preamble settings. - Without either, no Price line is written and AliEn uses its default. - The value must be a positive number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 712da77 commit dbe4e0d

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎GRID/utils/grid_submit.sh‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function per() { printf "\033[31m$1\033[m\n" >&2; }
2525
function pok() { printf "\033[32m$1\033[m\n" >&2; }
2626
function banner() { echo ; echo ==================== $1 ==================== ; }
2727

28-
function Usage() { echo "$0 --script scriptname | -c WORKDIR_RELATIVE_TO_TOP [ --jobname JOBNAME ] [ --topworkdir WORKDIR (ON TOP OF HOME) ] "; }
28+
function Usage() { echo "$0 --script scriptname | -c WORKDIR_RELATIVE_TO_TOP [ --jobname JOBNAME ] [ --topworkdir WORKDIR (ON TOP OF HOME) ] [ --price PRICE (JDL Price, i.e. job priority; overrides #JDL_PRICE) ] "; }
2929

3030
notify_mattermost() {
3131
set +x
@@ -219,6 +219,7 @@ while [ $# -gt 0 ] ; do
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"')
221221
--split-on-collection) DATACOLLECTION=$2; shift 2 ;; # this will split the jobs on InputDataCollection and "file" mode
222+
--price) PRICESPEC=$2; shift 2 ;; # JDL Price (job priority; higher starts sooner). Overrides a #JDL_PRICE= preamble. Not set means the AliEn default.
222223
--inputfile) INPUTFILES+=("$2"); shift 2 ;; # extra file to pre-stage via JDL InputFile (repeatable). Accepts a bare LFN or "LF:<lfn>". Staged by AliEn before the job starts, so it is NOT charged to job CPU/walltime (unlike an in-job 'alien.py cp').
223224
-h) Usage ; exit ;;
224225
--help) Usage ; exit ;;
@@ -325,6 +326,16 @@ if [[ "${IS_ALIEN_JOB_SUBMITTER}" ]]; then
325326
[[ ! ${IMAGESPEC} ]] && IMAGESPEC=$(grep "^#JDL_IMAGE=" ${SCRIPT} | sed 's/#JDL_IMAGE=//')
326327
echo "Found Container Image to be ${IMAGESPEC}"
327328

329+
# -) Price (job priority)
330+
[[ ! ${PRICESPEC} ]] && PRICESPEC=$(grep "^#JDL_PRICE=" ${SCRIPT} | sed 's/#JDL_PRICE=//')
331+
if [ "${PRICESPEC}" ]; then
332+
if [[ ! ${PRICESPEC} =~ ^[0-9]+([.][0-9]+)?$ ]] || ! awk -v p="${PRICESPEC}" 'BEGIN { exit !(p > 0) }'; then
333+
per "JDL Price must be a positive number (got '${PRICESPEC}')"
334+
exit 1
335+
fi
336+
echo "Found Price to be ${PRICESPEC}"
337+
fi
338+
328339
# -) Requirements-Spec
329340
REQUIRESPEC=$(grep "^#JDL_REQUIRE=" ${SCRIPT} | sed 's/#JDL_REQUIRE=//')
330341
if [ ! "${REQUIRESPEC}" ]; then
@@ -397,6 +408,7 @@ EOF
397408
[ $ERROROUTPUTSPEC ] && echo "OutputErrorE = {"${ERROROUTPUTSPEC}"};" >> "${MY_JOBNAMEDATE}.jdl" # add error output files
398409
[ $IMAGESPEC ] && echo "DebugTag = {\"${IMAGESPEC}\"};" >> "${MY_JOBNAMEDATE}.jdl" # use special singularity image to run job
399410
# echo "Requirements = {"${REQUIREMENTSSPEC}"} >> "${MY_JOBNAMEDATE}.jdl"
411+
[ "$PRICESPEC" ] && echo "Price = ${PRICESPEC};" >> "${MY_JOBNAMEDATE}.jdl" # job priority (AliEn default when absent)
400412
[ "$REQUIRESPEC" ] && echo "Requirements = ${REQUIRESPEC}" >> "${MY_JOBNAMEDATE}.jdl"
401413

402414
# "output_arch.zip:output/*@disk=2",

0 commit comments

Comments
 (0)