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

    r18794 r19090  
    77
    88book init fakePendingImfile
     9book init fakePendingCleanup
    910
    1011macro fake.status
    1112  book listbook fakePendingImfile
     13  book listbook fakePendingCleanup
    1214end
    1315
    1416macro fake.reset
    1517  book init fakePendingImfile
     18  book init fakePendingCleanup
    1619end
    1720
     
    2326    active true
    2427  end
     28  task fake.cleanup.load
     29    active false
     30  end
     31  task fake.cleanup.run
     32    active false
     33  end
    2534end
    2635
     
    3039  end
    3140  task fake.imfile.run
     41    active false
     42  end
     43  task fake.cleanup.load
     44    active false
     45  end
     46  task fake.cleanup.run
    3247    active false
    3348  end
     
    154169end
    155170
    156 
     171# this variable will cycle through the known database names
     172$fake_cleanup_DB = 0
     173
     174# select images ready for fake analysis
     175# new entries are added to fakePendingImfile
     176# skip already-present entries
     177task           fake.cleanup.load
     178  host         local
     179
     180  periods      -poll $LOADPOLL
     181  periods      -exec $LOADEXEC
     182  periods      -timeout 30
     183  npending     1
     184  active       true
     185
     186  stdout NULL
     187  stderr $LOGDIR/fake.cleanup.log
     188
     189  task.exec
     190    if ($DB:n == 0)
     191      option DEFAULT
     192      command faketool -pendingcleanuprun -limit 20
     193    else
     194      # save the DB name for the exit tasks
     195      option $DB:$fake_cleanup_DB
     196      command faketool -pendingcleanuprun -limit 20 -dbname $DB:$fake_cleanup_DB
     197      $fake_cleanup_DB ++
     198      if ($fake_cleanup_DB >= $DB:n) set fake_cleanup_DB = 0
     199    end
     200  end
     201
     202  # success
     203  task.exit    0
     204    # convert 'stdout' to book format
     205    ipptool2book stdout fakePendingCleanup -key fake_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     206    if ($VERBOSE > 2)
     207      book listbook fakePendingCleanup
     208    end
     209
     210    # delete existing entries in the appropriate pantaskStates
     211    process_cleanup fakePendingCleanup
     212  end
     213
     214  # locked list
     215  task.exit    default
     216    showcommand failure
     217  end
     218
     219  # operation times out?
     220  task.exit    timeout
     221    showcommand timeout
     222  end
     223end
     224
     225# run the ipp_cleanup.pl script on pending images
     226task           fake.cleanup.run
     227  periods      -poll $RUNPOLL
     228  periods      -exec $RUNEXEC
     229  periods      -timeout 60
     230  active       true
     231
     232  task.exec
     233    book npages fakePendingCleanup -var N
     234    if ($N == 0) break
     235    if ($NETWORK == 0) break
     236   
     237    # look for new images in fakePendingCleanup (pantaskState == INIT)
     238    book getpage fakePendingCleanup 0 -var pageName -key pantaskState INIT
     239    if ("$pageName" == "NULL") break
     240
     241    book setword fakePendingCleanup $pageName pantaskState RUN
     242    book getword fakePendingCleanup $pageName camera -var CAMERA
     243    book getword fakePendingCleanup $pageName state -var CLEANUP_MODE
     244    book getword fakePendingCleanup $pageName fake_id -var FAKE_ID
     245    book getword fakePendingCleanup $pageName dbname -var DBNAME
     246
     247    # specify choice of local or remote host based on camera and fake (class_id)
     248    set.host.for.camera $CAMERA FPA
     249
     250    stdout $LOGDIR/fake.cleanup.log
     251    stderr $LOGDIR/fake.cleanup.log
     252
     253    # XXX is everything listed here needed?
     254    $run = ipp_cleanup.pl --stage fake --stage_id $FAKE_ID --camera $CAMERA --mode $CLEANUP_MODE
     255    add_standard_args run
     256
     257    # save the pageName for future reference below
     258    options $pageName
     259
     260    # create the command line
     261    if ($VERBOSE > 1)
     262      echo command $run
     263    end
     264    command $run
     265  end
     266
     267  # default exit status
     268  task.exit    default
     269    process_exit fakePendingCleanup $options:0 $JOB_STATUS
     270  end
     271
     272  # operation timed out?
     273  task.exit    timeout
     274    showcommand timeout
     275    book setword fakePendingCleanup $options:0 pantaskState TIMEOUT
     276  end
     277end
Note: See TracChangeset for help on using the changeset viewer.