Changeset 18767


Ignore:
Timestamp:
02/20/17 13:29:11 (8 years ago)
Author:
Daniela Dorner
Message:
added function to check file availability with proper severity in logging; added special start time for jobs submitted to queue
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Sourcefile.sh

    r18763 r18767  
    385385      start)   printprocesslog "DEBUG setstatus start"
    386386               starttime="Now()"
     387               ;;
     388      startj)  printprocesslog "DEBUG setstatus startj"
     389               starttime="'1971-01-01 01:01:01'" # special recognizable datetime, i.e. "reserved by JobManager for processing"
    387390               ;;
    388391       stop)   case $check in
     
    460463   if [ "$1" = "start" ]
    461464   then
    462       query=$query" AND ISNULL("$step"Status.fStartTime) "
     465      # process job only if it is not yet being processed
     466      #  i.e. either StartTime NULL or '1971-01-01 01:01:01' (reserved by JobManager for processing)
     467      query=$query" AND (ISNULL("$step"Status.fStartTime) OR "$step"Status.fStartTime='1971-01-01 01:01:01')"
    463468   fi
    464469   # add row count to know how many rows have been changed
     
    564569}
    565570
     571# missing: implement usage of this function in Fill*.sh
     572function check_file_avail()
     573{
     574   if [ "$1" = "" ]
     575   then
     576      echo "Please give file name as first argument."
     577      finish
     578   fi
     579   if [ "$transferdelay" = "" ]
     580   then
     581      # setup where immediate report of problem is needed, i.e. mainly LP
     582      checknight=`date +%Y%m%d --date="-19HOUR"`
     583   else
     584      # any setup where transfer might cause a delay in arrival of files
     585      checknight=`date +%Y%m%d  --date="-${transferdelay}day"`
     586   fi
     587   
     588   printprocesslog "INFO checking availability of "$1
     589   if ! [ -e $1 ]
     590   then
     591      # treat raw files differently than auxfiles
     592      checkraw=`echo $1 | grep -E -o raw`
     593      if [ "$checkraw" = "raw" ]
     594      then
     595         if [ $filenight -le $checknight ]
     596         then
     597            printprocesslog "WARN "$1" not found."
     598         else
     599            printprocesslog "INFO "$1" not found."
     600         fi
     601         return 1
     602      fi
     603      # only for aux files check of DB is needed
     604      filenight=`basename $1 | cut -c 1-8`
     605      query="SELECT COUNT(*) FROM RunInfo WHERE fNight="$filenight" AND fRunTypeKey=1"
     606      numdatruns=`sendquery`
     607      # for some files it is more severe when they are missing
     608      checkfile=`echo $1 | grep -E -o 'DRIVE'\|'RATES'`
     609      # print INFO/WARN/ERROR depending on severity
     610      if [ $numdatruns -eq 0 ]
     611      then
     612         # in case no data runs are available from this night, it's not a problem if files are missing
     613         printprocesslog "INFO "$1" not found."
     614      else
     615         if [ "$checkfile" != "" ]
     616         then
     617            # drive and trigger-rates files are needed for analysis
     618            #printprocesslog "ERROR "$1" not found."
     619            if [ $filenight -le $checknight ]
     620            then
     621               printprocesslog "ERROR "$1" not found."
     622            else
     623               printprocesslog "WARN "$1" not found."
     624            fi
     625         else
     626            # other aux-files would be good to have
     627            #printprocesslog "WARN "$1" not found."
     628            if [ $filenight -le $checknight ]
     629            then
     630               printprocesslog "WARN "$1" not found."
     631            else
     632               printprocesslog "INFO "$1" not found."
     633            fi
     634         fi
     635      fi
     636      return 1
     637   fi
     638   
     639   # file available
     640   return 0
     641}
     642
Note: See TracChangeset for help on using the changeset viewer.