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/fake.pro

    r23282 r25027  
    77
    88book init fakePendingImfile
    9 book init fakePendingCleanup
    109
    1110macro fake.status
    1211  book listbook fakePendingImfile
    13   book listbook fakePendingCleanup
    1412end
    1513
    1614macro fake.reset
    1715  book init fakePendingImfile
    18   book init fakePendingCleanup
    1916end
    2017
     
    4340end
    4441
    45 macro fake.cleanup.on
    46   task fake.cleanup.load
    47     active true
    48   end
    49   task fake.cleanup.run
    50     active true
    51   end
    52 end
    53 
    54 macro fake.cleanup.off
    55   task fake.cleanup.load
    56     active false
    57   end
    58   task fake.cleanup.run
    59     active false
    60   end
    61 end
    62 
    6342# this variable will cycle through the known database names
    6443$fakeImfile_DB = 0
     44$fake_revert_DB = 0
    6545
    6646# select images ready for fake analysis
     
    7959
    8060  task.exec
     61    if ($LABEL:n == 0) break
    8162    $run = faketool -pendingimfile
    8263    if ($DB:n == 0)
     
    9071    end
    9172    add_poll_args run
     73    add_poll_labels run
    9274    command $run
    9375  end
     
    123105
    124106  task.exec
     107    # fake is fast, so generate a bunch of commands in a row
    125108    book npages fakePendingImfile -var N
    126     if ($N == 0) break
     109    if ($N == 0)
     110       periods -exec $RUNEXEC
     111       break
     112    end
     113    periods -exec 0.05
     114
    127115    if ($NETWORK == 0) break
    128116   
     
    198186  periods      -poll $LOADPOLL
    199187  periods      -exec $LOADEXEC
    200   periods      -timeout 30
     188  periods      -exec 30
     189  periods      -timeout 60
    201190  npending     1
    202191
     
    205194
    206195  task.exec
     196    if ($LABEL:n == 0) break
    207197    $run = faketool -advanceexp -limit 10
    208198    if ($DB:n == 0)
     
    216206    end
    217207    add_poll_args run
     208    add_poll_labels run
    218209    command $run
    219210  end
     
    238229end
    239230
    240 # this variable will cycle through the known database names
    241 $fake_cleanup_DB = 0
    242 
    243 # select images ready for fake analysis
    244 # new entries are added to fakePendingImfile
    245 # skip already-present entries
    246 task           fake.cleanup.load
     231task fake.revert
    247232  host         local
    248233
    249   periods      -poll $LOADPOLL
    250   periods      -exec $LOADEXEC
    251   periods      -timeout 30
     234  periods      -poll 5.0
     235  periods      -exec 60.0
     236  periods      -timeout 120.0
    252237  npending     1
    253   active       false
    254238
    255239  stdout NULL
    256   stderr $LOGDIR/fake.cleanup.log
    257 
    258   task.exec
    259     $run = faketool -pendingcleanuprun
     240  stderr $LOGDIR/revert.log
     241
     242  task.exec
     243    if ($LABEL:n == 0) break
     244    $run = faketool -revertprocessedimfile
    260245    if ($DB:n == 0)
    261246      option DEFAULT
    262       command
    263247    else
    264248      # save the DB name for the exit tasks
    265       option $DB:$fake_cleanup_DB
    266       $run = $run -dbname $DB:$fake_cleanup_DB
    267       $fake_cleanup_DB ++
    268       if ($fake_cleanup_DB >= $DB:n) set fake_cleanup_DB = 0
    269     end
    270     add_poll_args run
     249      option $DB:$fake_revert_DB
     250      $run = $run -dbname $DB:$fake_revert_DB
     251      $fake_revert_DB ++
     252      if ($fake_revert_DB >= $DB:n) set fake_revert_DB = 0
     253    end
     254    add_poll_labels run
    271255    command $run
    272256  end
     
    274258  # success
    275259  task.exit    0
    276     # convert 'stdout' to book format
    277     ipptool2book stdout fakePendingCleanup -key fake_id -uniq -setword dbname $options:0 -setword pantaskState INIT
    278     if ($VERBOSE > 2)
    279       book listbook fakePendingCleanup
    280     end
    281 
    282     # delete existing entries in the appropriate pantaskStates
    283     process_cleanup fakePendingCleanup
    284260  end
    285261
     
    298274  end
    299275end
    300 
    301 # run the ipp_cleanup.pl script on pending images
    302 task           fake.cleanup.run
    303   periods      -poll $RUNPOLL
    304   periods      -exec $RUNEXEC
    305   periods      -timeout 60
    306   active       false
    307 
    308   task.exec
    309     book npages fakePendingCleanup -var N
    310     if ($N == 0) break
    311     if ($NETWORK == 0) break
    312    
    313     # look for new images in fakePendingCleanup (pantaskState == INIT)
    314     book getpage fakePendingCleanup 0 -var pageName -key pantaskState INIT
    315     if ("$pageName" == "NULL") break
    316 
    317     book setword fakePendingCleanup $pageName pantaskState RUN
    318     book getword fakePendingCleanup $pageName camera -var CAMERA
    319     book getword fakePendingCleanup $pageName state -var CLEANUP_MODE
    320     book getword fakePendingCleanup $pageName fake_id -var FAKE_ID
    321     book getword fakePendingCleanup $pageName dbname -var DBNAME
    322 
    323     # specify choice of local or remote host based on camera and fake (class_id)
    324     set.host.for.camera $CAMERA FPA
    325 
    326     stdout $LOGDIR/fake.cleanup.log
    327     stderr $LOGDIR/fake.cleanup.log
    328 
    329     # XXX is everything listed here needed?
    330     $run = ipp_cleanup.pl --stage fake --stage_id $FAKE_ID --camera $CAMERA --mode $CLEANUP_MODE
    331     add_standard_args run
    332 
    333     # save the pageName for future reference below
    334     options $pageName
    335 
    336     # create the command line
    337     if ($VERBOSE > 1)
    338       echo command $run
    339     end
    340     command $run
    341   end
    342 
    343   # default exit status
    344   task.exit    default
    345     process_exit fakePendingCleanup $options:0 $JOB_STATUS
    346   end
    347 
    348   task.exit    crash
    349     showcommand crash
    350     book setword fakePendingCleanup $options:0 pantaskState CRASH
    351   end
    352 
    353   # operation timed out?
    354   task.exit    timeout
    355     showcommand timeout
    356     book setword fakePendingCleanup $options:0 pantaskState TIMEOUT
    357   end
    358 end
Note: See TracChangeset for help on using the changeset viewer.