Skip to content

Commit 1e523e5

Browse files
committed
Merge remote-tracking branch 'origin/dev' into pro
2 parents 8b124fc + 306be46 commit 1e523e5

File tree

28 files changed

+1834
-603
lines changed

28 files changed

+1834
-603
lines changed

boinc_software/cronjobs/cron.submit-sixtrack-simo3

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,10 @@ getlock(){
106106
}
107107

108108

109-
run_spool_megazip(){ # max_jobs_to_submit
109+
run_spool_megazip(){
110110

111111
megaZip=1
112112

113-
if [ -z "$1" -o "$1" = "0" ] ; then
114-
local max_jobs=""
115-
else
116-
local max_jobs="$1"
117-
local complete=0
118-
fi
119-
120113
find "$spooldirUpload" -mmin +5 -name "*.zip" | (
121114
while read workBatch ; do
122115
unzip -t $workBatch >/dev/null 2>&1
@@ -136,13 +129,6 @@ run_spool_megazip(){ # max_jobs_to_submit
136129
# process the desc files
137130
if submit_descfile "$descfile" ; then
138131
logstudy "Submitted $WUname"
139-
#stop after max_jobs (0=unlimited)
140-
if [ -n "$max_jobs" ] ; then
141-
complete=$(( $complete + 1 ))
142-
if [ $complete -ge $max_jobs ] ; then
143-
break 2
144-
fi
145-
fi
146132
else
147133
logstudy "Problem submitting $WUname"
148134
fi
@@ -155,39 +141,61 @@ run_spool_megazip(){ # max_jobs_to_submit
155141
)
156142
}
157143

158-
run_spool(){ # max_jobs_to_submit
144+
run_spool(){ # max_jobs_to_submit, max_jobs_perStudy, specific_study
159145

160146
megaZip=0
161147

162-
if [ -z "$1" -o "$1" = "0" ] ; then
163-
local max_jobs=""
148+
local max_jobs="$1"
149+
local complete=0
150+
local lMaxJobs=false
151+
[ -z "${max_jobs}" -o "${max_jobs}" = "0" ] || lMaxJobs=true
152+
153+
local max_jobs_perStudy="$2"
154+
local lMaxJobsPerStudy=false
155+
[ -z "${max_jobs_perStudy}" -o "${max_jobs_perStudy}" = "0" ] || lMaxJobsPerStudy=true
156+
157+
if [ -z "$3" ] ; then
158+
#find the work dirs 2 levels down
159+
local allWorkDirs=`find "$spooldir" -maxdepth 2 -type d -name "work"`
164160
else
165-
local max_jobs="$1"
166-
local complete=0
161+
#target a specific study
162+
local allWorkDirs=$spooldir/$3/work
167163
fi
168164

169-
#find the work dirs 2 levels down
170-
find "$spooldir" -maxdepth 2 -type d -name "work" | (
165+
# main loop
166+
echo "${allWorkDirs}" | (
171167
while read workdir ; do
172-
origPath=$workdir
173-
#check for desc files in the work dirs
174-
find "$workdir" -maxdepth 1 -type f -name '*.desc' | (
168+
local complete_perStudy=0
169+
#check for desc files in the current work dir, and subfolders
170+
find "$workdir" -maxdepth 2 -type f -name '*.desc' | (
175171
while read descfile ; do
176172
#process the desc files
173+
origPath=`dirname ${descfile}`
177174
if submit_descfile "$descfile" ; then
178175
logstudy "Submitted $WUname"
179176
#stop after max_jobs (0=unlimited)
180-
if [ -n "$max_jobs" ] ; then
177+
if ${lMaxJobs} ; then
181178
complete=$(( $complete + 1 ))
182179
if [ $complete -ge $max_jobs ] ; then
180+
log "reached ${max_jobs} in total"
183181
break 2
184182
fi
185183
fi
184+
if ${lMaxJobsPerStudy} ; then
185+
complete_perStudy=$(( ${complete_perStudy} + 1 ))
186+
if [ ${complete_perStudy} -ge ${max_jobs_perStudy} ] ; then
187+
# continue with next study
188+
log "reached ${max_jobs_perStudy} in ${workdir}"
189+
break 1
190+
fi
191+
fi
186192
else
187193
logstudy "Problem submitting $WUname"
188194
fi
189195
done
190-
)
196+
)
197+
# remove temp dirs in work
198+
find ${workdir} -mindepth 1 -maxdepth 1 -type d -empty -delete -print | log
191199
done
192200
)
193201
}
@@ -411,15 +419,19 @@ if [ -x /usr/bin/ionice ] ; then
411419
fi
412420

413421
maxjobs=0
422+
maxjobs_perStudy=0
414423
keepzip=0
424+
studyName=""
415425

416-
while getopts ":hn:k" OPT
426+
while getopts ":hn:m:d:k" OPT
417427
do
418428
#Debug
419429
#echo "OPT is $OPT. OPTIND is $OPTIND. OPTARG is $OPTARG."
420430
case "$OPT" in
421431
h) printhelp ; exit 0 ;;
432+
m) maxjobs_perStudy="$OPTARG" ;;
422433
n) maxjobs="$OPTARG" ;;
434+
d) studyName="$OPTARG" ;;
423435
k) keepzip=1 ;;
424436
:|?) error 'Invalid Argument(s)' ; printhelp; exit 0 ;;
425437
esac
@@ -433,10 +445,10 @@ cd $boincdir
433445

