@@ -8,27 +8,40 @@ if [ ! "${MY_JOBID}" ]; then
88 exit 1
99fi
1010
11+ # these are all subjobids
1112SUBJOBIDS=($( 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+
1317CurrDir=${PWD}
1418OutputDir=/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
2125for (( 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}
3245done
3346
3447echo " ... Going to automatic extraction of log files ... "
0 commit comments