Skip to content

Commit

Permalink
Merge pull request #19 from amereghe/master
Browse files Browse the repository at this point in the history
Creating 'pro' release of 4th May 2018
  • Loading branch information
amereghe authored May 4, 2018
2 parents 3c693d1 + 22c1d77 commit ca77111
Show file tree
Hide file tree
Showing 22 changed files with 116 additions and 121 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## Acrontab for Sixtrack
# crontab every 12h
## Crontab for Sixtrack - append to default BOINC cronjob
# Puppet Name: worksubmit sixtrack 2
7,17,27,37,47,57 * * * * boincai11.cern.ch /usr/local/boinc/project/sixtrack/bin/cron.submit-sixtracktest-simo3 -m 1000 > /dev/null 2>&1
# Puppet Name: worksubmit sixtrack
1,11,21,31,41,51 * * * * boincai11.cern.ch /usr/local/boinc/project/sixtrack/bin/cron.submit-sixtrack-simo3 -m 1000 > /dev/null 2>&1
# zip all WUs which were not given back to user
# crontab every 3h
30 */3 * * * boincai11.cern.ch cd /share/sixtrack/assimilation ; /usr/local/boinc/project/sixtrack/bin/zip-trashed-WUs.sh > /dev/null 2>&1
#
#
# acrontab jobs for keeping work.boinc volume clean and tidy
#
# remove old zip files from /afs/cern.ch/work/b/boinc/download
# m h dom mon dow command
0 3 * * * lxplus.cern.ch cd /afs/cern.ch/work/b/boinc/download ; ./clean.sh >> clean.log 2>&1
Expand Down
4 changes: 4 additions & 0 deletions boinc_software/cronjobs/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ for tmpDir in `find . -maxdepth 1 -type d -exec bash -c "echo -ne '{} '; ls '{}'
rm -rf ${tmpDir}
fi
done

#
echo "--> remove all empty dirs:"
find . -type d -empty -print -delete
77 changes: 41 additions & 36 deletions boinc_software/cronjobs/cron.submit-sixtrack-simo3
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ spooldirUpload=$spooldir/upload

# The relative path of the workunit template file from the config dir.
# this template will present Sixin.zip as the input file
WU_template=templates/sixtracktest_wu_template.xml
WU_template=templates/sixtrack_wu_template.xml

# The relative path of the result template file from the config dir.
# this template will bring back also the Sixout.zip results
result_template_SixOutZip=templates/sixtrack_zip_res_template.xml
result_template_SixOutZip=templates/sixtrack_res_template.xml

# default app name
applicationDef=sixtrack
Expand Down Expand Up @@ -163,41 +163,40 @@ run_spool(){ # max_jobs_to_submit, max_jobs_perStudy, specific_study
fi

# main loop
echo "${allWorkDirs}" | (
while read workdir ; do
local complete_perStudy=0
#check for desc files in the current work dir, and subfolders
find "$workdir" -maxdepth 2 -type f -name '*.desc' | (
while read descfile ; do
#process the desc files
origPath=`dirname ${descfile}`
if submit_descfile "$descfile" ; then
logstudy "Submitted $WUname"
#stop after max_jobs (0=unlimited)
if ${lMaxJobs} ; then
complete=$(( $complete + 1 ))
if [ $complete -ge $max_jobs ] ; then
log "reached ${max_jobs} in total"
break 2
fi
fi
if ${lMaxJobsPerStudy} ; then
complete_perStudy=$(( ${complete_perStudy} + 1 ))
if [ ${complete_perStudy} -ge ${max_jobs_perStudy} ] ; then
# continue with next study
log "reached ${max_jobs_perStudy} in ${workdir}"
break 1
fi
fi
else
logstudy "Problem submitting $WUname"
for workdir in ${allWorkDirs} ; do
! ${lMaxJobsPerStudy} || local __StudyComplete=0
#check for desc files in the current work dir, and subfolders
if ${lMaxJobsPerStudy} ; then
local allDescs=`find "$workdir" -maxdepth 2 -type f -name '*.desc' | head -n ${max_jobs_perStudy}`
else
local allDescs=`find "$workdir" -maxdepth 2 -type f -name '*.desc'`
fi
for descfile in ${allDescs} ; do
#process the desc files
origPath=`dirname ${descfile}`
! ${lMaxJobsPerStudy} || let __StudyComplete+=1
if submit_descfile "$descfile" ; then
logstudy "Submitted $WUname"
#stop after max_jobs (0=unlimited)
if ${lMaxJobs} ; then
complete=$(( $complete + 1 ))
if [ $complete -ge $max_jobs ] ; then
log "reached ${max_jobs} in total"
break 2
fi
done
)
# remove temp dirs in work
find ${workdir} -mindepth 1 -maxdepth 1 -type d -empty -delete -print | log
fi
else
logstudy "Problem submitting $WUname"
fi
done
)
if [ -n "${allDescs}" ] ; then
if ${lMaxJobsPerStudy} ; then
if [ ${__StudyComplete} -eq ${max_jobs_perStudy} ] ; then
log "limit to ${max_jobs_perStudy} reached for ${workdir}"
fi
fi
fi
done
}

submit_descfile(){
Expand Down Expand Up @@ -228,7 +227,7 @@ submit_descfile(){
fi

#overriding delay bound
WUdelayBound=$(cat $boincdir/suggested_deadline)
WUdelayBound="$WUdelayBoundDef"


#copyfiles
Expand Down Expand Up @@ -422,6 +421,7 @@ maxjobs=0
maxjobs_perStudy=0
keepzip=0
studyName=""
WUdelayBoundDef=574334 # [s]

while getopts ":hn:m:d:k" OPT
do
Expand All @@ -445,6 +445,11 @@ cd $boincdir

getlock
#Klog

# preliminary: remove temp dirs in work older than 1d
log find ${spooldir} -mindepth 3 -maxdepth 3 -mtime +1 -type d -empty -delete -print
find ${spooldir} -mindepth 3 -maxdepth 3 -mtime +1 -type d -empty -delete -print | log

log run_spool $maxjobs $maxjobs_perStudy $studyName
run_spool $maxjobs $maxjobs_perStudy $studyName

Expand Down
23 changes: 0 additions & 23 deletions boinc_software/cronjobs/crontab_jobs_boincai08_sixtadm.txt

This file was deleted.

55 changes: 24 additions & 31 deletions boinc_software/cronjobs/zip-trashed-WUs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ allDir=all
zipToolDir=`basename $0`
zipToolDir=${zipToolDir//.sh}
initDir=$PWD
tmpDirBase=/tmp/`basename $0`
tmpDirBase=/tmp/sixtadm/`basename $0`
lTest=false

boincdir=/data/boinc/project/sixtrack
Expand Down Expand Up @@ -47,11 +47,11 @@ function logtofile(){ #[opt-file] log_message
function getlock(){
if ln -s PID:$$ $lockfile >/dev/null 2>&1 ; then
if ${lTest} ; then
trap " rm $lockfile; log \" Relase lock $lockfile\"" EXIT
trap "rm $lockfile; log \" Relase lock $lockfile\"" EXIT
else
trap " log \" cleaning ${tmpDirBase} away...\" ; rm -rf ${tmpDirBase} ; rm $lockfile; log \" Relase lock $lockfile\"" EXIT
trap "log \" cleaning ${tmpDirBase} away...\" ; rm -rf ${tmpDirBase} ; rm $lockfile; log \" Relase lock $lockfile\"" EXIT
fi
log " got lock $lockfile"
log "got lock $lockfile"
else
log "$lockfile already exists. $PWD/$0 already running? Abort..."
#never get here
Expand All @@ -64,28 +64,19 @@ function treatStudy(){
# - tmpDirBase

local __studyName=$1
local __lAll=$2

# fileName of .zip
local __zipFileName=${__studyName}__`date "+%Y-%m-%d_%H-%M-%S"`
# tmpDir
local __tmpDir=${tmpDirBase}/${__zipFileName}
mkdir -p ${__tmpDir}
log " ...zipping performed in tmp dir ${__tmpDir} ..."
log "...zipping performed in tmp dir ${__tmpDir} ..."
# actual fileName of .zip
__zipFileName=${__zipFileName}.zip
# zip
zipAll ${__zipFileName} ${__tmpDir}
# move
mvZip ${__tmpDir}/${__zipFileName} ${__studyName}

if ! ${__lAll} ; then
# moving old .zip files
log " old .zip files ..."
for __fileName in `find . -name "*.zip"` ; do
mvZip ${__fileName} ${__studyName}
done
fi
}

function mvZip(){
Expand Down Expand Up @@ -178,7 +169,7 @@ function actualZip(){
# ==============================================================================

log ""
log " starting `basename $0` at `date` ..."
log "starting `basename $0` at `date` ..."

# adding lock mechanism
getlock
Expand All @@ -193,7 +184,6 @@ Nzipped=0
# ==============================================================================

cd ${allDir}
lAll=true

# get WUs (grep -v is redundant, but it is kept for security)
WUs2bZipped=`find . -mmin +5 -name "*__*" | grep -v '.zip'`
Expand All @@ -202,42 +192,36 @@ if [ -n "${WUs2bZipped}" ] ; then
# get study names and simple statistics
studyNameStats=`echo "${WUs2bZipped}" | awk 'BEGIN{FS="__"}{print ($1)}' | sort | uniq -c`

log " ... ${allDir} - studies involved:"
log " # N_WUs, wSpace_studyName"
log "... ${allDir} - studies involved:"
log "# N_WUs, wSpace_studyName"
log "${studyNameStats}"

# actually zip and move to boincDownloadDir
for studyName in `echo "${studyNameStats}" | awk '{print ($2)}'` ; do
WUnames=`echo "${WUs2bZipped}" | grep ${studyName}`
treatStudy ${studyName} ${lAll}
treatStudy ${studyName}
done

# moving old or remaining .zip files
log " old .zip files ..."
for fileName in `find . -name "*.zip"` ; do
mvZip ${fileName} ${fileName%%__*}
done
else
log " ...only super-recent WUs in ${allDir}! - skipping..."
log "...only super-recent WUs in ${allDir}! - skipping..."
fi

cd ${initDir}
lAll=false

# ==============================================================================
# treat studies
# ==============================================================================

for studyName in `ls -1d * | grep -v -e "^${allDir}$" -e "^${zipToolDir}$"` ; do
log " ...study ${studyName}"
log "...study ${studyName}"
cd ${studyName}

# get ready for zipping and moving
WUnames=`find . -mmin +5 -name "*__*" | grep -v '.zip'`
if [ -n "${WUnames}" ] ; then
treatStudy ${studyName} ${lAll}
treatStudy ${studyName}
else
log " ...only super-recent WUs in ${studyName}! - skipping..."
log "...only super-recent WUs in ${studyName}! - skipping..."
fi

# get ready for next study
Expand All @@ -248,13 +232,22 @@ done
# close processing
# ==============================================================================

# moving old or remaining .zip files
log "old .zip files ..."
for fileName in `find . -name "*.zip"` ; do
studyName=`basename ${fileName}`
studyName=${studyName%%__*}
log "--> mvZip ${fileName} ${studyName}"
mvZip ${fileName} ${studyName}
done

# rm empty dirs
# NB: all might be empty - it is not actually, thanks to: all/.doNotRemoveMe
log " finding and removing empty dirs..."
log "finding and removing empty dirs..."
find . -maxdepth 1 -type d -empty -delete -print | log

ENDTIME=$(date +%s)

# done
TIMEDELTA=$(($ENDTIME - $STARTTIME))
log " ...done by `date` - it took ${TIMEDELTA} seconds - zipped ${Nzipped} WUs."
log "...done by `date` - it took ${TIMEDELTA} seconds - zipped ${Nzipped} WUs."
5 changes: 3 additions & 2 deletions boinc_software/maintain_AFS_spooldir/showSpoolDirState.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

echo "# study, number of waiting jobs, number of problematic files, disk occupancy: work,results"
echo "# study, number of waiting jobs, number of waiting jobs (subFolders), number of problematic files, disk occupancy: work,results"
for tmpWorkDir in `find . -maxdepth 2 -type d -name "work"` ; do
nFiles=`ls -1 ${tmpWorkDir}/*.desc 2> /dev/null | wc -l`
nFilesSub=`ls -1 ${tmpWorkDir}/*/*.desc 2> /dev/null | wc -l`
nFilesProbl=`ls -1 ${tmpWorkDir}/*.desc.problem 2> /dev/null | wc -l`
diskOccupancyWork=`\du -csh ${tmpWorkDir}/ | tail -1 | awk '{print ($(NF-1))}'`
diskOccupancyResult=`\du -csh ${tmpWorkDir}/../results | tail -1 | awk '{print ($(NF-1))}'`
[ ${nFiles} -eq 0 -a ${nFilesProbl} -eq 0 ] || echo ${tmpWorkDir} ${nFiles} - ${nFilesProbl} - ${diskOccupancyWork} ${diskOccupancyResult}
[ ${nFiles} -eq 0 -a ${nFilesProbl} -eq 0 -a ${nFilesSub} -eq 0 ] || echo ${tmpWorkDir} ${nFiles} ${nFilesSub} - ${nFilesProbl} - ${diskOccupancyWork} ${diskOccupancyResult}
done
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
period='2018-02'
period='2018-03'
iFileName='server_status_'.period

# changes in status page:
Expand Down
Loading

0 comments on commit ca77111

Please sign in to comment.