434446
getlock
435447
#Klog
436-
log run_spool $maxjobs
437-
run_spool $maxjobs
448+
log run_spool $maxjobs $maxjobs_perStudy $studyName
449+
run_spool $maxjobs $maxjobs_perStudy $studyName
438450

439-
log run_spool_megazip $maxjobs
440-
run_spool_megazip $maxjobs
451+
log run_spool_megazip
452+
run_spool_megazip
441453

442454
log FINISHING

boinc_software/cronjobs/crontab_jobs_boincai08_sixtadm.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# zip all WUs which were not given back to user
1616
# crontab every 3h
1717
# Puppet Name: assimilation zip
18-
30 */3 * * * cd /share/sixtrack/assimilation ; ./zip-trashed-WUs/zip-trashed-WUs.sh >> zip-trashed-WUs/zip-trashed-WUs.log 2>&1
18+
30 */3 * * * cd /share/sixtrack/assimilation ; /data/boinc/project/sixtrack/bin/zip-trashed-WUs.sh > /dev/null 2>&1
1919
# Antique file deleter:
2020
13 13 * * 3 cd /share/boinc/project/sixtrack ; ./bin/antique_file_deleter > /dev/null 2>&1
2121
# Delete spam:

boinc_software/cronjobs/crontab_jobs_lxplus_sixtadm.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
40 3 * * * lxplus.cern.ch cd /afs/cern.ch/work/b/boinc/boinctest ; /afs/cern.ch/user/s/sixtadm/boinc_soft/deleteStudies.sh >> /afs/cern.ch/user/s/sixtadm/boinc_soft/deleteStudies.log 2>&1
88
#
99
# list studies in spooldirs that could be deleted and notify users (based on dir itself):
10-
0 4 1 * * lxplus.cern.ch cd /afs/cern.ch/work/b/boinc/boinc ; /afs/cern.ch/user/s/sixtadm/boinc_soft/listDeleteStudies.sh studyName >> /afs/cern.ch/user/s/sixtadm/boinc_soft/deleteStudies.log 2>&1
11-
0 5 1 * * lxplus.cern.ch cd /afs/cern.ch/work/b/boinc/boinctest ; /afs/cern.ch/user/s/sixtadm/boinc_soft/listDeleteStudies.sh studyName >> /afs/cern.ch/user/s/sixtadm/boinc_soft/deleteStudies.log 2>&1
10+
0 4 1 * * lxplus.cern.ch cd /afs/cern.ch/work/b/boinc/boinc ; /afs/cern.ch/user/s/sixtadm/boinc_soft/listDeleteStudies.sh >> /afs/cern.ch/user/s/sixtadm/boinc_soft/deleteStudies.log 2>&1
11+
0 5 1 * * lxplus.cern.ch cd /afs/cern.ch/work/b/boinc/boinctest ; /afs/cern.ch/user/s/sixtadm/boinc_soft/listDeleteStudies.sh >> /afs/cern.ch/user/s/sixtadm/boinc_soft/deleteStudies.log 2>&1
1212
#
1313
# list studies in spooldirs that could be deleted and notify users (based on <workspace>_<study>/work dir):
1414
0 4 15 * * lxplus.cern.ch cd /afs/cern.ch/work/b/boinc/boinc ; /afs/cern.ch/user/s/sixtadm/boinc_soft/listDeleteStudies.sh >> /afs/cern.ch/user/s/sixtadm/boinc_soft/deleteStudies.log 2>&1

