IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 16, 2008, 1:06:59 PM (18 years ago)
Author:
eugene
Message:

adding cleanup stages; tidy logfile names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/stack.pro

    r18488 r19089  
    88check.globals
    99
    10 $LOGSUBDIR = $LOGDIR/stack
    11 exec mkdir -p $LOGSUBDIR
    12 
    1310### Initialise the books containing the tasks to do
    1411book init stackSumSkyfile
     12book init stackCleanup
    1513
    1614### Database lists
    1715$stackSkycell_DB = 0
     16$stackCleanup_DB = 0
    1817
    1918### Check status of stacking tasks
    2019macro stack.status
    2120  book listbook stackSumSkyfile
     21  book listbook stackCleanup
    2222end
    2323
     
    2525macro stack.reset
    2626  book init stackSumSkyfile
     27  book init stackCleanup
    2728end
    2829
     
    3536    active true
    3637  end
     38  task stack.cleanup.load
     39    active true
     40  end
     41  task stack.cleanup.run
     42    active true
     43  end
    3744end
    3845
     
    4350  end
    4451  task stack.skycell.run
     52    active false
     53  end
     54  task stack.cleanup.load
     55    active false
     56  end
     57  task stack.cleanup.run
    4558    active false
    4659  end
     
    5972
    6073  stdout NULL
    61   stderr $LOGSUBDIR/stack.skycell.log
     74  stderr $LOGDIR/stack.skycell.log
    6275
    6376  task.exec
     
    168181end
    169182
     183
     184# select images ready for stack analysis
     185# new entries are added to stackCleanup
     186# skip already-present entries
     187task           stack.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/stack.cleanup.log
     198
     199  task.exec
     200    if ($DB:n == 0)
     201      option DEFAULT
     202      command stacktool -pendingcleanuprun -limit 20
     203    else
     204      # save the DB name for the exit tasks
     205      option $DB:$stackCleanup_DB
     206      command stacktool -pendingcleanuprun -limit 20 -dbname $DB:$stackCleanup_DB
     207      $stackCleanup_DB ++
     208      if ($stackCleanup_DB >= $DB:n) set stackCleanup_DB = 0
     209    end
     210  end
     211
     212  # success
     213  task.exit    0
     214    # convert 'stdout' to book format
     215    ipptool2book stdout stackCleanup -key stack_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     216    if ($VERBOSE > 2)
     217      book listbook stackCleanup
     218    end
     219
     220    # delete existing entries in the appropriate pantaskStates
     221    process_cleanup stackCleanup
     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           stack.cleanup.run
     237  periods      -poll $RUNPOLL
     238  periods      -exec $RUNEXEC
     239  periods      -timeout 60
     240  active       true
     241
     242  task.exec
     243    book npages stackCleanup -var N
     244    if ($N == 0) break
     245    if ($NETWORK == 0) break
     246   
     247    # look for new images in stackCleanup (pantaskState == INIT)
     248    book getpage stackCleanup 0 -var pageName -key pantaskState INIT
     249    if ("$pageName" == "NULL") break
     250
     251    book setword stackCleanup $pageName pantaskState RUN
     252    book getword stackCleanup $pageName camera -var CAMERA
     253    book getword stackCleanup $pageName state -var CLEANUP_MODE
     254    book getword stackCleanup $pageName stack_id -var STACK_ID
     255    book getword stackCleanup $pageName dbname -var DBNAME
     256
     257    # specify choice of local or remote host based on camera and stack (class_id)
     258    set.host.for.camera $CAMERA FPA
     259
     260    stdout $LOGDIR/stack.cleanup.log
     261    stderr $LOGDIR/stack.cleanup.log
     262
     263    # XXX is everything listed here needed?
     264    $run = ipp_cleanup.pl --stage stack --stage_id $STACK_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 stackCleanup $options:0 $JOB_STATUS
     280  end
     281
     282  # operation timed out?
     283  task.exit    timeout
     284    showcommand timeout
     285    book setword stackCleanup $options:0 pantaskState TIMEOUT
     286  end
     287end
Note: See TracChangeset for help on using the changeset viewer.