IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 12, 2006, 11:58:21 PM (20 years ago)
Author:
eugene
Message:

added global logdirs, VERBOSE output, failure tracking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/detrend.resid.pro

    r10543 r10692  
    2323end
    2424
     25$DetrendResidImfileFail = 0
     26$DetrendResidExpFail = 0
     27
     28if ($?VERBOSE == 0)
     29  echo "VERBOSE not defined: load pantasks.pro first"
     30  break
     31end
     32if ($?LOGDIR == 0)
     33  echo "LOGDIR not defined: load pantasks.pro first"
     34  break
     35end
     36$LOGSUBDIR = $LOGDIR/detrend
     37exec mkdir -p $LOGSUBDIR
     38
     39macro detresid.status
     40  queueprint DetrendResidImfiles
     41  queueprint DetrendResidExposures
     42  echo "DetrendResidImfileFail: $DetrendResidImfileFail"
     43  echo "DetrendResidExpFail: $DetrendResidExpFail"
     44end
     45
    2546# select images ready for copy
    2647# new entries are added to queue DetrendResidImfiles
    2748# compare the new list with the ones already selected
    2849task           dettool.resid.load
    29   command      dettool -toresidimfile -simple
    3050  host         local
    3151
     
    3454  periods      -timeout 30
    3555
    36   stdout dettool.resid.log
    37   stderr dettool.resid.log
     56  stdout $LOGSUBDIR/detresid.log
     57  stderr $LOGSUBDIR/detresid.log
     58
     59  task.exec
     60    command dettool -toresidimfile -simple -limit {$DetrendResidImfileFail + 20}
     61  end
    3862
    3963  # success
     
    4872    for i 0 $Nqueue
    4973      queuepop stdout -var line
     74      if ($VERBOSE > 2)
     75        echo $line
     76      end
    5077      list word -split $line
    5178      $DET_ID   = $word:0
     
    7097  # default exit status
    7198  task.exit    default
    72     echo       "detrend.resid: failure"
     99    if ($VERBOSE)
     100      echo       "detrend.resid: failure"
     101    end
    73102  end
    74103
    75104  # operation times out?
    76105  task.exit    timeout
    77     echo       "detrend.resid: timeout"
     106    if ($VERBOSE)
     107      echo       "detrend.resid: timeout"
     108    end
    78109  end
    79110end
     
    113144    $CAMERA   = $word:8
    114145
    115     $DET_DIR = `dirname $URI_IN`
    116     $LOG_DIR = $WORKDIR/$DET_DIR
    117 
    118     stdout $LOG_DIR/$EXP_TAG.detresid.$DET_ID.$ITER.$CLASS_ID.log
    119     stderr $LOG_DIR/$EXP_TAG.detresid.$DET_ID.$ITER.$CLASS_ID.log
     146    $word = `basename $EXP_TAG | tr '.' ' '`
     147    list word -split $word
     148    $base = $word:0
     149    stdout $LOGSUBDIR/$base/$EXP_TAG.detresid.$DET_ID.$ITER.$CLASS_ID.log
     150    stderr $LOGSUBDIR/$base/$EXP_TAG.detresid.$DET_ID.$ITER.$CLASS_ID.log
    120151
    121152    # specify choice of remote host:
     
    130161    # detrend_create_resid.pl DET_ID ITER EXP_TAG CLASS_ID TYPE (URI-DET) (URL-IN) (EXP_TAG ???)
    131162    # need to parse the subdir path for the detrend URL
    132     $DET_URL = $DET_DIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.fits
    133     echo command detrend_resid.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URL --input_uri $URI_IN --camera $CAMERA --mode $MODE
    134     command detrend_resid.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URL --input_uri $URI_IN --camera $CAMERA --mode $MODE
     163    # $DET_URL = $DET_DIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.fits
     164    echo command detrend_resid.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URI --input_uri $URI --camera $CAMERA --mode $MODE
     165    command detrend_resid.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URI --input_uri $URI --camera $CAMERA --mode $MODE
    135166  end
    136167
     
    142173  # default exit status
    143174  task.exit    default
     175    if ($VERBOSE)
     176      echo "failure detrend_resid.pl $options:0"
     177    end
    144178    queuepush DetrendResidImfiles -replace -key 1:2:5:6 "FAIL $options:0"
     179    $DetrendResidImfileFail ++
    145180  end
    146181
    147182  # operation times out?
    148183  task.exit    timeout
     184    if ($VERBOSE)
     185      echo "failure detrend_resid.pl $options:0"
     186    end
    149187    queuepush DetrendResidImfiles -replace -key 1:2:6:6 "TIMEOUT $options:0"
     188    $DetrendResidImfileFail ++
    150189  end
    151190end
     
    155194# compare the new list with the ones already selected
    156195task           dettool.residexp.load
    157   command      dettool -toresidexp -simple
    158196  host         local
    159197
     
    162200  periods      -timeout 30
    163201
    164   stdout dettool.residexp.log
    165   stderr dettool.residexp.log
     202  stdout $LOGSUBDIR/detresid.exp.log
     203  stderr $LOGSUBDIR/detresid.exp.log
     204
     205  task.exec
     206  command      dettool -toresidexp -simple -limit {$DetrendResidExpFail + 20}
     207  end
    166208
    167209  # success
     
    176218    for i 0 $Nqueue
    177219      queuepop stdout -var line
     220      if ($VERBOSE > 2)
     221        echo $line
     222      end
    178223      list word -split $line
    179224      $DET_ID   = $word:0
     
    194239  # default exit status
    195240  task.exit    default
    196     echo       "detrend.residexp: failure"
     241    if ($VERBOSE)
     242      echo       "detrend.residexp: failure"
     243    end
    197244  end
    198245
    199246  # operation times out?
    200247  task.exit    timeout
    201     echo       "detrend.residexp: timeout"
     248    if ($VERBOSE)
     249      echo       "detrend.residexp: timeout"
     250    end
    202251  end
    203252end
     
    235284    $CAMERA   = $word:6
    236285
    237     # XXX add $WORKDIR/$LOG_DIR
    238     stdout $EXP_TAG.detresid.$DET_ID.$ITER.log
    239     stderr $EXP_TAG.detresid.$DET_ID.$ITER.log
     286    # XXX this is still a lame rule
     287    $word = `basename $EXP_TAG | tr '.' ' '`
     288    list word -split $word
     289    $base = $word:0
     290
     291    stdout $LOGSUBDIR/$base/$EXP_TAG.detresid.$DET_ID.$ITER.log
     292    stderr $LOGSUBDIR/$base/$EXP_TAG.detresid.$DET_ID.$ITER.log
     293    exec mkdir -p $LOGSUBDIR/$base
    240294
    241295    # specify choice of remote host:
     
    248302    # create example job options as a demonstration
    249303    options "$line"
    250     echo command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
     304    if ($VERBOSE > 1)
     305      echo command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
     306    end
    251307    command detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITER --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
    252308  end
     
    259315  # default exit status
    260316  task.exit    default
     317    if ($VERBOSE)
     318      echo "failure for detrend_reject_imfile.pl: $options:0"
     319    end
    261320    queuepush DetrendResidExposures -replace -key 1:2:5 "FAIL $options:0"
     321    $DetrendResidExpFail ++
    262322  end
    263323
    264324  # operation times out?
    265325  task.exit    timeout
     326    if ($VERBOSE)
     327      echo "failure for detrend_reject_imfile.pl: $options:0"
     328    end
    266329    queuepush DetrendResidExposures -replace -key 1:2:5 "TIMEOUT $options:0"
    267   end
    268 end
     330    $DetrendResidExpFail ++
     331  end
     332end
Note: See TracChangeset for help on using the changeset viewer.