IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 16, 2008, 1:06:59 PM (18 years ago)
Author:
eugene
Message:

adding cleanup stages; tidy logfile names

File:
1 edited

Legend:

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

    r18606 r19089  
    88book init detPendingResidImfile
    99book init detPendingResidExp
     10book init detCleanupResidImfile
     11book init detCleanupResidExp
    1012
    1113macro detresid.reset
    1214  book init detPendingResidImfile
    1315  book init detPendingResidExp
     16  book init detCleanupResidImfile
     17  book init detCleanupResidExp
    1418end
    1519
     
    1721  book listbook detPendingResidImfile
    1822  book listbook detPendingResidExp
     23  book listbook detCleanupResidImfile
     24  book listbook detCleanupResidExp
    1925end
    2026
     
    3238    active true
    3339  end
     40  task detrend.cleanup.resid.load
     41    active true
     42  end
     43  task detrend.cleanup.resid.run
     44    active true
     45  end
     46  task detrend.cleanup.residexp.load
     47    active true
     48  end
     49  task detrend.cleanup.residexp.run
     50    active true
     51  end
    3452end
    3553
     
    4563  end
    4664  task detrend.residexp.run
     65    active false
     66  end
     67  task detrend.cleanup.resid.load
     68    active false
     69  end
     70  task detrend.cleanup.resid.run
     71    active false
     72  end
     73  task detrend.cleanup.residexp.load
     74    active false
     75  end
     76  task detrend.cleanup.residexp.run
    4777    active false
    4878  end
     
    5282$detPendingResidImfile_DB = 0
    5383$detPendingResidExp_DB = 0
     84$detCleanupResidImfile_DB = 0
     85$detCleanupResidExp_DB = 0
    5486
    5587# select images ready for copy
     
    6597
    6698  stdout NULL
    67   stderr $LOGDIR/detresid.load.log
     99  stderr $LOGDIR/detrend.resid.imfile.log
    68100
    69101  task.exec
     
    142174    sprintf outroot "%s/%s.%s.%s/%s/%s.detresid.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID $ITERATION
    143175
    144     stdout $LOGDIR/detresid.run.log
    145     stderr $LOGDIR/detresid.run.log
     176    stdout $LOGDIR/detrend.resid.imfile.log
     177    stderr $LOGDIR/detrend.resid.imfile.log
    146178
    147179    $run = detrend_resid_imfile.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URI --input_uri $URI --camera $CAMERA --mode $MODE --outroot $outroot --redirect-output --verbose
     
    186218
    187219  stdout NULL
    188   stderr $LOGDIR/detresid.exp.load.log
     220  stderr $LOGDIR/detrend.resid.exp.log
    189221
    190222  task.exec
     
    260292    sprintf outroot "%s/%s.%s.%s/%s/%s.detresid.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID $ITERATION
    261293
    262     stdout $LOGDIR/detresid.exp.run.log
    263     stderr $LOGDIR/detresid.exp.run.log
     294    stdout $LOGDIR/detrend.resid.exp.log
     295    stderr $LOGDIR/detrend.resid.exp.log
    264296
    265297    $run = detrend_resid_exp.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --outroot $outroot --redirect-output --verbose
     
    288320  end
    289321end
     322
     323######## cleanup resid imfile ########
     324task           detrend.cleanup.resid.load
     325  host         local
     326
     327  periods      -poll $LOADPOLL
     328  periods      -exec $LOADEXEC
     329  periods      -timeout 30
     330  npending     1
     331  active       true
     332
     333  stdout NULL
     334  stderr $LOGDIR/detrend.cleanup.resid.imfile.log
     335
     336  task.exec
     337    if ($DB:n == 0)
     338      option DEFAULT
     339      command dettool -pendingcleanup_residimfile -limit 20
     340    else
     341      # save the DB name for the exit tasks
     342      option $DB:$detCleanupResidImfile_DB
     343      command dettool -pendingcleanup_residimfile -limit 20 -dbname $DB:$detCleanupResidImfile_DB
     344      $detCleanupResidImfile_DB ++
     345      if ($detCleanupResidImfile_DB >= $DB:n) set detCleanupResidImfile_DB = 0
     346    end
     347  end
     348
     349  # success
     350  task.exit    0
     351    # convert 'stdout' to book format
     352    ipptool2book stdout detCleanupResidImfile -key det_id:iteration:exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     353    if ($VERBOSE > 2)
     354      book listbook detCleanupResidImfile
     355    end
     356
     357    # delete existing entries in the appropriate pantaskStates
     358    process_cleanup detCleanupResidImfile
     359  end
     360
     361  # locked list
     362  task.exit    default
     363    showcommand failure
     364  end
     365
     366  # operation times out?
     367  task.exit    timeout
     368    showcommand timeout
     369  end
     370end
     371
     372# run the ipp_cleanup.pl script on pending images
     373task           detrend.cleanup.resid.run
     374  periods      -poll $RUNPOLL
     375  periods      -exec $RUNEXEC
     376  periods      -timeout 60
     377  active       true
     378
     379  task.exec
     380    book npages detCleanupResidImfile -var N
     381    if ($N == 0) break
     382    if ($NETWORK == 0) break
     383   
     384    # look for new images in detCleanupResidImfile (pantaskState == INIT)
     385    book getpage detCleanupResidImfile 0 -var pageName -key pantaskState INIT
     386    if ("$pageName" == "NULL") break
     387
     388    book setword detCleanupResidImfile $pageName pantaskState RUN
     389    book getword detCleanupResidImfile $pageName det_id   -var DET_ID   
     390    book getword detCleanupResidImfile $pageName exp_id   -var EXP_ID   
     391    book getword detCleanupResidImfile $pageName class_id -var CLASS_ID
     392    book getword detCleanupResidImfile $pageName iteration -var ITERATION     
     393    book getword detCleanupResidImfile $pageName camera -var CAMERA
     394    book getword detCleanupResidImfile $pageName state -var CLEANUP_MODE
     395    book getword detCleanupResidImfile $pageName dbname -var DBNAME
     396
     397    # specify choice of local or remote host based on camera and chip (class_id)
     398    set.host.for.camera $CAMERA FPA
     399
     400    stdout $LOGDIR/detrend.cleanup.resid.imfile.log
     401    stderr $LOGDIR/detrend.cleanup.resid.imfile.log
     402
     403    # XXX is everything listed here needed?
     404    $run = ipp_cleanup.pl --stage detrend.resid.imfile --stage_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --iteration $ITERATION --camera $CAMERA --mode $CLEANUP_MODE
     405    add_standard_args run
     406
     407    # save the pageName for future reference below
     408    options $pageName
     409
     410    # create the command line
     411    if ($VERBOSE > 1)
     412      echo command $run
     413    end
     414    command $run
     415  end
     416
     417  # default exit status
     418  task.exit    default
     419    process_exit detCleanupResidImfile $options:0 $JOB_STATUS
     420  end
     421
     422  # operation timed out?
     423  task.exit    timeout
     424    showcommand timeout
     425    book setword detCleanupResidImfile $options:0 pantaskState TIMEOUT
     426  end
     427end
     428 
     429
     430######## cleanup resid exp ########
     431task           detrend.cleanup.residexp.load
     432  host         local
     433
     434  periods      -poll $LOADPOLL
     435  periods      -exec $LOADEXEC
     436  periods      -timeout 30
     437  npending     1
     438  active       true
     439
     440  stdout NULL
     441  stderr $LOGDIR/detrend.cleanup.resid.exp.log
     442
     443  task.exec
     444    if ($DB:n == 0)
     445      option DEFAULT
     446      command dettool -pendingcleanup_residexp -limit 20
     447    else
     448      # save the DB name for the exit tasks
     449      option $DB:$detCleanupResidExp_DB
     450      command dettool -pendingcleanup_residexp -limit 20 -dbname $DB:$detCleanupResidExp_DB
     451      $detCleanupResidExp_DB ++
     452      if ($detCleanupResidExp_DB >= $DB:n) set detCleanupResidExp_DB = 0
     453    end
     454  end
     455
     456  # success
     457  task.exit    0
     458    # convert 'stdout' to book format
     459    ipptool2book stdout detCleanupResidExp -key det_id:iteration:exp_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     460    if ($VERBOSE > 2)
     461      book listbook detCleanupResidExp
     462    end
     463
     464    # delete existing entries in the appropriate pantaskStates
     465    process_cleanup detCleanupResidExp
     466  end
     467
     468  # locked list
     469  task.exit    default
     470    showcommand failure
     471  end
     472
     473  # operation times out?
     474  task.exit    timeout
     475    showcommand timeout
     476  end
     477end
     478
     479# run the ipp_cleanup.pl script on pending images
     480task           detrend.cleanup.residexp.run
     481  periods      -poll $RUNPOLL
     482  periods      -exec $RUNEXEC
     483  periods      -timeout 60
     484  active       true
     485
     486  task.exec
     487    book npages detCleanupResidExp -var N
     488    if ($N == 0) break
     489    if ($NETWORK == 0) break
     490   
     491    # look for new images in detCleanupResidExp (pantaskState == INIT)
     492    book getpage detCleanupResidExp 0 -var pageName -key pantaskState INIT
     493    if ("$pageName" == "NULL") break
     494
     495    book setword detCleanupResidExp $pageName pantaskState RUN
     496    book getword detCleanupResidExp $pageName det_id    -var DET_ID   
     497    book getword detCleanupResidExp $pageName exp_id    -var EXP_ID   
     498    book getword detCleanupResidExp $pageName iteration -var ITERATION
     499    book getword detCleanupResidExp $pageName camera    -var CAMERA
     500    book getword detCleanupResidExp $pageName state     -var CLEANUP_MODE
     501    book getword detCleanupResidExp $pageName dbname    -var DBNAME
     502
     503    # specify choice of local or remote host based on camera and chip (class_id)
     504    set.host.for.camera $CAMERA FPA
     505
     506    stdout $LOGDIR/detrend.cleanup.resid.exp.log
     507    stderr $LOGDIR/detrend.cleanup.resid.exp.log
     508
     509    # XXX is everything listed here needed?
     510    $run = ipp_cleanup.pl --stage detrend.resid.exp --stage_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --camera $CAMERA --mode $CLEANUP_MODE
     511    add_standard_args run
     512
     513    # save the pageName for future reference below
     514    options $pageName
     515
     516    # create the command line
     517    if ($VERBOSE > 1)
     518      echo command $run
     519    end
     520    command $run
     521  end
     522
     523  # default exit status
     524  task.exit    default
     525    process_exit detCleanupResidExp $options:0 $JOB_STATUS
     526  end
     527
     528  # operation timed out?
     529  task.exit    timeout
     530    showcommand timeout
     531    book setword detCleanupResidExp $options:0 pantaskState TIMEOUT
     532  end
     533end
Note: See TracChangeset for help on using the changeset viewer.