16 if [ ! -d $CrombieFullDir ]
19 mkdir -p $CrombieFullDir
23 if [ ! -d $CrombieTempDir ]
26 mkdir -p $CrombieTempDir
30 rm $CrombieTempDir/*.txt 2> /dev/null
32 if [
"$fresh" =
"fresh" ]
35 rm $CrombieTempDir/*.root 2> /dev/null
42 if [ -f $CrombieEosDir ]
44 CrombieEosDir=`cat $CrombieEosDir`
52 eosCMS=/afs/cern.ch/project/eos/installation/0.3.84-aquamarine/bin/eos.select
53 eosUSER=/afs/cern.ch/project/eos/installation/0.3.84-aquamarine.user/bin/eos.select
56 if [ ! -d $logDir -a
"$isEOS" =
"eos" ]
58 echo
"Making log output directory as $logDir" 65 RunOnList=$CrombieTempDir/RunOnList_`date +%y%m%d%H%M`.txt
66 if [
"$isEOS" =
"eos" ]
69 eosarr=(`echo $CrombieEosDir`)
70 for line
in ${eosarr[@]}
72 dirContent=(`$eosCommand ls $line`)
73 if [
"$dirContent" =
"" ]
75 trackEOS=$((trackEOS + 1))
76 if [ $((trackEOS % 2)) -eq 1 ]
79 echo
"eoshost=eosuser.cern.ch" >> $RunOnList
82 echo
"eoshost=eoscms.cern.ch" >> $RunOnList
84 dirContent=`$eosCommand ls $line`
85 if [
"$dirContent" =
"" ]
87 echo
"Can't find $line in either instance of EOS..." 88 echo
"Check configuration." 93 echo
"eosdir="$line >> $RunOnList
95 for dir
in ${dirContent[@]}
98 if [
"$CrombieDirList" !=
"" ]
101 for inList
in `cat $CrombieDirList`
103 if [
"$dir" =
"$inList" ]
109 if [ $foundInList -eq 0 ]
116 for check
in `cat $RunOnList`
118 if [
"$dir" =
"$check" ]
125 if [ $foundInRun -eq 0 ]
127 echo $dir >> $RunOnList
136 if [ -f $CrombieDatasets ]
139 cp $CrombieDatasets $RunOnList
142 if [ ! -d $CrombieRegDir ]
144 echo
"$CrombieRegDir does not seem to exist. Maybe needs mounting." 148 if [
"$CrombieDirList" =
"" ]
150 ls $CrombieRegDir > $RunOnList
152 cat $CrombieDirList > $RunOnList
165 eoshost=eoscms.cern.ch
166 if [
"$usingMultiEOS" -eq 1 ]
174 if [
"$fileInCount" -eq
"$CrombieFilesPerJob" ]
178 currentConfig=$CrombieTempDir/$CrombieFileBase\_$reasonableName\_$count.txt
186 for dir
in `cat $RunOnList`
189 if [
"${dir:0:1}" =
"#" ]
196 if [
"${dir%%=*}" =
"eoshost" ]
201 if [
"${eoshost%%.*}" =
"eoscms" ]
206 elif [
"${eoshost%%.*}" =
"eosuser" ]
213 echo
"Bad host found in config: $eoshost" 214 echo
"Please check that." 221 elif [
"${dir%%=*}" =
"eosdir" ]
229 fileInCount=$CrombieFilesPerJob
231 stripleading=
"${dir#/}" 232 reasonableName=
"${stripleading%%/*}" 233 reasonableName=
"${reasonableName%%+*}" 235 if [
"$reasonableName" !=
"$lastDir" ]
239 lastDir=$reasonableName
240 echo $CrombieFullDir/$CrombieFileBase\_$reasonableName.root $CrombieTempDir/$CrombieFileBase\_$reasonableName
"_[0-9]*.root" >> $haddFile
244 if [
"$isEOS" =
"eos" ]
247 for inFile
in `$eosCommand find $CrombieEosDir/$dir`
250 if [
"${inFile##*_}" =
"pilot.root" -o
"${inFile##*.}" !=
"root" ]
255 elif echo $inFile | grep
"/failed/" 258 echo
"Found a failed job. Resubmit that. I'm skipping for now." 265 echo root://$eoshost/$inFile >> $currentConfig
266 fileInCount=$((fileInCount + 1))
270 elif [ -f $CrombieDatasets ]
273 outputJSON=$CrombieTempDir/$reasonableName.json
275 if [ ! -f $outputJSON ]
278 wget --no-check-certificate -O $outputJSON
"https://cmsweb.cern.ch/phedex/datasvc/json/prod/data?dataset=$dir" 282 for inFile
in `jq
'.phedex.dbs|.[].dataset|.[].block|.[].file|.[].lfn' $outputJSON | sed
's/"//g' | sort | uniq`
287 echo root://$CrombieRedirector/$inFile >> $currentConfig
288 fileInCount=$((fileInCount + 1))
296 for inFile
in `find $CrombieRegDir/$dir -name
'*.root'`; do
298 if [
"${inFile##*_}" =
"pilot.root" ]; then
306 echo $inFile $CrombieTempDir/TerminalRunning/$CrombieFileBase\_$reasonableName\_$count\_$indexFiles.root >> $currentConfig
307 fileInCount=$((fileInCount + 1))
308 indexFiles=$((indexFiles + 1))
316 cp $RunOnList $CrombieFullDir/.