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.norm.pro

    r9506 r10692  
    22## this file contains the tasks for running the detrend normalization stage
    33
    4 ## these tasks use the queue DetrendNormalize
    5 ## the DetrendNormalize queue contains:
     4## these tasks use the queue DetrendNorm
     5## the DetrendNorm queue contains:
    66## STATE DET_ID ITER
    77
    8 queueinit DetrendNormalize
     8queueinit DetrendNorm
    99queueinit DetrendNormStat
    10 queueinit DetrendNormalizeExposures
     10queueinit DetrendNormExp
    1111if ($?network == 0)
    1212  $network = 1
     
    1414if ($?parallel == 0)
    1515  $parallel = 0
     16end
     17
     18$DetrendNormFail = 0
     19$DetrendNormStatFail = 0
     20$DetrendNormExpFail = 0
     21
     22if ($?VERBOSE == 0)
     23  echo "VERBOSE not defined: load pantasks.pro first"
     24  break
     25end
     26if ($?LOGDIR == 0)
     27  echo "LOGDIR not defined: load pantasks.pro first"
     28  break
     29end
     30$LOGSUBDIR = $LOGDIR/detrend
     31exec mkdir -p $LOGSUBDIR
     32
     33macro detnorm.status
     34  queueprint DetrendNorm
     35  queueprint DetrendNormStat
     36  queueprint DetrendNormExp
     37  echo "DetrendNormFail: $DetrendNormFail"
     38  echo "DetrendNormStatFail: $DetrendNormStatFail"
     39  echo "DetrendNormExpFail: $DetrendNormExpFail"
    1640end
    1741
     
    2044# compare the new list with the ones already selected
    2145task           dettool.normstat.load
    22   command      dettool -tonormalizedstat -simple
    2346  host         local
    2447
     
    2750  periods      -timeout 30
    2851
    29   stdout dettool.normstat.log
    30   stderr dettool.normstat.log
     52  stdout $LOGSUBDIR/dettool.normstat.log
     53  stderr $LOGSUBDIR/dettool.normstat.log
     54
     55  task.exec
     56    command      dettool -tonormalizedstat -simple -limit {$DetrendNormStatFail + 20}
     57  end
    3158
    3259  # success
     
    4168    for i 0 $Nqueue
    4269      queuepop stdout -var line
     70      if ($VERBOSE > 2)
     71        echo $line
     72      end
    4373      list word -split $line
    4474      $DET_ID   = $word:0
     
    5686  # default exit status
    5787  task.exit    default
    58     echo       "detrend.norm: failure"
    59   end
    60 
    61   # operation times out?
    62   task.exit    timeout
    63     echo       "detrend.norm: timeout"
     88    if ($VERBOSE)
     89      echo       "detrend.norm: failure"
     90    end
     91  end
     92
     93  # operation times out?
     94  task.exit    timeout
     95    if ($VERBOSE)
     96      echo       "detrend.norm: timeout"
     97    end
    6498  end
    6599end
     
    73107  task.exec
    74108    queuesize DetrendNormStat -var N
    75    
    76109    if ($N == 0) break
    77110    if ($network == 0) break
     
    95128
    96129    # XXX add $WORKDIR/$LOG_DIR
    97     stdout $CAMERA.$DET_TYPE.$DET_ID.$ITER.log
    98     stderr $CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     130    stdout $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     131    stderr $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
    99132
    100133    # specify choice of remote host:
     
    107140    # create example job options as a demonstration
    108141    options "$line"
    109     echo command detrend_norm_calc.pl --det_id $DET_ID --iteration $ITER --det_type $DET_TYPE
     142    if ($VERBOSE > 1)
     143      echo command detrend_norm_calc.pl --det_id $DET_ID --iteration $ITER --det_type $DET_TYPE
     144    end
    110145    command detrend_norm_calc.pl --det_id $DET_ID --iteration $ITER --det_type $DET_TYPE
    111146  end
     
    118153  # default exit status
    119154  task.exit    default
     155    if ($VERBOSE)
     156      echo "failure detrend_norm_calc.pl $options:0"
     157    end
    120158    queuepush DetrendNormStat -replace -key 1:3 "FAIL $options:0"
    121   end
    122 
    123   # operation times out?
    124   task.exit    timeout
     159    $DetrendNormStatFail ++
     160  end
     161
     162  # operation times out?
     163  task.exit    timeout
     164    if ($VERBOSE)
     165      echo "failure detrend_norm_calc.pl $options:0"
     166    end
    125167    queuepush DetrendNormStat -replace -key 1:3 "TIMEOUT $options:0"
     168   $DetrendNormStatFail ++
    126169  end
    127170end
    128171
    129172# select images ready for copy
    130 # new entries are added to queue DetrendNormalize
     173# new entries are added to queue DetrendNorm
    131174# compare the new list with the ones already selected
    132175task           dettool.norm.load
    133   command      dettool -tonormalize -simple
    134176  host         local
    135177
     
    138180  periods      -timeout 30
    139181
    140   stdout dettool.norm.log
    141   stderr dettool.norm.log
     182  stdout $LOGSUBDIR/dettool.norm.log
     183  stderr $LOGSUBDIR/dettool.norm.log
     184
     185  task.exec
     186    command      dettool -tonormalize -simple -limit {$DetrendNormFail + 20}
     187  end
    142188
    143189  # success
     
    152198    for i 0 $Nqueue
    153199      queuepop stdout -var line
     200      if ($VERBOSE > 2)
     201        echo $line
     202      end
    154203      list word -split $line
    155204      $DET_TYPE = $word:0
     
    160209      $CLASS_ID = $word:5
    161210      $NORM     = $word:6
    162       queuepush DetrendNormalize -uniq -key 4:5 "NEW $DET_TYPE $CAMERA $URI $DET_ID $ITER $CLASS_ID $NORM"
     211      queuepush DetrendNorm -uniq -key 4:5 "NEW $DET_TYPE $CAMERA $URI $DET_ID $ITER $CLASS_ID $NORM"
    163212    end
    164213
    165214    # delete existing entries which are DONE
    166     queuedrop DetrendNormalize -key 0 DONE
     215    queuedrop DetrendNorm -key 0 DONE
    167216  end
    168217
     
    170219  # default exit status
    171220  task.exit    default
    172     echo       "detrend.norm: failure"
    173   end
    174 
    175   # operation times out?
    176   task.exit    timeout
    177     echo       "detrend.norm: timeout"
     221    if ($VERBOSE)
     222      echo       "detrend.norm: failure"
     223    end
     224  end
     225
     226  # operation times out?
     227  task.exit    timeout
     228    if ($VERBOSE)
     229      echo       "detrend.norm: timeout"
     230    end
    178231  end
    179232end
     
    186239
    187240  task.exec
    188     queuesize DetrendNormalize -var N
    189    
     241    queuesize DetrendNorm -var N
    190242    if ($N == 0) break
    191243    if ($network == 0) break
    192244   
    193     # look for new images on the internal DetrendNormalize queue
     245    # look for new images on the internal DetrendNorm queue
    194246    # caution with these 'if' statements: syntax errors
    195247    # will make the task fail without given a good status
    196     queuepop DetrendNormalize -var line -key 0 NEW
     248    queuepop DetrendNorm -var line -key 0 NEW
    197249    if ("$line" == "NULL") break
    198250
    199251    strpop line state
    200     queuepush DetrendNormalize -replace -key 4:5 "RUN $line"
    201 
    202     # the DetrendNormalize queue contains:
     252    queuepush DetrendNorm -replace -key 4:5 "RUN $line"
     253
     254    # the DetrendNorm queue contains:
    203255    # STATE DET_ID ITER
    204256    list word -split $line
     
    211263    $NORM     = $word:6
    212264
    213     $LOG_DIR = `dirname $URI`
    214 
    215     stdout $WORKDIR/$LOG_DIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
    216     stderr $WORKDIR/$LOG_DIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     265    stdout $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     266    stderr $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
    217267
    218268    # specify choice of remote host:
     
    225275    # create example job options as a demonstration
    226276    options "$line"
    227     echo command detrend_norm_apply.pl --det_id $DET_ID --iteration $ITER --class_id $CLASS_ID --value $NORM --input_uri $URI --camera $CAMERA --det_type $DET_TYPE
     277    if ($VERBOSE > 1)
     278      echo command detrend_norm_apply.pl --det_id $DET_ID --iteration $ITER --class_id $CLASS_ID --value $NORM --input_uri $URI --camera $CAMERA --det_type $DET_TYPE
     279    end
    228280    command detrend_norm_apply.pl --det_id $DET_ID --iteration $ITER --class_id $CLASS_ID --value $NORM --input_uri $URI --camera $CAMERA --det_type $DET_TYPE
    229281  end
     
    231283  # success
    232284  task.exit 0
    233     queuepush DetrendNormalize -replace -key 4:5 "DONE $options:0"
    234   end
    235 
    236   # default exit status
    237   task.exit    default
    238     queuepush DetrendNormalize -replace -key 4:5 "FAIL $options:0"
    239   end
    240 
    241   # operation times out?
    242   task.exit    timeout
    243     queuepush DetrendNormalize -replace -key 4:5 "TIMEOUT $options:0"
     285    queuepush DetrendNorm -replace -key 4:5 "DONE $options:0"
     286  end
     287
     288  # default exit status
     289  task.exit    default
     290    if ($VERBOSE)
     291      echo "failure detrend_norm_apply.pl $options:0"
     292    end
     293    queuepush DetrendNorm -replace -key 4:5 "FAIL $options:0"
     294    $DetrendNormFail ++
     295  end
     296
     297  # operation times out?
     298  task.exit    timeout
     299    if ($VERBOSE)
     300      echo "failure detrend_norm_apply.pl $options:0"
     301    end
     302    queuepush DetrendNorm -replace -key 4:5 "TIMEOUT $options:0"
     303    $DetrendNormFail ++
    244304  end
    245305end
    246306
    247307# select images ready for copy
    248 # new entries are added to queue DetrendNormalizeExposures
     308# new entries are added to queue DetrendNormExp
    249309# compare the new list with the ones already selected
    250310task           dettool.normexp.load
    251   command      dettool -tonormalizedexp -simple
    252311  host         local
    253312
     
    256315  periods      -timeout 30
    257316
    258   stdout dettool.normexp.log
    259   stderr dettool.normexp.log
     317  stdout $LOGSUBDIR/dettool.normexp.log
     318  stderr $LOGSUBDIR/dettool.normexp.log
     319
     320  task.exec
     321    command      dettool -tonormalizedexp -simple -limit {$DetrendNormExpFail + 20}
     322  end
    260323
    261324  # success
     
    270333    for i 0 $Nqueue
    271334      queuepop stdout -var line
     335      if ($VERBOSE > 2)
     336        echo $line
     337      end
    272338      list word -split $line
    273339      $DET_ID   = $word:0
     
    278344      #$EXP_TYPE = $word:5
    279345      #$IMFILES  = $word:6
    280       queuepush DetrendNormalizeExposures -uniq -key 1:2 "NEW $DET_ID $ITER $DET_TYPE $CAMERA"
     346      queuepush DetrendNormalizeExp -uniq -key 1:2 "NEW $DET_ID $ITER $DET_TYPE $CAMERA"
    281347    end
    282348
    283349    # delete existing entries which are DONE
    284     queuedrop DetrendNormalizeExposures -key 0 DONE
     350    queuedrop DetrendNormExp -key 0 DONE
    285351  end
    286352
     
    288354  # default exit status
    289355  task.exit    default
    290     echo       "detrend.norm: failure"
    291   end
    292 
    293   # operation times out?
    294   task.exit    timeout
    295     echo       "detrend.norm: timeout"
     356    if ($VERBOSE)
     357      echo       "detrend.norm: failure"
     358    end
     359  end
     360
     361  # operation times out?
     362  task.exit    timeout
     363    if ($VERBOSE)
     364      echo       "detrend.norm: timeout"
     365    end
    296366  end
    297367end
     
    304374
    305375  task.exec
    306     queuesize DetrendNormalizeExposures -var N
     376    queuesize DetrendNormExp -var N
    307377   
    308378    if ($N == 0) break
    309379    if ($network == 0) break
    310380   
    311     # look for new images on the internal DetrendNormalizeExposures queue
     381    # look for new images on the internal DetrendNormExp queue
    312382    # caution with these 'if' statements: syntax errors
    313383    # will make the task fail without given a good status
    314     queuepop DetrendNormalizeExposures -var line -key 0 NEW
     384    queuepop DetrendNormExp -var line -key 0 NEW
    315385    if ("$line" == "NULL") break
    316386
    317387    strpop line state
    318     queuepush DetrendNormalizeExposures -replace -key 1:2 "RUN $line"
    319 
    320     # the DetrendNormalizeExposures queue contains:
     388    queuepush DetrendNormExp -replace -key 1:2 "RUN $line"
     389
     390    # the DetrendNormExp queue contains:
    321391    # STATE DET_ID ITER
    322392    list word -split $line
     
    330400
    331401    # XXX add $WORKDIR/$LOG_DIR
    332     stdout $CAMERA.$DET_TYPE.$DET_ID.$ITER.log
    333     stderr $CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     402    stdout $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     403    stderr $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
    334404
    335405    # specify choice of remote host:
     
    342412    # create example job options as a demonstration
    343413    options "$line"
    344     echo command detrend_norm_exp.pl --det_id $DET_ID --iteration $ITER --camera $CAMERA --det_type $DET_TYPE
     414    if ($VERBOSE > 1)
     415      echo command detrend_norm_exp.pl --det_id $DET_ID --iteration $ITER --camera $CAMERA --det_type $DET_TYPE
     416    end
    345417    command detrend_norm_exp.pl --det_id $DET_ID --iteration $ITER --camera $CAMERA --det_type $DET_TYPE
    346418  end
     
    348420  # success
    349421  task.exit 0
    350     queuepush DetrendNormalizeExposures -replace -key 1:2 "DONE $options:0"
    351   end
    352 
    353   # default exit status
    354   task.exit    default
    355     queuepush DetrendNormalizeExposures -replace -key 1:2 "FAIL $options:0"
    356   end
    357 
    358   # operation times out?
    359   task.exit    timeout
    360     queuepush DetrendNormalizeExposures -replace -key 1:2 "TIMEOUT $options:0"
    361   end
    362 end
     422    queuepush DetrendNormExp -replace -key 1:2 "DONE $options:0"
     423  end
     424
     425  # default exit status
     426  task.exit    default
     427    if ($VERBOSE)
     428      echo "failure detrend_norm_exp.pl $options:0"
     429    end
     430    queuepush DetrendNormExp -replace -key 1:2 "FAIL $options:0"
     431   $DetrendNormExpFail ++
     432  end
     433
     434  # operation times out?
     435  task.exit    timeout
     436    if ($VERBOSE)
     437      echo "failure detrend_norm_exp.pl $options:0"
     438    end
     439    queuepush DetrendNormExp -replace -key 1:2 "TIMEOUT $options:0"
     440   $DetrendNormExpFail ++
     441  end
     442end
Note: See TracChangeset for help on using the changeset viewer.