Skip to content

Commit 01833dc

Browse files
committed
Restore space in the var. expansion and add default ALIEN_PROC_ID
1 parent 4711e3a commit 01833dc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

DATA/production/common/setVarsFromALIEN_PROC_ID.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@
66
# let's get the last 9 (for int) and 8 (for int16) digits of ALIEN_PROC_ID, to be passed to define NUMAID and shm-segment-id via O2JOBID, which are int and int16 respectively. Then we make them an int or int16
77
ALIEN_PROC_ID_MAX_NDIGITS_INT32=9
88
ALIEN_PROC_ID_MAX_NDIGITS_INT16=8
9-
echo "ALIEN_PROC_ID for current job = ${ALIEN_PROC_ID}"
9+
if [[ -n $ALIEN_PROC_ID ]]; then
10+
echo "ALIEN_PROC_ID for current job = ${ALIEN_PROC_ID}"
11+
else
12+
ALIEN_PROC_ID=123456789
13+
echo "ALIEN_PROC_ID was not defined for current job, setting to ${ALIEN_PROC_ID}"
14+
fi
1015

1116
if [[ -n ${ALIEN_JDL_PACKAGES} ]] && [[ ${#ALIEN_PROC_ID} -lt ${ALIEN_PROC_ID_MAX_NDIGITS_INT32} ]]; then # we are on the grid, and we expect to have the PROC_ID
1217
echo "We cannot determine O2JOBID, the job id is too short (${ALIEN_PROC_ID}), we need at least ${ALIEN_PROC_ID_MAX_NDIGITS_INT32} digits, returning error"
1318
exit 2
1419
fi
1520

16-
ALIEN_PROC_ID_OFFSET_INT32=$((10#${ALIEN_PROC_ID:-${ALIEN_PROC_ID_MAX_NDIGITS_INT32}}))
21+
ALIEN_PROC_ID_OFFSET_INT32=$((10#${ALIEN_PROC_ID: -${ALIEN_PROC_ID_MAX_NDIGITS_INT32}}))
1722
echo "ALIEN_PROC_ID_OFFSET_INT32 = $ALIEN_PROC_ID_OFFSET_INT32"
1823

19-
ALIEN_PROC_ID_OFFSET_INT16=$((10#${ALIEN_PROC_ID:-${ALIEN_PROC_ID_MAX_NDIGITS_INT16}}))
24+
ALIEN_PROC_ID_OFFSET_INT16=$((10#${ALIEN_PROC_ID: -${ALIEN_PROC_ID_MAX_NDIGITS_INT16}}))
2025
echo "ALIEN_PROC_ID_OFFSET_INT16 = $ALIEN_PROC_ID_OFFSET_INT16"
2126

2227
# let's make them int32 or int16, but not with the max possible value (which would be 0x7fffffff and 0x7fff respectively)

0 commit comments

Comments
 (0)