Ignore:
Timestamp:
09/01/21 07:56:42 (3 years ago)
Author:
maslowski
Message:
Added better error handeling and tracking in the databas.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/hawc/processing/DiskToDB/run-callisto2.sh

    r20093 r20103  
    3232readonly STAR=star
    3333# Directory to Mars environment (usually Mars/build)
    34 readonly MARS="/home/frankm/Dateien/Mars/build/"
     34readonly MARS="/home/frankm/Dateien/Mars-6.24.00/build4/"
    3535# Absolut path to macros
    36 readonly MACROS="/home/frankm/Dateien/Mars/hawc"
     36readonly MACROS="/home/frankm/Dateien/Mars-6.24.00/hawc"
    3737readonly PROGRAM=$0
    3838REPLACE=false
     
    6060if [ ! -d "${MARS}" ]
    6161then
    62         echo "Mars does not exists at ${MARS}. Please change in \
     62        echo "Mars does not exists at ${MARS}. Please change in \\
    6363                script ${PROGRAM}."
    6464        exit 1
     
    6868if [ ! -d "${MACROS}" ]
    6969then
    70         echo "Macros directorey does not exists at ${MACROS}. Please change in \
     70        echo "Macros directorey does not exists at ${MACROS}. Please change in \\
    7171                script ${PROGRAM}."
    7272        exit 1
     
    8888NIGHT="${4}"
    8989
     90function UpdateStatus()
     91{
     92        local tel="${1}"
     93        local night="${2}"
     94        local runid="${3}"
     95        local stat="${4}"
     96
     97        mysql --defaults-file=${CRED} \
     98                --compress \
     99                -e "UPDATE DataOnDisk \
     100                SET DataOnDisk.callisto = ${stat} \
     101                WHERE DataOnDisk.Telescope = ${tel} \
     102                AND DataOnDisk.NIGHT = ${night} \
     103                AND DataOnDisk.RUNID = ${runid};"
     104}
     105
    90106# Get all runs that can (and should) be calibrated
    91107# Pipe the output to mysql and read the
     
    94110"\
    95111SELECT
    96         NIGHT, RUNID, DrsNight, DrsRunID
     112        Calibration.NIGHT,
     113        Calibration.RUNID,
     114        Calibration.DrsNight,
     115        Calibration.DrsRunID
    97116FROM
    98117        Calibration
     118INNER JOIN
     119        DataOnDisk
     120ON
     121        DataOnDisk.Telescope = Calibration.Telescope
     122AND
     123        DataOnDisk.NIGHT = Calibration.NIGHT
     124AND
     125        DataOnDisk.RUNID = Calibration.RUNID
    99126WHERE
    100         Telescope=${TEL}
     127        Calibration.Telescope = ${TEL}
    101128AND     
    102         NIGHT=${NIGHT}
     129        Calibration.NIGHT = ${NIGHT}
     130AND
     131        DataOnDisk.calibration = 0
    103132ORDER BY
    104         NIGHT, RUNID\
     133        Calibration.NIGHT, Calibration.RUNID\
    105134"\
    106135|  mysql \
     
    161190
    162191                       # Execute the calibration and write output to log-file
    163                        root -b -q -l ${MACROS}/callisto.C'("'"${DATA}"/${DATPATH}/${DATNAME}'","'"${DATA}"/${DRSPATH}/${DRSNAME}'","'"${OUT}"'")' \
     192                       root -b -q -l ${MACROS}/callisto.C'("'"${DATA}"/${DATPATH}/${DATNAME}'","'"${DATA}"/${DRSPATH}/${DRSNAME}'", 0 ,"'"${OUT}"'")' \
    164193                               2>&1 | tee "${OUT}"/${PREFIX}.log
    165194
     
    176205                       if [ "${RC}" == "0" ]
    177206                       then
    178                                touch "${OUT}"/.${PREFIX}.success
     207                                touch "${OUT}"/.${PREFIX}.success
     208                       else
     209                                UpdateStatus ${TEL} ${NIGHT} ${DATRUNID} 1
    179210                       fi
    180211
Note: See TracChangeset for help on using the changeset viewer.