Skip to content

Commit 6c6417b

Browse files
committed
Improvements in failure log processing
* ... in particular less connections to AliEn
1 parent 069ce40 commit 6c6417b

3 files changed

Lines changed: 41 additions & 18 deletions

File tree

GRID/utils/extractErroredLogFiles.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# We determine the O2DPG task that failed (as listed in stdout) and extract the relevant log automatically
22
# Beware that errors might occur outside of O2DPG tasks such as in preprocessing etc or not visible in logs
33

4+
alias mytar=tar
5+
if [[ $(uname) == "Darwin" ]]; then
6+
echo "Running on macOS. This needs gnu-tar"
7+
alias mytar=gtar
8+
fi
9+
10+
# show aliases
11+
alias
12+
413
errored_tasks=""
514
find ./ -name "stdout*" -exec grep -H "failed.*retry" {} ';' | sed 's/ failed.*//' | tr ":" " " | while IFS= read -r line; do
615
stdoutpath=$(echo "$line" | awk '{print $1}') # Extracting the first column
@@ -17,12 +26,12 @@ find ./ -name "stdout*" -exec grep -H "failed.*retry" {} ';' | sed 's/ failed.*/
1726
# extract the general log archive
1827
unzip -n log_archive.zip
1928
# extract specific task log from debug archive
20-
tar -xvzf debug_log_archive.tgz --wildcards "*${logfile}.log"
29+
mytar -xvzf debug_log_archive.tgz --wildcards "*${logfile}.log"
2130
if [[ ${logfile} == *"qedsim"* || ${logfile} == *"sgnsim"* || ${logfile} == *"bkgsim"* ]]; then
2231
# simulation has few more files to inspect
23-
tar -xvzf debug_log_archive.tgz --wildcards "*${tf}*serverlog*"
24-
tar -xvzf debug_log_archive.tgz --wildcards "*${tf}*workerlog*"
25-
tar -xvzf debug_log_archive.tgz --wildcards "*${tf}*mergerlog*"
32+
mytar -xvzf debug_log_archive.tgz --wildcards "*${tf}*serverlog*"
33+
mytar -xvzf debug_log_archive.tgz --wildcards "*${tf}*workerlog*"
34+
mytar -xvzf debug_log_archive.tgz --wildcards "*${tf}*mergerlog*"
2635
fi
2736
cd $OLDPWD
2837
done

GRID/utils/extractFailureMessage.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pattern="-e \"\<[Ee]xception\" \
2323
-e \"terminate called without an active\" \
2424
-e \"\]\[FATAL\]\" \
2525
-e \"\*\*\* Program crashed\" \
26+
-e \"\*\*\* Fatal Exception\" \
2627
-e \"\*\*\* Error in\"" # <--- LIBC fatal error messages
2728

2829
CMD="grep -m 1 -B2 -A10 ${pattern} $filetocheck"
@@ -32,4 +33,4 @@ if [ "$?" -eq 0 ]; then
3233
echo "==============================ERROR in ${filetocheck} =============================="
3334
echo ""
3435
echo "${T}"
35-
fi
36+
fi

GRID/utils/fetch_output_onfailure.sh

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,40 @@ if [ ! "${MY_JOBID}" ]; then
88
exit 1
99
fi
1010

11+
# these are all subjobids
1112
SUBJOBIDS=($(alien.py ps --trace ${MY_JOBID} | awk '/Subjob submitted/' | sed 's/.*submitted: //' | tr '\n' ' '))
1213

14+
# these are the one that failed
15+
FAILEDSUBJOBIDS=($(alien.py ps -a -m ${MY_JOBID} -f ERROR_ALL | awk '/EE/{print $2}' | tr '\n' ' '))
16+
1317
CurrDir=${PWD}
1418
OutputDir=/tmp/AlienLogs_${MY_JOBID}
1519

16-
#
17-
job_number=${#SUBJOBIDS[@]}
18-
19-
20-
# We fetch the error files locally
20+
job_number=${#FAILEDSUBJOBIDS[@]}
21+
echo "Found ${job_number} failed job ids"
22+
echo "Registering output for retrieval"
23+
RecycleBase=""
24+
# First pass to do register output
2125
for ((i = 0; i < job_number; i++)); do
22-
jobid=${SUBJOBIDS[i]}
23-
STATUS=$(alien.py ps -j ${jobid} | awk '//{print $4}')
24-
echo "Status of ${jobid} is $STATUS"
25-
if [ ${STATUS} == "EE" ]; then
26-
# nothing
26+
jobid=${FAILEDSUBJOBIDS[i]}
27+
if [ ! "${RecycleBase}" ]; then
2728
RecycleOutputDir=$(alien.py ps --trace ${jobid} | awk '/Going to uploadOutputFiles/' | sed 's/.*outputDir=//' | sed 's/)//')
28-
alien.py registerOutput ${jobid}
29-
echo "Recycle out is ${RecycleOutputDir}"
30-
alien.py cp ${RecycleOutputDir}/'*' file:${OutputDir}/${jobid}
29+
# /alice/cern.ch/user/a/aliprod/recycle/alien-job-2974093751
30+
RecycleBase=${RecycleOutputDir%-${jobid}} # Removes the ${jobid} and yields the recycle base path
3131
fi
32+
$(alien.py registerOutput ${jobid}) 2> /dev/null
33+
done
34+
35+
# wait a bit to allow propagation of "registerOutput"
36+
sleep 1
37+
38+
echo "Downloading output"
39+
# Second pass to copy files
40+
for ((i = 0; i < job_number; i++)); do
41+
jobid=${FAILEDSUBJOBIDS[i]}
42+
RecycleOutputDir="${RecycleBase}-${jobid}"
43+
alien.py cp ${RecycleOutputDir}/'*archive*' file:${OutputDir}/${jobid}
44+
[ -f ${OutputDir}/${jobid}/log_archive.zip ] && unzip -q -o ${OutputDir}/${jobid}/log_archive.zip -d ${OutputDir}/${jobid}
3245
done
3346

3447
echo " ... Going to automatic extraction of log files ... "

0 commit comments

Comments
 (0)