boinc_software/cronjobs/listDeleteStudies.sh

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# to be run in:
66
# /afs/cern.ch/work/b/boinc/boinc
77
oldN=30 # days
8+
threshOccupancy=0.5 # [GB]
89
BOINCspoolDir=$PWD
910
SCRIPTDIR=`dirname $0`
1011
SCRIPTDIR="`cd ${SCRIPTDIR} ; pwd`"
@@ -17,11 +18,11 @@ function treatSingleDir(){
1718
local __ownerFromFile="-"
1819
fi
1920
local __ownerFromUnix=`\ls -ld ${__tmpStudy} | awk '{print ($3)}'`
20-
echo "${__tmpStudy}" >> /tmp/delete_${__ownerFromUnix}_${now}.txt
21+
echo "${__tmpStudy}" >> /tmp/${LOGNAME}/delete_${__ownerFromUnix}_${now}.txt
2122
if [ "${__ownerFromFile}" == "-" ] ; then
22-
echo "${__tmpStudy}" >> /tmp/no_owner_${now}.txt
23+
echo "${__tmpStudy}" >> /tmp/${LOGNAME}/no_owner_${now}.txt
2324
elif [ "${__ownerFromFile}" != "${__ownerFromUnix}" ] ; then
24-
echo "${__tmpStudy}" >> /tmp/mismatched_owners_${now}.txt
25+
echo "${__tmpStudy}" >> /tmp/${LOGNAME}/mismatched_owners_${now}.txt
2526
fi
2627
echo "study ${__tmpStudy} belongs to ${__ownerFromFile}/${__ownerFromUnix} (owner file / unix)"
2728
}
@@ -36,6 +37,9 @@ fi
3637
# prepare delete dir
3738
[ -d delete ] || mkdir delete
3839

40+
# convert threshold in kB
41+
threshOccupancyKB=`echo ${threshOccupancy} | awk '{print ($1*1024**2)}'`
42+
3943
echo " checking BOINC spooldir ${BOINCspoolDir} ..."
4044

4145
# list spooldirs that can be labelled for deletion and
@@ -56,21 +60,26 @@ else
5660
done
5761
fi
5862

59-
allUsers=`ls -1 /tmp/delete_*txt | cut -d\_ -f2`
63+
allUsers=`ls -1 /tmp/${LOGNAME}/delete_*txt | cut -d\_ -f2`
6064
for tmpUserName in ${allUsers} ; do
61-
echo "sending notification to ${tmpUserName} ..."
6265
fileList=delete_${tmpUserName}_${now}.txt
63-
allStudies=`cat /tmp/${fileList}`
64-
echo -e "`cat ${SCRIPTDIR}/mail.txt`\n`\du -ch --summarize ${allStudies}`" | sed -e "s/<SixDeskUser>/${tmpUserName}/g" -e "s#<spooldir>#${BOINCspoolDir}#g" -e "s/<xxx>/${oldN}/g" -e "s#<fileList>#${fileList}#g" | mail -a /tmp/${fileList} -c [email protected] -s "old studies in BOINC spooldir ${BOINCspoolDir}" ${tmpUserName}@cern.ch
65-
rm /tmp/${fileList}
66+
allStudies=`cat /tmp/${LOGNAME}/${fileList}`
67+
# send notification email only if dimension is larger than
68+
tmpTotOccupancyKB=`\du -c --summarize ${allStudies} | tail -1 | awk '{print ($1)}'`
69+
if [ ${tmpTotOccupancyKB} -gt ${threshOccupancyKB} ] ; then
70+
tmpTotOccupancy=`echo ${tmpTotOccupancyKB} | awk '{print ($1/1024**2)}'`
71+
echo "sending notification to ${tmpUserName} ..."
72+
echo -e "`cat ${SCRIPTDIR}/mail.txt`\n`\du -ch --summarize ${allStudies}`" | sed -e "s/<SixDeskUser>/${tmpUserName}/g" -e "s#<spooldir>#${BOINCspoolDir}#g" -e "s/<xxx>/${oldN}/g" -e "s#<fileList>#${fileList}#g" -e "s/<diskSpace>/${tmpTotOccupancy}/g" | mail -a /tmp/${LOGNAME}/${fileList} -c [email protected] -s "old studies in BOINC spooldir ${BOINCspoolDir}" ${tmpUserName}@cern.ch
73+
fi
74+
rm /tmp/${LOGNAME}/${fileList}
6675
done
6776

