IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

adding cleanup tasks to science stages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080806/ippTasks/stack.pro

    r18488 r18945  
    1313### Initialise the books containing the tasks to do
    1414book init stackSumSkyfile
     15book init stackCleanup
    1516
    1617### Database lists
    1718$stackSkycell_DB = 0
     19$stackCleanup_DB = 0
    1820
    1921### Check status of stacking tasks
    2022macro stack.status
    2123  book listbook stackSumSkyfile
     24  book listbook stackCleanup
    2225end
    2326
     
    2528macro stack.reset
    2629  book init stackSumSkyfile
     30  book init stackCleanup
    2731end
    2832
     
    3539    active true
    3640  end
     41  task stack.cleanup.load
     42    active true
     43  end
     44  task stack.cleanup.run
     45    active true
     46  end
    3747end
    3848
     
    4353  end
    4454  task stack.skycell.run
     55    active false
     56  end
     57  task stack.cleanup.load
     58    active false
     59  end
     60  task stack.cleanup.run
    4561    active false
    4662  end
     
    168184end
    169185
     186
     187# select images ready for stack analysis
     188# new entries are added to stackCleanup
     189# skip already-present entries
     190task           stack.cleanup.load
     191  host         local
     192
     193  periods      -poll $LOADPOLL
     194  periods      -exec $LOADEXEC
     195  periods      -timeout 30
     196  npending     1
     197  active       true
     198
     199  stdout NULL
     200  stderr $LOGDIR/stack.cleanup.log
     201
     202  task.exec
     203    if ($DB:n == 0)
     204      option DEFAULT
     205      command stacktool -pendingcleanuprun -limit 20
     206    else
     207      # save the DB name for the exit tasks
     208      option $DB:$stack_cleanup_DB
     209      command stacktool -pendingcleanuprun -limit 20 -dbname $DB:$stack_cleanup_DB
     210      $stack_cleanup_DB ++
     211      if ($stack_cleanup_DB >= $DB:n) set stack_cleanup_DB = 0
     212    end
     213  end
     214
     215  # success
     216  task.exit    0
     217    # convert 'stdout' to book format
     218    ipptool2book stdout stackCleanup -key stack_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     219    if ($VERBOSE > 2)
     220      book listbook stackCleanup
     221    end
     222
     223    # delete existing entries in the appropriate pantaskStates
     224    process_cleanup stackCleanup
     225  end
     226
     227  # locked list
     228  task.exit    default
     229    showcommand failure
     230  end
     231
     232  # operation times out?
     233  task.exit    timeout
     234    showcommand timeout
     235  end
     236end
     237
     238# run the ipp_cleanup.pl script on pending images
     239task           stack.cleanup.run
     240  periods      -poll $RUNPOLL
     241  periods      -exec $RUNEXEC
     242  periods      -timeout 60
     243  active       true
     244
     245  task.exec
     246    book npages stackCleanup -var N
     247    if ($N == 0) break
     248    if ($NETWORK == 0) break
     249   
     250    # look for new images in stackCleanup (pantaskState == INIT)
     251    book getpage stackCleanup 0 -var pageName -key pantaskState INIT
     252    if ("$pageName" == "NULL") break
     253
     254    book setword stackCleanup $pageName pantaskState RUN
     255    book getword stackCleanup $pageName camera -var CAMERA
     256    book getword stackCleanup $pageName state -var CLEANUP_MODE
     257    book getword stackCleanup $pageName stack_id -var STACK_ID
     258    book getword stackCleanup $pageName dbname -var DBNAME
     259
     260    # specify choice of local or remote host based on camera and stack (class_id)
     261    set.host.for.camera $CAMERA FPA
     262
     263    stdout $LOGDIR/stack.cleanup.log
     264    stderr $LOGDIR/stack.cleanup.log
     265
     266    # XXX is everything listed here needed?
     267    $run = ipp_cleanup.pl --stage stack --stage_id $STACK_ID --camera $CAMERA --mode $CLEANUP_MODE
     268    add_standard_args run
     269
     270    # save the pageName for future reference below
     271    options $pageName
     272
     273    # create the command line
     274    if ($VERBOSE > 1)
     275      echo command $run
     276    end
     277    command $run
     278  end
     279
     280  # default exit status
     281  task.exit    default
     282    process_exit stackCleanup $options:0 $JOB_STATUS
     283  end
     284
     285  # operation timed out?
     286  task.exit    timeout
     287    showcommand timeout
     288    book setword stackCleanup $options:0 pantaskState TIMEOUT
     289  end
     290end
Note: See TracChangeset for help on using the changeset viewer.