Changeset 15388


Ignore:
Timestamp:
04/20/13 19:30:04 (12 years ago)
Author:
Daniela Dorner
Message:
removed sourcekey and other small improvements
File:
1 edited

Legend:

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

    r15381 r15388  
    55
    66# get date (before 18h there is no new data to be processed)
    7 datepath=`date --date="-18HOUR" +%Y/%m/%d`
    8 date=`date --date="-18HOUR" +%Y%m%d`
     7datepath=`date --date="-19HOUR" +%Y/%m/%d`
     8date=`date --date="-19HOUR" +%Y%m%d`
    99#datepath="2013/04/17"
    1010#date="20130417"
     
    6767fi
    6868fileslocal=( `find $rawpath -type f | sort` )
    69 callistofiles=( `find $anapath -type f -name $date*-calibration.log | sort` )
     69callistofiles=( `find $anapath/callisto -type f -name $date*-calibration.log | sort` )
    7070numdataruns=0
    7171
     
    7373makedir $rawpath
    7474
    75 echo ${#fileslocal[@]}" "${#files[@]}" "${#callistofiles[@]}
     75echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns
     76printprocesslog "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns
    7677
    7778while [ ${#fileslocal[@]} -ne ${#files[@]} ] || [ $numdataruns -ne ${#callistofiles[@]} ]
    7879do
    7980   numdataruns=0
     81   echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns
     82   printprocesslog "INFO status beginning of while-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns
     83
    8084   rsync_aux_file $drivefilenewdaq $drivefile
    8185   
     
    135139         if [ "$runtype" == "data" ]
    136140         then
    137             numdataruns=`echo " $numdataruns + 1 " | bc -l`
    138141            if [ "$fileerror" = "yes" ]
    139142            then
     
    160163            echo "" >> $seqfile
    161164
    162             tstopi=`$factpath/fitsdump -h $localfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
    163             tstopf=`$factpath/fitsdump -h $localfile  2>/dev/null | grep TSTOPF | grep -E -o '[.][0-9]+'`
    164             tstop=${tstopi}${tstopf}
    165             coordinates=( `${factpath}/fitsdump ${drivefile} -c Ra_src Dec_src -r --filter='Time<'${tstop}  2>/dev/null | tail -1 2>&1` )
    166             if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ]
    167             then
    168                printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
    169                continue
    170             fi
    171             if [ "${coordinates[0]}" == "0" ] || [ "${coordinates[1]}" == "0" ]
    172             then
    173                printprocesslog "WARN coordinates "${coordinates[@]}
    174                continue
    175             fi
    176             printprocesslog "DEBUG coordinates "${coordinates[@]}
    177             query="SELECT fSourceKEY FROM scheduling.source WHERE "
    178             query=$query" fRightAscension BETWEEN "${coordinates[0]}"-0.01 AND "${coordinates[0]}"+0.01 "
    179             query=$query" AND fDeclination BETWEEN "${coordinates[1]}"-0.01 AND "${coordinates[1]}"+0.01 "
    180             sourcekey=`sendquery`
    181             if [ "$sourcekey" == "" ]
    182             then
    183                printprocesslog "WARN sourcekey empty - coordinates"${coordinates[@]}
    184             fi
     165#            tstopi=`$factpath/fitsdump -h $localfile  2>/dev/null | grep TSTOPI | grep -E -o '[0-9]+'`
     166#            tstopf=`$factpath/fitsdump -h $localfile  2>/dev/null | grep TSTOPF | grep -E -o '[.][0-9]+'`
     167#            tstop=${tstopi}${tstopf}
     168#            coordinates=( `${factpath}/fitsdump ${drivefile} -c Ra_src Dec_src -r --filter='Time<'${tstop}  2>/dev/null | tail -1 2>&1` )
     169#            if [ "${coordinates[0]}" == "" ] || [ "${coordinates[1]}" == "" ]
     170#            then
     171#               printprocesslog "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
     172#               #echo "WARN couldn't get coordinates ("${coordinates[@]}") from "$drivefile
     173#               continue
     174#            fi
     175#            if [ "${coordinates[0]}" == "0" ] || [ "${coordinates[1]}" == "0" ]
     176#            then
     177#               printprocesslog "WARN coordinates "${coordinates[@]}
     178#               #echo "WARN coordinates "${coordinates[@]}
     179#               continue
     180#            fi
     181#            printprocesslog "DEBUG coordinates "${coordinates[@]}
     182#            query="SELECT fSourceKEY FROM scheduling.source WHERE "
     183#            query=$query" fRightAscension BETWEEN "${coordinates[0]}"-0.01 AND "${coordinates[0]}"+0.01 "
     184#            query=$query" AND fDeclination BETWEEN "${coordinates[1]}"-0.01 AND "${coordinates[1]}"+0.01 "
     185#            sourcekey=`sendquery`
     186#            if [ "$sourcekey" == "" ]
     187#            then
     188#               printprocesslog "WARN sourcekey empty - coordinates"${coordinates[@]}
     189#            fi
     190           
     191            printprocesslog "INFO counting callisto logs and data files +1."
     192            # get number of callisto logs
    185193            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`
     194            # count data runs
     195            numdataruns=`echo " $numdataruns + 1 " | bc -l`
     196            #echo "numdata +1"
    186197           
    187198            echo "cal: "$callistocount" numdat: "$numdataruns" numcallog: "${#callistofiles[@]}
     199            printprocesslog "INFO running callistos: "$callistocount" #data-runs: "$numdataruns" #callisto-logs: "${#callistofiles[@]}
    188200            # do not overload system in case of a lot of files to be processed
    189201            #  callistocount is set in setup.fact.lp.data
     
    194206               continue
    195207            fi
    196             callistolog=`dirname $seqfile | sed -e "s/sequences/${sourcekey}\/callisto/"`"/"$night"_"$runnum"-calibration.log"
     208            callistolog=`dirname $seqfile | sed -e "s/sequences/callisto/"`"/"$night"_"$runnum"-calibration.log"
    197209            if ! [ -e $callistolog ]
    198210            then
     
    202214               rsync_aux_file $tempfilenewdaq $tempfile
    203215               rsync_aux_file $humfilenewdaq $humfile
    204                printprocesslog "INFO starting RunCallisto.sh for "$sourcekey" "$seqfile
    205                echo "INFO starting RunCallisto.sh for "$sourcekey" "$seqfile
    206                `dirname $0`/RunCallisto.sh $sourcekey $seqfile &
     216               #printprocesslog "INFO starting RunCallisto.sh for "$sourcekey" "$seqfile
     217               #echo "INFO starting RunCallisto.sh for "$sourcekey" "$seqfile
     218               #`dirname $0`/RunCallisto.sh $sourcekey $seqfile &
     219               printprocesslog "INFO starting RunCallisto.sh for "$seqfile
     220               echo "INFO starting RunCallisto.sh for "$seqfile
     221               `dirname $0`/RunCallisto.sh $seqfile &
    207222            fi
    208223            continue
     
    262277   files=( `find $rawpathnewdaq -type f | sort` )
    263278   fileslocal=( `find $rawpath -type f | sort` )
    264    callistofiles=( `find $anapath -type f -name $date*-calibration.log | sort` )
    265    
     279   callistofiles=( `find $anapath/callisto -type f -name $date*-calibration.log | sort` )
     280   echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns
     281   printprocesslog "INFO status after for-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns
     282
     283   # wait and get new file lists
    266284   update=
    267285   if [ ${#fileslocal[@]} -eq ${#files[@]} ]
    268286   then
     287      printprocesslog "INFO wait 60 seconds."
    269288      sleep 60
    270289      echo "sleep 60..."
     290      printprocesslog "INFO get new file lists for "$datepath
    271291      files=( `find $rawpathnewdaq -type f | sort` )
    272292      fileslocal=( `find $rawpath -type f | sort` )
    273       callistofiles=( `find $anapath -type f -name $date*-calibration.log | sort` )
     293      callistofiles=( `find $anapath/callisto -type f -name $date*-calibration.log | sort` )
    274294   fi
     295   echo "INFO #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns
     296   printprocesslog "INFO status after wait end of while-loop #files-daq:"${#fileslocal[@]}" #files-newdaq:"${#files[@]}" #callisto-logs:"${#callistofiles[@]}" #data-runs:"$numdataruns
    275297done
    276298
Note: See TracChangeset for help on using the changeset viewer.