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

    r18916 r19090  
    1212book init warpInputExp
    1313book init warpPendingSkyCell
     14book init warpPendingCleanup
    1415
    1516### Database lists
    1617$warpExp_DB = 0
    1718$warpSkycell_DB = 0
     19$warpCleanup_DB = 0
    1820
    1921### Check status of warping tasks
     
    2123  book listbook warpInputExp
    2224  book listbook warpPendingSkyCell
     25  book listbook warpPendingCleanup
    2326end
    2427
     
    2730  book init warpInputExp
    2831  book init warpPendingSkyCell
     32  book init warpPendingCleanup
    2933end
    3034
     
    4347    active true
    4448  end
     49  task warp.cleanup.load
     50    active true
     51  end
     52  task warp.cleanup.run
     53    active true
     54  end
    4555end
    4656
     
    5767  end
    5868  task warp.skycell.run
     69    active false
     70  end
     71  task warp.cleanup.load
     72    active false
     73  end
     74  task warp.cleanup.run
    5975    active false
    6076  end
     
    283299end
    284300
     301# select images ready for warp analysis
     302# new entries are added to warpPendingImfile
     303# skip already-present entries
     304task           warp.cleanup.load
     305  host         local
     306
     307  periods      -poll $LOADPOLL
     308  periods      -exec $LOADEXEC
     309  periods      -timeout 30
     310  npending     1
     311  active       true
     312
     313  stdout NULL
     314  stderr $LOGDIR/warp.cleanup.log
     315
     316  task.exec
     317    if ($DB:n == 0)
     318      option DEFAULT
     319      command warptool -pendingcleanuprun -limit 20
     320    else
     321      # save the DB name for the exit tasks
     322      option $DB:$warpCleanup_DB
     323      command warptool -pendingcleanuprun -limit 20 -dbname $DB:$warpCleanup_DB
     324      $warpCleanup_DB ++
     325      if ($warpCleanup_DB >= $DB:n) set warpCleanup_DB = 0
     326    end
     327  end
     328
     329  # success
     330  task.exit    0
     331    # convert 'stdout' to book format
     332    ipptool2book stdout warpPendingCleanup -key warp_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     333    if ($VERBOSE > 2)
     334      book listbook warpPendingCleanup
     335    end
     336
     337    # delete existing entries in the appropriate pantaskStates
     338    process_cleanup warpPendingCleanup
     339  end
     340
     341  # locked list
     342  task.exit    default
     343    showcommand failure
     344  end
     345
     346  # operation times out?
     347  task.exit    timeout
     348    showcommand timeout
     349  end
     350end
     351
     352# run the ipp_cleanup.pl script on pending images
     353task           warp.cleanup.run
     354  periods      -poll $RUNPOLL
     355  periods      -exec $RUNEXEC
     356  periods      -timeout 60
     357  active       true
     358
     359  task.exec
     360    book npages warpPendingCleanup -var N
     361    if ($N == 0) break
     362    if ($NETWORK == 0) break
     363   
     364    # look for new images in warpPendingCleanup (pantaskState == INIT)
     365    book getpage warpPendingCleanup 0 -var pageName -key pantaskState INIT
     366    if ("$pageName" == "NULL") break
     367
     368    book setword warpPendingCleanup $pageName pantaskState RUN
     369    book getword warpPendingCleanup $pageName camera -var CAMERA
     370    book getword warpPendingCleanup $pageName state -var CLEANUP_MODE
     371    book getword warpPendingCleanup $pageName warp_id -var WARP_ID
     372    book getword warpPendingCleanup $pageName dbname -var DBNAME
     373
     374    # specify choice of local or remote host based on camera and warp (class_id)
     375    set.host.for.camera $CAMERA FPA
     376
     377    stdout $LOGDIR/warp.cleanup.log
     378    stderr $LOGDIR/warp.cleanup.log
     379
     380    # XXX is everything listed here needed?
     381    $run = ipp_cleanup.pl --stage warp --stage_id $WARP_ID --camera $CAMERA --mode $CLEANUP_MODE
     382    add_standard_args run
     383
     384    # save the pageName for future reference below
     385    options $pageName
     386
     387    # create the command line
     388    if ($VERBOSE > 1)
     389      echo command $run
     390    end
     391    command $run
     392  end
     393
     394  # default exit status
     395  task.exit    default
     396    process_exit warpPendingCleanup $options:0 $JOB_STATUS
     397  end
     398
     399  # operation timed out?
     400  task.exit    timeout
     401    showcommand timeout
     402    book setword warpPendingCleanup $options:0 pantaskState TIMEOUT
     403  end
     404end
Note: See TracChangeset for help on using the changeset viewer.