IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20384


Ignore:
Timestamp:
Oct 24, 2008, 3:05:55 PM (18 years ago)
Author:
eugene
Message:

lots of work: remove exposure tasks (unneeded), clean up imfile tasks

File:
1 edited

Legend:

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

    r19465 r20384  
    11## detrend.correct.pro : globals and support macros : -*- sh -*-
    22## this file contains the tasks for running the detrend correction stage
    3 ## these tasks use the books detPendingCorrectedImfile and detPendingCorrectedExp
     3## these tasks use the books detPendingCorrectImfile
    44
    55# test for required global variables
    66check.globals
    77
    8 book init detPendingCorrectedImfile
    9 book init detPendingCorrectedExp
     8book init detPendingCorrectImfile
    109
    1110macro detcorr.reset
    12   book init detPendingCorrectedImfile
    13   book init detPendingCorrectedExp
     11  book init detPendingCorrectImfile
    1412end
    1513
    1614macro detcorr.status
    17   echo detPendingCorrectedImfile
    18   book listbook detPendingCorrectedImfile
    19   echo detPendingCorrectedExp
    20   book listbook detPendingCorrectedExp
     15  echo detPendingCorrectImfile
     16  book listbook detPendingCorrectImfile
    2117end
    2218
     
    2622  end
    2723  task detrend.correct.run
    28     active true
    29   end
    30   task detrend.correctexp.load
    31     active true
    32   end
    33   task detrend.correctexp.run
    3424    active true
    3525  end
     
    4333    active false
    4434  end
    45   task detrend.correctexp.load
    46     active false
    47   end
    48   task detrend.correctexp.run
    49     active false
    50   end
    5135end
    5236
    5337
    5438# these variables will cycle through the known database names
    55 $detPendingCorrectedImfile_DB = 0
    56 $detPendingCorrectedExp_DB = 0
     39$detPendingCorrectImfile_DB = 0
    5740
    5841# select images ready for copy
    59 # new entries are added to detPendingCorrectedImfile
     42# new entries are added to detPendingCorrectImfile
    6043# compare the new list with the ones already selected
    6144task           detrend.correct.load
     
    7154
    7255  task.exec
    73     $run = dettool -tocorrectedimfile
     56    $run = dettool -tocorrectimfile
    7457    if ($DB:n == 0)
    7558      option DEFAULT
    7659    else
    7760      # save the DB name for the exit tasks
    78       option $DB:$detPendingCorrectedImfile_DB
    79       $run = $run -dbname $DB:$detPendingCorrectedImfile_DB
    80       $detPendingCorrectedImfile_DB ++
    81       if ($detPendingCorrectedImfile_DB >= $DB:n) set detPendingCorrectedImfile_DB = 0
     61      option $DB:$detPendingCorrectImfile_DB
     62      $run = $run -dbname $DB:$detPendingCorrectImfile_DB
     63      $detPendingCorrectImfile_DB ++
     64      if ($detPendingCorrectImfile_DB >= $DB:n) set detPendingCorrectImfile_DB = 0
    8265    end
     66    echo $run
    8367    add_poll_args run
     68    echo $run
    8469    command $run
    8570  end
     
    8873  task.exit    0
    8974    # convert 'stdout' to book format
    90     ipptool2book stdout detPendingCorrectedImfile -key det_id:exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     75    ipptool2book stdout detPendingCorrectImfile -key det_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    9176    if ($VERBOSE > 2)
    92       book listbook detPendingCorrectedImfile
     77      book listbook detPendingCorrectImfile
    9378    end
    9479
    9580    # delete existing entries in the appropriate pantaskStates
    96     process_cleanup detPendingCorrectedImfile
     81    process_cleanup detPendingCorrectImfile
    9782  end
    9883
     
    115100
    116101  task.exec
    117     book npages detPendingCorrectedImfile -var N
     102    book npages detPendingCorrectImfile -var N
    118103    if ($N == 0) break
    119104    if ($NETWORK == 0) break
    120105   
    121     # look for new images in detPendingCorrectedImfile
    122     book getpage detPendingCorrectedImfile 0 -var pageName -key pantaskState INIT
     106    # look for new images in detPendingCorrectImfile
     107    book getpage detPendingCorrectImfile 0 -var pageName -key pantaskState INIT
    123108    if ("$pageName" == "NULL") break
    124109
    125     book setword detPendingCorrectedImfile $pageName pantaskState RUN
    126     book getword detPendingCorrectedImfile $pageName det_id    -var DET_ID   
    127     book getword detPendingCorrectedImfile $pageName exp_id    -var EXP_ID 
    128     book getword detPendingCorrectedImfile $pageName class_id  -var CLASS_ID
    129     book getword detPendingCorrectedImfile $pageName exp_tag   -var EXP_TAG  XXX where does this come from
    130     book getword detPendingCorrectedImfile $pageName det_type  -var DET_TYPE  XXX where does this come from
    131     book getword detPendingCorrectedImfile $pageName camera    -var CAMERA  XXX where does this come from
    132     book getword detPendingCorrectedImfile $pageName uri       -var URI     
    133     book getword detPendingCorrectedImfile $pageName corr_id   -var CORR_ID
    134     book getword detPendingCorrectedImfile $pageName corr_type -var CORR_TYPE
    135     book getword detPendingCorrectedImfile $pageName workdir   -var WORKDIR_TEMPLATE
    136     book getword detPendingCorrectedImfile $pageName dbname    -var DBNAME
     110    book setword detPendingCorrectImfile $pageName pantaskState RUN
     111    book getword detPendingCorrectImfile $pageName det_id    -var DET_ID   
     112    book getword detPendingCorrectImfile $pageName class_id  -var CLASS_ID
     113    book getword detPendingCorrectImfile $pageName det_type  -var DET_TYPE
     114    book getword detPendingCorrectImfile $pageName camera    -var CAMERA
     115    book getword detPendingCorrectImfile $pageName uri       -var URI     
     116    book getword detPendingCorrectImfile $pageName workdir   -var WORKDIR_TEMPLATE
     117    book getword detPendingCorrectImfile $pageName dbname    -var DBNAME
    137118
    138119    # specify choice of local or remote host based on camera and chip (class_id)
     
    143124
    144125    ## generate outroot specific to this exposure (& chip)
    145     sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
     126    sprintf outroot "%s/%s.%s.%s/%s.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID
    146127
    147128    stdout $LOGDIR/detcorr.run.log
    148129    stderr $LOGDIR/detcorr.run.log
    149130
    150     $run = detrend_correct_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA --outroot $outroot --redirect-output --verbose
    151     if ("$WORKDIR" != "NULL")
    152       $run = $run --workdir $WORKDIR
    153     end
    154     if ("$REDUCTION" != "NULL")
    155       $run = $run --reduction $REDUCTION
    156     end
     131    $run = detrend_correct_imfile.pl --det_id $DET_ID --class_id $CLASS_ID --det_type $DET_TYPE --input_uri $URI --camera $CAMERA --outroot $outroot --redirect-output --verbose
    157132    add_standard_args run
    158133
     
    169144  # default exit status
    170145  task.exit    default
    171     process_exit detPendingCorrectedImfile $options:0 $JOB_STATUS
     146    process_exit detPendingCorrectImfile $options:0 $JOB_STATUS
    172147  end
    173148
     
    175150  task.exit    timeout
    176151    showcommand timeout
    177     book setword detPendingCorrectedImfile $options:0 pantaskState TIMEOUT
     152    book setword detPendingCorrectImfile $options:0 pantaskState TIMEOUT
    178153 end
    179154end
    180155
    181 # select images ready for copy
    182 # new entries are added to detPendingCorrectedExp
    183 # compare the new list with the ones already selected
    184 task           detrend.correctexp.load
    185   host         local
    186 
    187   periods      -poll $LOADPOLL
    188   periods      -exec $LOADEXEC
    189   periods      -timeout 30
    190   npending     1
    191 
    192   stdout NULL
    193   stderr $LOGDIR/detcorr.exp.load.log
    194 
    195   task.exec
    196     $run = dettool -tocorrectedexp
    197     if ($DB:n == 0)
    198       option DEFAULT
    199     else
    200       # save the DB name for the exit tasks
    201       option $DB:$detPendingCorrectedExp_DB
    202       $run = $run -dbname $DB:$detPendingCorrectedExp_DB
    203       $detPendingCorrectedExp_DB ++
    204       if ($detPendingCorrectedExp_DB >= $DB:n) set detPendingCorrectedExp_DB = 0
    205     end
    206     add_poll_args run
    207     command $run
    208   end
    209 
    210   # success
    211   task.exit    0
    212     # convert 'stdout' to book format
    213     ipptool2book stdout detPendingCorrectedExp -key det_id:exp_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    214     if ($VERBOSE > 2)
    215       book listbook detPendingCorrectedExp
    216     end
    217 
    218     # delete existing entries in the appropriate pantaskStates
    219     process_cleanup detPendingCorrectedExp
    220   end
    221 
    222   # error
    223   task.exit    default
    224     showcommand failure
    225   end
    226 
    227   # operation times out?
    228   task.exit    timeout
    229     showcommand timeout
    230   end
    231 end
    232 
    233 # copy new images, sending job to desired host
    234 task           detrend.correctexp.run
    235   periods      -poll $RUNPOLL
    236   periods      -exec $RUNEXEC
    237   periods      -timeout 30
    238 
    239   task.exec
    240     book npages detPendingCorrectedExp -var N
    241     if ($N == 0) break
    242     if ($NETWORK == 0) break
    243    
    244     # look for new exposures in detPendingCorrectedExp
    245     book getpage detPendingCorrectedExp 0 -var pageName -key pantaskState INIT
    246     if ("$pageName" == "NULL") break
    247 
    248     book setword detPendingCorrectedExp $pageName pantaskState RUN
    249     book getword detPendingCorrectedExp $pageName det_id    -var DET_ID
    250     book getword detPendingCorrectedExp $pageName exp_id    -var EXP_ID
    251     book getword detPendingCorrectedExp $pageName det_type  -var DET_TYPE
    252     book getword detPendingCorrectedExp $pageName camera    -var CAMERA 
    253     book getword detPendingCorrectedExp $pageName exp_tag   -var EXP_TAG
    254     book getword detPendingCorrectedExp $pageName corr_id   -var CORR_ID
    255     book getword detPendingCorrectedExp $pageName corr_type -var CORR_TYPE
    256     book getword detPendingCorrectedExp $pageName workdir   -var WORKDIR_TEMPLATE
    257     book getword detPendingCorrectedExp $pageName dbname    -var DBNAME
    258 
    259     # specify choice of local or remote host based on camera and chip (class_id)
    260     set.host.for.camera $camera FPA
    261 
    262     # set workdir (interpolate host; see camera.pro for examples)
    263     set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
    264 
    265     ## generate outroot specific to this exposure (& chip)
    266     sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
    267 
    268     stdout $LOGDIR/detcorr.exp.run.log
    269     stderr $LOGDIR/detcorr.exp.run.log
    270 
    271     $run = detrend_correct_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA --redirect-output --verbose
    272 
    273     if ("$WORKDIR" != "NULL")
    274       $run = $run --workdir $WORKDIR
    275     end
    276     add_standard_args run
    277 
    278     # save the pageName for future reference below
    279     options $pageName
    280 
    281     # create example job options as a demonstration
    282     if ($VERBOSE > 1)
    283       echo command $run
    284     end
    285     command $run
    286   end
    287 
    288   # success
    289   task.exit    default
    290     process_exit detPendingCorrectedExp $options:0 $JOB_STATUS
    291   end
    292 
    293   # operation times out?
    294   task.exit    timeout
    295     showcommand timeout
    296     book setword detPendingCorrectedExp $options:0 pantaskState TIMEOUT
    297   end
    298 end
Note: See TracChangeset for help on using the changeset viewer.