IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

adding cleanup stages

File:
1 edited

Legend:

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

    r18935 r19090  
    88book init detPendingProcessedImfile
    99book init detPendingProcessedExp
     10book init detCleanupProcessedImfile
     11book init detCleanupProcessedExp
    1012
    1113macro detproc.reset
    1214  book init detPendingProcessedImfile
    1315  book init detPendingProcessedExp
     16  book init detCleanupProcessedImfile
     17  book init detCleanupProcessedExp
    1418end
    1519
     
    1923  echo detPendingProcessedExp
    2024  book listbook detPendingProcessedExp
     25  echo detCleanupProcessedImfile
     26  book listbook detCleanupProcessedImfile
     27  echo detCleanupProcessedExp
     28  book listbook detCleanupProcessedExp
    2129end
    2230
     
    3442    active true
    3543  end
     44  task detrend.cleanup.process.load
     45    active true
     46  end
     47  task detrend.cleanup.process.run
     48    active true
     49  end
     50  task detrend.cleanup.processexp.load
     51    active true
     52  end
     53  task detrend.cleanup.processexp.run
     54    active true
     55  end
    3656end
    3757
     
    4767  end
    4868  task detrend.processexp.run
     69    active false
     70  end
     71  task detrend.cleanup.process.load
     72    active false
     73  end
     74  task detrend.cleanup.process.run
     75    active false
     76  end
     77  task detrend.cleanup.processexp.load
     78    active false
     79  end
     80  task detrend.cleanup.processexp.run
    4981    active false
    5082  end
     
    5587$detPendingProcessedImfile_DB = 0
    5688$detPendingProcessedExp_DB = 0
     89$detCleanupProcessedImfile_DB = 0
     90$detCleanupProcessedExp_DB = 0
    5791
    5892# select images ready for copy
     
    68102
    69103  stdout NULL
    70   stderr $LOGDIR/detproc.imfile.load.log
     104  stderr $LOGDIR/detrend.process.imfile.log
    71105
    72106  task.exec
     
    142176    sprintf outroot "%s/%s.%s.%s/%s/%s.detproc.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
    143177
    144     stdout $LOGDIR/detproc.imfile.run.log
    145     stderr $LOGDIR/detproc.imfile.run.log
     178    stdout $LOGDIR/detrend.process.imfile.log
     179    stderr $LOGDIR/detrend.process.imfile.log
    146180
    147181    $run = detrend_process_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --det_type $DET_TYPE --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --camera $CAMERA --outroot $outroot --redirect-output
     
    185219
    186220  stdout NULL
    187   stderr $LOGDIR/detproc.exp.load.log
     221  stderr $LOGDIR/detrend.process.exp.log
    188222
    189223  task.exec
     
    257291    sprintf outroot "%s/%s.%s.%s/%s/%s.detproc.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
    258292
    259     stdout $LOGDIR/detproc.exp.run.log
    260     stderr $LOGDIR/detproc.exp.run.log
     293    stdout $LOGDIR/detrend.process.exp.log
     294    stderr $LOGDIR/detrend.process.exp.log
    261295
    262296    $run = detrend_process_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --outroot $outroot --redirect-output --verbose
     
    287321  end
    288322end
     323
     324######## cleanup process imfile ########
     325task           detrend.cleanup.process.load
     326  host         local
     327
     328  periods      -poll $LOADPOLL
     329  periods      -exec $LOADEXEC
     330  periods      -timeout 30
     331  npending     1
     332  active       true
     333
     334  stdout NULL
     335  stderr $LOGDIR/detrend.cleanup.process.imfile.log
     336
     337  task.exec
     338    if ($DB:n == 0)
     339      option DEFAULT
     340      command dettool -pendingcleanup_processedimfile -limit 20
     341    else
     342      # save the DB name for the exit tasks
     343      option $DB:$detCleanupProcessedImfile_DB
     344      command dettool -pendingcleanup_processedimfile -limit 20 -dbname $DB:$detCleanupProcessedImfile_DB
     345      $detCleanupProcessedImfile_DB ++
     346      if ($detCleanupProcessedImfile_DB >= $DB:n) set detCleanupProcessedImfile_DB = 0
     347    end
     348  end
     349
     350  # success
     351  task.exit    0
     352    # convert 'stdout' to book format
     353    ipptool2book stdout detCleanupProcessedImfile -key det_id:exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     354    if ($VERBOSE > 2)
     355      book listbook detCleanupProcessedImfile
     356    end
     357
     358    # delete existing entries in the appropriate pantaskStates
     359    process_cleanup detCleanupProcessedImfile
     360  end
     361
     362  # locked list
     363  task.exit    default
     364    showcommand failure
     365  end
     366
     367  # operation times out?
     368  task.exit    timeout
     369    showcommand timeout
     370  end
     371end
     372
     373# run the ipp_cleanup.pl script on pending images
     374task           detrend.cleanup.process.run
     375  periods      -poll $RUNPOLL
     376  periods      -exec $RUNEXEC
     377  periods      -timeout 60
     378  active       true
     379
     380  task.exec
     381    book npages detCleanupProcessedImfile -var N
     382    if ($N == 0) break
     383    if ($NETWORK == 0) break
     384   
     385    # look for new images in detCleanupProcessedImfile (pantaskState == INIT)
     386    book getpage detCleanupProcessedImfile 0 -var pageName -key pantaskState INIT
     387    if ("$pageName" == "NULL") break
     388
     389    book setword detCleanupProcessedImfile $pageName pantaskState RUN
     390    book getword detCleanupProcessedImfile $pageName det_id   -var DET_ID   
     391    book getword detCleanupProcessedImfile $pageName exp_id   -var EXP_ID   
     392    book getword detCleanupProcessedImfile $pageName class_id -var CLASS_ID
     393    book getword detCleanupProcessedImfile $pageName camera   -var CAMERA
     394    book getword detCleanupProcessedImfile $pageName state    -var CLEANUP_MODE
     395    book getword detCleanupProcessedImfile $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.process.imfile.log
     401    stderr $LOGDIR/detrend.cleanup.process.imfile.log
     402
     403    # XXX is everything listed here needed?
     404    $run = ipp_cleanup.pl --stage detrend.process.imfile --stage_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --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 detCleanupProcessedImfile $options:0 $JOB_STATUS
     420  end
     421
     422  # operation timed out?
     423  task.exit    timeout
     424    showcommand timeout
     425    book setword detCleanupProcessedImfile $options:0 pantaskState TIMEOUT
     426  end
     427end
     428 
     429
     430######## cleanup process exp ########
     431task           detrend.cleanup.processexp.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.process.exp.log
     442
     443  task.exec
     444    if ($DB:n == 0)
     445      option DEFAULT
     446      command dettool -pendingcleanup_processedexp -limit 20
     447    else
     448      # save the DB name for the exit tasks
     449      option $DB:$detCleanupProcessedExp_DB
     450      command dettool -pendingcleanup_processedexp -limit 20 -dbname $DB:$detCleanupProcessedExp_DB
     451      $detCleanupProcessedExp_DB ++
     452      if ($detCleanupProcessedExp_DB >= $DB:n) set detCleanupProcessedExp_DB = 0
     453    end
     454  end
     455
     456  # success
     457  task.exit    0
     458    # convert 'stdout' to book format
     459    ipptool2book stdout detCleanupProcessedExp -key det_id:exp_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     460    if ($VERBOSE > 2)
     461      book listbook detCleanupProcessedExp
     462    end
     463
     464    # delete existing entries in the appropriate pantaskStates
     465    process_cleanup detCleanupProcessedExp
     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.processexp.run
     481  periods      -poll $RUNPOLL
     482  periods      -exec $RUNEXEC
     483  periods      -timeout 60
     484  active       true
     485
     486  task.exec
     487    book npages detCleanupProcessedExp -var N
     488    if ($N == 0) break
     489    if ($NETWORK == 0) break
     490   
     491    # look for new images in detCleanupProcessedExp (pantaskState == INIT)
     492    book getpage detCleanupProcessedExp 0 -var pageName -key pantaskState INIT
     493    if ("$pageName" == "NULL") break
     494
     495    book setword detCleanupProcessedExp $pageName pantaskState RUN
     496    book getword detCleanupProcessedExp $pageName det_id   -var DET_ID   
     497    book getword detCleanupProcessedExp $pageName exp_id   -var EXP_ID   
     498    book getword detCleanupProcessedExp $pageName camera -var CAMERA
     499    book getword detCleanupProcessedExp $pageName state -var CLEANUP_MODE
     500    book getword detCleanupProcessedExp $pageName dbname -var DBNAME
     501
     502    # specify choice of local or remote host based on camera and chip (class_id)
     503    set.host.for.camera $CAMERA FPA
     504
     505    stdout $LOGDIR/detrend.cleanup.process.exp.log
     506    stderr $LOGDIR/detrend.cleanup.process.exp.log
     507
     508    # XXX is everything listed here needed?
     509    $run = ipp_cleanup.pl --stage detrend.process.exp --stage_id $DET_ID --exp_id $EXP_ID --camera $CAMERA --mode $CLEANUP_MODE
     510    add_standard_args run
     511
     512    # save the pageName for future reference below
     513    options $pageName
     514
     515    # create the command line
     516    if ($VERBOSE > 1)
     517      echo command $run
     518    end
     519    command $run
     520  end
     521
     522  # default exit status
     523  task.exit    default
     524    process_exit detCleanupProcessedExp $options:0 $JOB_STATUS
     525  end
     526
     527  # operation timed out?
     528  task.exit    timeout
     529    showcommand timeout
     530    book setword detCleanupProcessedExp $options:0 pantaskState TIMEOUT
     531  end
     532end
Note: See TracChangeset for help on using the changeset viewer.