Ignore:
Timestamp:
04/19/13 20:50:40 (12 years ago)
Author:
Daniela Dorner
Message:
added limitation for number of callisto jobs, added check on number of events to allow for automic reconnect in Main.js, make sure that all callistos are processed, removed variable $rerun, removed not needed lines
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/QuickLook/Step1.sh

    r15305 r15381  
    44printprocesslog "INFO starting $0"
    55
    6 #root=/opt/root_svn/bin/thisroot.sh
    7 #source $root
    8 #factpath=/home/fact/FACT++.in-run-fad-loss
    9 
    10 #anapath=/loc_data/analysis
    11 
    12 #rerun="yes"
    13 #rerun="no"
    14 # not needed anymore as the variable is set automatically
    15 #   depending on whether the rawfile existed locally,
    16 #   i.e. depending on whether the rsync in needed
    17 # still needed in case all rawfiles have been rsynced already
    18 
    196# get date (before 18h there is no new data to be processed)
    207datepath=`date --date="-18HOUR" +%Y/%m/%d`
    21 #datepath="2013/03/24"
     8date=`date --date="-18HOUR" +%Y%m%d`
     9#datepath="2013/04/17"
     10#date="20130417"
    2211printprocesslog "INFO processing "$datepath
    2312night=`echo $datepath | sed -e 's/\///g'`
     
    7160
    7261printprocesslog "INFO get lists of raw files on newdaq and daq"
    73 #files=( `ssh newdaq "find $rawpath -type f 2>/dev/null | sort"` )
    74 #files=( `ssh 172.16.100.100 "find $rawpath -type f 2>/dev/null | sort"` )
    7562files=( `find $rawpathnewdaq -type f 2>/dev/null | sort` )
    7663if [ ${#files[@]} -eq 0 ]
     
    8067fi
    8168fileslocal=( `find $rawpath -type f | sort` )
     69callistofiles=( `find $anapath -type f -name $date*-calibration.log | sort` )
     70numdataruns=0
    8271
    8372# create raw directory on daq, if not yet there
    8473makedir $rawpath
    8574
    86 
    87 while [ ${#fileslocal[@]} -lt ${#files[@]} ] || [ "$rerun" = "yes" ]
     75echo ${#fileslocal[@]}" "${#files[@]}" "${#callistofiles[@]}
     76
     77while [ ${#fileslocal[@]} -ne ${#files[@]} ] || [ $numdataruns -ne ${#callistofiles[@]} ]
    8878do
    89    ##if ssh newdaq "ls $drivefile"
    90    #if ls $drivefilenewdaq
    91    #then
    92    #   printprocesslog "INFO rsync "$drivefilenewdaq
    93    #   #if ! rsync -av --progress newdaq:$drivefile $drivefile
    94    #   #if ! rsync -av --progress 172.16.100.100:$drivefile $drivefile
    95    #   if ! rsync -av --stats $drivefilenewdaq $drivefile
    96    #   then
    97    #      printprocesslog "WARN rsync of "$drivefilenewdaq" failed."
    98    #   fi
    99    #fi
     79   numdataruns=0
    10080   rsync_aux_file $drivefilenewdaq $drivefile
    10181   
     
    11090      then
    11191         nondrsfile=`echo $file | sed -e 's/[.]drs//g'`
    112          #tstop=`ssh newdaq "source $root ; $factpath/fitsdump -h $nondrsfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'"`
    113          #tstop=`ssh 172.16.100.100 "source $root ; $factpath/fitsdump -h $nondrsfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'"`
    11492         tstop=`$factpath/fitsdump -h $nondrsfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
    11593      else
    116          #tstop=`ssh newdaq "source $root ; $factpath/fitsdump -h $file  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'"`
    117          #tstop=`ssh 172.16.100.100 "source $root ; $factpath/fitsdump -h $file  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'"`
    11894         tstop=`$factpath/fitsdump -h $file  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
    11995      fi
     
    12197      then
    12298         printprocesslog "WARN "$file" not yet closed."
    123          #fileaccessed=`ssh newdaq "find $file -amin -30"`
    124          #fileaccessed=`ssh 172.16.100.100 "find $file -amin -30"`
    12599         fileaccessed=`find $file -amin -30`
    126          #echo "fileaccessed: "$fileaccessed
    127100         if ! [ "$fileaccessed" == "" ]
    128101         then
     
    135108      fi
    136109
     110      source `dirname $0`/../Sourcefile.sh
    137111      if ! ls $localfile >/dev/null 2>&1
    138112      then
    139          #if ! rsync -av --progress newdaq:$file $file
    140          #if ! rsync -av --progress 172.16.100.100:$file $file
    141          if ! rsync -av --stats $file $localfile
     113         if ! rsync -av --stats --progress --bwlimit=$bwlimit $file $localfile
    142114         then
    143115            printprocesslog "ERROR something went wrong with rsync of "$file
     
    146118         fi
    147119         printprocesslog "INFO "$file" rsynced successfully."
    148          rerun="no"
    149       else
    150          rerun="yes"
    151120      fi
    152121
     
    157126         runnum=`echo $localfile | cut -d_ -f3 | cut -d. -f1`
    158127         roi=`$factpath/fitsdump -h $localfile  2>/dev/null | grep ROI | grep -v ROITM | grep -E -o "[0-9][0-9][0-9][0-9]?" | sed -e "s/'//g" -e "s/_/-/g" -e "s/[.]//g"`
    159          printprocesslog "DEBUG runnum "$runnum" runtype "$runtype" roi "$roi
     128         numevts=`$factpath/fitsdump -h $file  2>/dev/null | grep Events | grep -E -o '[0-9]+'`
     129         printprocesslog "DEBUG runnum "$runnum" runtype "$runtype" roi "$roi" numevts "$numevts
    160130         if [ "$runtype" == "drs-time-upshifted" ]
    161131         then
     132            printprocesslog "INFO file "$file" has runtype drs-time-upshifted -> continue "
    162133            continue
    163134         fi
    164135         if [ "$runtype" == "data" ]
    165136         then
     137            numdataruns=`echo " $numdataruns + 1 " | bc -l`
    166138            if [ "$fileerror" = "yes" ]
    167139            then
     
    210182            then
    211183               printprocesslog "WARN sourcekey empty - coordinates"${coordinates[@]}
     184            fi
     185            callistocount=`ps aux | grep RunCallisto | grep -E -o '20[12][0-9][01][0-9][0-3][0-9]_[0-9][0-9][0-9]' | sort | uniq | wc -l`
     186           
     187            echo "cal: "$callistocount" numdat: "$numdataruns" numcallog: "${#callistofiles[@]}
     188            # do not overload system in case of a lot of files to be processed
     189            #  callistocount is set in setup.fact.lp.data
     190            if [ $callistocount -ge $numcallistos ]
     191            then
     192               printprocesslog "INFO "$callistocount" RunCallisto.sh are running -> continue"
     193               echo "INFO "$callistocount" RunCallisto.sh are running -> continue"
     194               continue
    212195            fi
    213196            callistolog=`dirname $seqfile | sed -e "s/sequences/${sourcekey}\/callisto/"`"/"$night"_"$runnum"-calibration.log"
     
    222205               echo "INFO starting RunCallisto.sh for "$sourcekey" "$seqfile
    223206               `dirname $0`/RunCallisto.sh $sourcekey $seqfile &
    224                # do not overload system in case of a lot of files to be processed
    225                if [ "$rerun" = "yes" ]
    226                then
    227                   sleep 600
    228                   printprocesslog "INFO rerun=yes -> sleep 600..."
    229                fi
    230             fi
    231             continue
     207            fi
     208            continue
     209         else
     210            # skip a non-data run when it has not 1000 evts
     211            #   as this means probably an fad-loss
     212            if [ $numevts -ne 1000 ]
     213            then
     214               printprocesslog "INFO file "$file" is a non-data file ("$runtype") and has not 1000 events ("$nmevts")"
     215               continue
     216            fi
    232217         fi
    233218         printprocesslog "DEBUG runrow "$runrow" (from variable) "
     
    271256      fi
    272257   done
     258   printprocesslog "INFO status after loop: "$callistocount" callistos running, "$numdataruns" data runs to process in total, "${#callistofiles[@]}" have already a callisto-logfile "
    273259   
    274260   # get new file lists
    275261   printprocesslog "INFO get new file lists for "$datepath
    276    #files=( `ssh newdaq "find $rawpath -type f | sort"` )
    277    #files=( `ssh 172.16.100.100 "find $rawpath -type f | sort"` )
    278262   files=( `find $rawpathnewdaq -type f | sort` )
    279263   fileslocal=( `find $rawpath -type f | sort` )
     264   callistofiles=( `find $anapath -type f -name $date*-calibration.log | sort` )
    280265   
    281 #   update=
    282 #   if [ ${#fileslocal[@]} -eq ${#files[@]} ]
    283 #   then
    284 #      sleep 60
    285 #      echo "sleep 60..."
    286 #      #files=( `ssh newdaq "find $rawpath -type f | sort"` )
    287 #      files=( `ssh 172.16.100.100 "find $rawpath -type f | sort"` )
    288 #      fileslocal=( `find $rawpath -type f | sort` )
    289 #   fi
     266   update=
     267   if [ ${#fileslocal[@]} -eq ${#files[@]} ]
     268   then
     269      sleep 60
     270      echo "sleep 60..."
     271      files=( `find $rawpathnewdaq -type f | sort` )
     272      fileslocal=( `find $rawpath -type f | sort` )
     273      callistofiles=( `find $anapath -type f -name $date*-calibration.log | sort` )
     274   fi
    290275done
    291276
Note: See TracChangeset for help on using the changeset viewer.