IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 4:08:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging trunk (r25026) to get up-to-date on old branch.

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/ippTasks/chip.pro

    r23945 r25027  
    33## these tasks use the book chipPendingImfile
    44
    5 ## XXX the cleanup stage probably needs to mimic the chip processing stages, with an exposure and imfile layer
    6 ## can we define the cleanup stages in a separate file derived from this file?
    7 
    85# test for required global variables
    96check.globals
    107
    118book init chipPendingImfile
    12 book init chipPendingCleanup
    139
    1410macro chip.status
    1511  book listbook chipPendingImfile
    16   book listbook chipPendingCleanup
    1712end
    1813
    1914macro chip.reset
    2015  book init chipPendingImfile
    21   book init chipPendingCleanup
    2216end
    2317
     
    4640end
    4741
    48 macro chip.cleanup.on
    49   task chip.cleanup.load
    50     active true
    51   end
    52   task chip.cleanup.run
    53     active true
    54   end
    55 end
    56 
    57 macro chip.cleanup.off
    58   task chip.cleanup.load
    59     active false
    60   end
    61   task chip.cleanup.run
    62     active false
    63   end
    64 end
    65 
    6642# this variable will cycle through the known database names
    6743$chip_DB = 0
     44$chip_revert_DB = 0
    6845
    6946# select images ready for chip analysis
     
    8259
    8360  task.exec
     61    if ($LABEL:n == 0) break
    8462    $run = chiptool -pendingimfile
    8563    if ($DB:n == 0)
     
    9371    end
    9472    add_poll_args run
     73    add_poll_labels run
    9574    command $run
    9675  end
     
    207186
    208187    # Set a fault code in the database
    209     !chiptool -addprocessedimfile -dbname $DBNAME -chip_id $CHIP_ID -class_id $CLASS_ID -fault $EXIT_CRASH_ERR
     188    exec chiptool -addprocessedimfile -dbname $DBNAME -chip_id $CHIP_ID -class_id $CLASS_ID -fault $EXIT_CRASH_ERR
    210189    process_exit chipPendingImfile $options:0 $EXIT_CRASH_ERR
    211190  end
     
    227206
    228207  periods      -poll $LOADPOLL
    229   periods      -exec $LOADEXEC
    230   periods      -timeout 30
     208#  periods      -exec $LOADEXEC
     209  periods      -exec 30
     210  periods      -timeout 60
    231211  npending     1
    232212
     
    235215
    236216  task.exec
     217    if ($LABEL:n == 0) break
    237218    $run = chiptool -advanceexp -limit 10
    238219    if ($DB:n == 0)
     
    246227    end
    247228    add_poll_args run
     229    add_poll_labels run
    248230    command $run
    249231  end
     
    268250end
    269251
    270 # this variable will cycle through the known database names
    271 $chip_cleanup_DB = 0
    272 
    273 # select images ready for chip analysis
    274 # new entries are added to chipPendingImfile
    275 # skip already-present entries
    276 task           chip.cleanup.load
     252task chip.revert
    277253  host         local
    278254
    279   periods      -poll $LOADPOLL
    280   periods      -exec $LOADEXEC
    281   periods      -timeout 30
     255  periods      -poll 5.0
     256  periods      -exec 60.0
     257  periods      -timeout 120.0
    282258  npending     1
    283   active       false
    284259
    285260  stdout NULL
    286   stderr $LOGDIR/chip.cleanup.log
    287 
    288   task.exec
    289     $run = chiptool -pendingcleanuprun
     261  stderr $LOGDIR/revert.log
     262
     263  task.exec
     264    if ($LABEL:n == 0) break
     265    $run = chiptool -revertprocessedimfile
    290266    if ($DB:n == 0)
    291267      option DEFAULT
    292268    else
    293269      # save the DB name for the exit tasks
    294       option $DB:$chip_cleanup_DB
    295       $run = $run -dbname $DB:$chip_cleanup_DB
    296       $chip_cleanup_DB ++
    297       if ($chip_cleanup_DB >= $DB:n) set chip_cleanup_DB = 0
    298     end
    299     add_poll_args run
     270      option $DB:$chip_revert_DB
     271      $run = $run -dbname $DB:$chip_revert_DB
     272      $chip_revert_DB ++
     273      if ($chip_revert_DB >= $DB:n) set chip_revert_DB = 0
     274    end
     275    add_poll_labels run
    300276    command $run
    301277  end
     
    303279  # success
    304280  task.exit    0
    305     # convert 'stdout' to book format
    306     ipptool2book stdout chipPendingCleanup -key chip_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    307     if ($VERBOSE > 2)
    308       book listbook chipPendingCleanup
    309     end
    310 
    311     # delete existing entries in the appropriate pantaskStates
    312     process_cleanup chipPendingCleanup
    313281  end
    314282
     
    327295  end
    328296end
    329 
    330 # run the ipp_cleanup.pl script on pending images
    331 task           chip.cleanup.run
    332   periods      -poll $RUNPOLL
    333   periods      -exec $RUNEXEC
    334   periods      -timeout 60
    335   active       false
    336 
    337   task.exec
    338     book npages chipPendingCleanup -var N
    339     if ($N == 0) break
    340     if ($NETWORK == 0) break
    341    
    342     # look for new images in chipPendingCleanup (pantaskState == INIT)
    343     book getpage chipPendingCleanup 0 -var pageName -key pantaskState INIT
    344     if ("$pageName" == "NULL") break
    345 
    346     book setword chipPendingCleanup $pageName pantaskState RUN
    347     book getword chipPendingCleanup $pageName camera -var CAMERA
    348     book getword chipPendingCleanup $pageName state -var CLEANUP_MODE
    349     book getword chipPendingCleanup $pageName chip_id -var CHIP_ID
    350     book getword chipPendingCleanup $pageName dbname -var DBNAME
    351 
    352     # specify choice of local or remote host based on camera and chip (class_id)
    353     set.host.for.camera $CAMERA FPA
    354 
    355     stdout $LOGDIR/chip.cleanup.log
    356     stderr $LOGDIR/chip.cleanup.log
    357 
    358     # XXX is everything listed here needed?
    359     $run = ipp_cleanup.pl --stage chip --stage_id $CHIP_ID --camera $CAMERA --mode $CLEANUP_MODE
    360     add_standard_args run
    361 
    362     # save the pageName for future reference below
    363     options $pageName
    364 
    365     # create the command line
    366     if ($VERBOSE > 1)
    367       echo command $run
    368     end
    369     command $run
    370   end
    371 
    372   # default exit status
    373   task.exit    default
    374     process_exit chipPendingCleanup $options:0 $JOB_STATUS
    375   end
    376 
    377   task.exit    crash
    378     showcommand crash
    379     book setword chipPendingCleanup $options:0 pantaskState CRASH
    380   end
    381 
    382   # operation timed out?
    383   task.exit    timeout
    384     showcommand timeout
    385     book setword chipPendingCleanup $options:0 pantaskState TIMEOUT
    386   end
    387 end
Note: See TracChangeset for help on using the changeset viewer.