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

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