6877
errorFiles=""
69-
[ ! -e /tmp/no_owner_${now}.txt ] || errorFiles="${errorFiles} /tmp/no_owner_${now}.txt"
70-
[ ! -e /tmp/mismatched_owners_${now}.txt ] || errorFiles="${errorFiles} /tmp/mismatched_owners_${now}.txt"
78+
[ ! -e /tmp/${LOGNAME}/no_owner_${now}.txt ] || errorFiles="${errorFiles} /tmp/${LOGNAME}/no_owner_${now}.txt"
79+
[ ! -e /tmp/${LOGNAME}/mismatched_owners_${now}.txt ] || errorFiles="${errorFiles} /tmp/${LOGNAME}/mismatched_owners_${now}.txt"
7180
if [ -n "${errorFiles}" ] ; then
7281
echo "sending error notification to amereghe ..."
73-
echo "errors!" | mail -a /tmp/no_owner_${now}.txt -s "old studies in BOINC spooldir ${BOINCspoolDir} - errors!" [email protected]
74-
rm -f /tmp/no_owner_${now}.txt
75-
rm -f /tmp/mismatched_owners_${now}.txt
82+
echo "errors!" | mail -a /tmp/${LOGNAME}/no_owner_${now}.txt -s "old studies in BOINC spooldir ${BOINCspoolDir} - errors!" [email protected]
83+
rm -f /tmp/${LOGNAME}/no_owner_${now}.txt
84+
rm -f /tmp/${LOGNAME}/mismatched_owners_${now}.txt
7685
fi

boinc_software/cronjobs/mail.txt

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ Dear SixDesk user <SixDeskUser>,
22

33
Please find in attachment a list of buffer directories in the BOINC spooldir
44
<spooldir>
5-
older than <xxx> days which belong to you. These directories have been
6-
used ONLY as BOINC buffers, i.e. to submit work units to BOINC and collect
5+
older than <xxx> days which belong to you. These directories are located
6+
on the work.boinc volume on AFS and have been used ONLY as buffers,
7+
i.e. to submit workunits (WUs) to BOINC and collect
78
results as they are produced by BOINC volunteers.
89

910
If you think that you will no longer need these directories (e.g. because
10-
the study is complete), then I could remove them, freeing disk space and
11-
improving the performance of the system. To do so, after you had a look at
12-
the list in attachment, please upload it to
11+
the study is complete), then I could remove them, freeing <diskSpace> GB of
12+
disk space and improving the performance of the system. To do so, after
13+
you had a look at the list in attachment, please upload it to
1314
<spooldir>/delete
1415
and I will take care of cleaning. To upload the list, you can use scp, i.e.:
1516
scp <fileList> <SixDeskUser>@lxplus.cern.ch:<spooldir>/delete
@@ -20,8 +21,15 @@ results), then please remove them from the list in the file, either heading
2021
a '#' char to the name of the directory or deleting the corresponding line
2122
in the file.
2223

23-
I remain at your disposal for any questions.
24+
Please bear in mind that keeping the work.boinc volume clean and light
25+
in space is extremely important, in order to ease submission of jobs
26+
of other people, and ultimately your future jobs. Moreover, please keep
27+
in mind that when you retrieve results with run_results, the downloaded
28+
results are not removed from this workspace but stored in the processed/
29+
subfolder, to keep results in case of problems with the jobs database.
30+
Hence, it is important to keep the work.boinc volume clean and light.
2431

32+
I remain at your disposal for any questions.
2533
Thanks for your cooperation,
2634
Alessio (via a crontab job)
2735

@@ -30,9 +38,13 @@ Once you upload the list, it may take up to 24h before deleting actually
3038
takes place.
3139

3240
NB: please be reminded that the TOTAL disk space available on the AFS
33-
volume work.boinc (where the BOINC spooldir is located) is 100GB.
34-
This value is a total one; hence, the occupancy by all users is summed up.
41+
volume work.boinc is 100GB. This value is a total one; hence, the occupancy
42+
by all users is summed up.
43+
44+
NB: the scp command may raise an error message about permissions. This
45+
is due to ssh and acl groups not fully talking to each other. In general,
46+
it not real. If you want to be sure, just log in to lxplus and
47+
check that the scp command went fine.
3548

3649
NB: Please find below the breakdown of the space taken by your directories in
3750
the quoted BOINC spooldir:
38-

0 commit comments

Comments
 (0)