Changeset 18855


Ignore:
Timestamp:
05/14/17 21:00:03 (8 years ago)
Author:
Daniela Dorner
Message:
updated to run on newdata
File:
1 edited

Legend:

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

    r18770 r18855  
    33
    44# remarks:
    5 # rsync-server still used
    65# move fileerror check to main-loop?
    76
     
    2019   datepath=$certaindate
    2120else
    22    datepath=`date --date="-19HOUR" +%Y/%m/%d`
     21   # this has to be coordinated with the time when
     22   #   ClearNewdata.sh is running
     23   datepath=`date --date="-18HOUR" +%Y/%m/%d`
    2324fi
    2425date=`echo $datepath | sed -e 's/\///g'`
    2526printprocesslog "INFO processing "$datepath
    2627
    27 auxpathnewdaq=/newdaq/aux/$datepath
    28 #auxpathnewdaq=/loc_data/aux/$datepath #to run on newdaq
    29 # create aux directory on daq, if not yet there
    3028auxpath=/loc_data/aux/$datepath
    3129makedir $auxpath >/dev/null
     
    3836makedir $calpath >/dev/null
    3937rawpathnewdaq=/newdaq/raw/$datepath
    40 #rawpathnewdaq=/loc_data/raw/$datepath #to run on newdaq
    4138rawpath=/loc_data/raw/$datepath
    4239
     
    4441#   drive file with information about current source position
    4542drivefile=$auxpath/${date}.DRIVE_CONTROL_SOURCE_POSITION.fits
    46 drivefilenewdaq=$auxpathnewdaq/${date}.DRIVE_CONTROL_SOURCE_POSITION.fits
    4743#   drive file with information tracking position
    4844drivefile2=$auxpath/${date}.DRIVE_CONTROL_TRACKING_POSITION.fits
    49 drivefilenewdaq2=$auxpathnewdaq/${date}.DRIVE_CONTROL_TRACKING_POSITION.fits
    5045#   file with magic weather information
    5146mweatherfile=$auxpath/${date}.MAGIC_WEATHER_DATA.fits
    52 mweatherfilenewdaq=$auxpathnewdaq/${date}.MAGIC_WEATHER_DATA.fits
    5347#   file with trigger rates
    5448ratesfile=$auxpath/${date}.FTM_CONTROL_TRIGGER_RATES.fits
    55 ratesfilenewdaq=$auxpathnewdaq/${date}.FTM_CONTROL_TRIGGER_RATES.fits
    5649#   file with trigger rates
    5750tempfile=$auxpath/${date}.FSC_CONTROL_TEMPERATURE.fits
    58 tempfilenewdaq=$auxpathnewdaq/${date}.FSC_CONTROL_TEMPERATURE.fits
    5951#   file with trigger rates
    6052humfile=$auxpath/${date}.FSC_CONTROL_HUMIDITY.fits
    61 humfilenewdaq=$auxpathnewdaq/${date}.FSC_CONTROL_HUMIDITY.fits
    6253
    6354function rsync_aux_file()
     
    6657   then
    6758      printprocesslog "INFO rsync "$1
    68       # rsync
    69       #   from newdaq (/newdaq = /fact on newdaq), rsync server newdaq::newdaq/
    70       #   to daq (/daq = /loc_data on daq)
    71       rsyncservernewdaq=`echo $1 | sed -e 's/^\//172.16.100.100::/'`
    72       # old
    73       if ! rsync -a -T $rsynctempdir $1 $2
    74       # new (workaround for problems on daq)
    75       #if ! rsync -a -T $rsynctempdir $rsyncservernewdaq $2
     59      if ! rsync -a -T $rsynctempdir newdaq:$1 $1
    7660      then
    7761         printprocesslog "WARN rsync of "$1" failed."
     
    8064}
    8165
    82 function check_daq()
     66function check_disks()
    8367{
    84    diskusage=( `df -P /raid10 | grep raid10 ` )
    85    # check if more than 700 GB are left on /loc_data
    86    if [ ${diskusage[3]} -lt $disklimitdaq ]
     68   # put here the check for /scratch (output of rsync) and /data1 (output of analysis)
     69   
     70   # at least 10% free disk on /scratch
     71   diskusage=( `df -P /scratch | grep scratch ` )
     72   if [ ${diskusage[3]} -lt $disklimitnewdata ]
    8773   then
    88       echo "WARN less than 700 left on /raid10 on node "$HOSTNAME
    89       printprocesslog "WARN less than 700 left on /raid10 on node "$HOSTNAME
    90       df -h /raid10
     74      echo "WARN less than 10% left on /scratch on node "$HOSTNAME
     75      printprocesslog "WARN less than 10% left on /scratch on node "$HOSTNAME
     76      df -h /scratch
    9177      finish
    9278   fi
     79   # at least 5% free disk on /data1
     80   diskusage=( `df -P /data1 | grep data1 ` )
     81   if [ ${diskusage[3]} -lt $disklimitnewdata2 ]
     82   then
     83      echo "WARN less than 5% left on /data1 on node "$HOSTNAME
     84      printprocesslog "WARN less than 5% left on /data1 on node "$HOSTNAME
     85      df -h /scratch
     86      finish
     87   fi
    9388}
    9489
    95 check_daq
    96 
     90check_disks
     91
     92# getting lists of files
    9793printprocesslog "INFO get lists of raw files on newdaq and daq"
    98 files=( `find $rawpathnewdaq -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort` )
    99 # to treat links use:
    100 #files=( `find -L $rawpathnewdaq -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort` )
    101 
     94files=( `ssh newdaq "find $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort "` )
    10295if [ ${#files[@]} -eq 0 ]
    10396then
     
    10598   finish
    10699fi
    107 fileslocal=( `find -L $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' 2>/dev/null| sort` )
    108 
    109 callistofiles=( `find $calpath -type f -name $date*-calibration.log 2>/dev/null| sort` )
     100fileslocal=( `find $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort` )
     101callistofiles=( `find $calpath -type f -name $date*-calibration.log 2>/dev/null | sort` )
     102
    110103# get number of dataruns from DB
    111104query="SELECT Count(*) FROM RunInfo WHERE fNight="$date" AND fRunTypeKey=1"
     
    124117makedir $rawpath >/dev/null
    125118
    126 #echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
    127 printprocesslog "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
     119#echo "INFO #files-local:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
     120printprocesslog "INFO #files-local:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
    128121
    129122while [ ${#fileslocal[@]} -ne ${#files[@]} ] || [ $numcalibrated -ne ${#callistofiles[@]} ] # || [ $numcalibrated -ne 0 ] # FIXME: Logik ueberdenken u ueberarb
     
    132125   #  when there is more than 10% space on daq
    133126   source `dirname $0`/../Sourcefile.sh
    134    check_daq
     127   check_disks
    135128   
    136129   numcalibrated=0
     
    138131   printprocesslog "INFO status beginning of while-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
    139132
    140    rsync_aux_file $drivefilenewdaq $drivefile
    141    rsync_aux_file $drivefilenewdaq2 $drivefile2
     133   rsync_aux_file $drivefile
     134   rsync_aux_file $drivefile2
    142135   
    143136   # files on newdaq
     
    145138   do
    146139      printprocesslog "processing "$file
    147       #echo "processing "$file
    148       localfile=`echo $file | sed -e 's/newdaq/loc_data/'`
     140      echo "processing "$file
     141      #localfile=`echo $file | sed -e 's/newdaq/scratch/'`
     142      localfile=$file
    149143
    150144      source `dirname $0`/../Sourcefile.sh
     
    158152         then
    159153            nondrs=`basename $file | sed -e 's/[.]drs//g'`
    160             nondrsfile=`find -L $rawpath -name $nondrs.*z`
     154            nondrsfile=`find -L $rawpath -name $nondrs.*z 2>/dev/null `
    161155            tstop=`$factpath/fitsdump -h $nondrsfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
    162156         else
     
    170164            # if a file is not closed and not touched for 30 minutes,
    171165            #    it is assumed corrupted and still transferred
    172             fileaccessed=`find $file -amin -30`
     166            fileaccessed=`find $file -amin -30 2>/dev/null `
    173167            if ! [ "$fileaccessed" == "" ]
    174168            then
     
    182176
    183177         # rsync
    184          #   from newdaq (/newdaq = /fact on newdaq), rsync server newdaq::newdaq/
    185          #   to daq (/daq = /loc_data on daq)
    186          # to access rsync server via the dedicated network between
    187          #    daq and newdaq, use 172.16.100.100::newdaq
    188          filersyncserver=`echo $file | sed -e 's/^\//172.16.100.100::/'`
    189          # old
    190          ##if ! rsync -av --stats --progress --bwlimit=$bwlimit $file $localfile
    191          if ! rsync -a -T $rsynctempdir --bwlimit=$bwlimit $file $localfile
    192          # new
    193          #if ! rsync -a -W -T $rsynctempdir --bwlimit=$bwlimit $filersyncserver $localfile
     178         if ! rsync -au -T $rsynctempdir --bwlimit=$bwlimit newdaq:$file $localfile
    194179         then
    195180            printprocesslog "ERROR something went wrong with rsync of "$file
     
    210195#      then
    211196#         nondrs=`basename $file | sed -e 's/[.]drs//g'`
    212 #         nondrsfile=`find -L $rawpath -name $nondrs.*z`
     197#         nondrsfile=`find -L $rawpath -name $nondrs.*z 2>/dev/null `
    213198#         tstop=`$factpath/fitsdump -h $nondrsfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
    214199#      else
     
    282267            if ! [ -e $callistolog ]
    283268            then
    284                rsync_aux_file $drivefilenewdaq $drivefile
    285                rsync_aux_file $drivefilenewdaq2 $drivefile2
    286                rsync_aux_file $mweatherfilenewdaq $mweatherfile
    287                rsync_aux_file $ratesfilenewdaq $ratesfile
    288                rsync_aux_file $tempfilenewdaq $tempfile
    289                rsync_aux_file $humfilenewdaq $humfile
     269               rsync_aux_file $drivefile
     270               rsync_aux_file $drivefile2
     271               rsync_aux_file $mweatherfile
     272               rsync_aux_file $ratesfile
     273               rsync_aux_file $tempfile
     274               rsync_aux_file $humfile
    290275               
    291276               calfile=$calpath"/"$date"_"$runnum"_C.root"
     
    366351   # get new file lists
    367352   printprocesslog "INFO get new file lists for "$datepath
    368    files=( `find $rawpathnewdaq -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' | sort` )
    369    fileslocal=( `find -L $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' | sort` )
    370    callistofiles=( `find $calpath -type f -name $date*-calibration.log | sort` )
     353   files=( `ssh newdaq "find $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort "` )
     354   fileslocal=( `find $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort` )
     355   callistofiles=( `find $calpath -type f -name $date*-calibration.log 2>/dev/null | sort` )
    371356   #echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
    372357   printprocesslog "INFO status after for-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
     
    379364      sleep 60
    380365      printprocesslog "INFO get new file lists for "$datepath
    381       files=( `find $rawpathnewdaq -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' | sort` )
    382       fileslocal=( `find -L $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' | sort` )
    383       callistofiles=( `find $calpath -type f -name $date*-calibration.log | sort` )
     366      files=( `ssh newdaq "find $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort "` )
     367      fileslocal=( `find $rawpath -type f -regex '.*20[0-9][0-9][01][0-9][0-3][0-9][_][0-9][0-9][0-9][.]d?r?s?[.]?fits[.]?[g]?[f]?[z]?' 2>/dev/null | sort` )
     368      callistofiles=( `find $calpath -type f -name $date*-calibration.log 2>/dev/null | sort` )
    384369   fi
    385370   #echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #runs:"$numcalibrated
     
    390375
    391376
    392 
     377finish
Note: See TracChangeset for help on using the changeset viewer.