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

    r18509 r18945  
    1616### Database lists
    1717$diffSkycell_DB = 0
     18$diffCleanup_DB = 0
    1819
    1920### Check status of diffing tasks
    2021macro diff.status
    2122  book listbook diffSkyfile
     23  book listbook diffCleanup
    2224end
    2325
     
    2527macro diff.reset
    2628  book init diffSkyfile
     29  book init diffCleanup
    2730end
    2831
     
    3538    active true
    3639  end
     40  task diff.cleanup.load
     41    active true
     42  end
     43  task diff.cleanup.run
     44    active true
     45  end
    3746end
    3847
     
    4352  end
    4453  task diff.skycell.run
     54    active false
     55  end
     56  task diff.cleanup.load
     57    active false
     58  end
     59  task diff.cleanup.run
    4560    active false
    4661  end
     
    167182end
    168183
     184# select images ready for diff analysis
     185# new entries are added to diffPendingImfile
     186# skip already-present entries
     187task           diff.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/diff.cleanup.log
     198
     199  task.exec
     200    if ($DB:n == 0)
     201      option DEFAULT
     202      command difftool -pendingcleanuprun -limit 20
     203    else
     204      # save the DB name for the exit tasks
     205      option $DB:$diff_cleanup_DB
     206      command difftool -pendingcleanuprun -limit 20 -dbname $DB:$diff_cleanup_DB
     207      $diff_cleanup_DB ++
     208      if ($diff_cleanup_DB >= $DB:n) set diff_cleanup_DB = 0
     209    end
     210  end
     211
     212  # success
     213  task.exit    0
     214    # convert 'stdout' to book format
     215    ipptool2book stdout diffPendingCleanup -key diff_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     216    if ($VERBOSE > 2)
     217      book listbook diffPendingCleanup
     218    end
     219
     220    # delete existing entries in the appropriate pantaskStates
     221    process_cleanup diffPendingCleanup
     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           diff.cleanup.run
     237  periods      -poll $RUNPOLL
     238  periods      -exec $RUNEXEC
     239  periods      -timeout 60
     240  active       true
     241
     242  task.exec
     243    book npages diffPendingCleanup -var N
     244    if ($N == 0) break
     245    if ($NETWORK == 0) break
     246   
     247    # look for new images in diffPendingCleanup (pantaskState == INIT)
     248    book getpage diffPendingCleanup 0 -var pageName -key pantaskState INIT
     249    if ("$pageName" == "NULL") break
     250
     251    book setword diffPendingCleanup $pageName pantaskState RUN
     252    book getword diffPendingCleanup $pageName camera -var CAMERA
     253    book getword diffPendingCleanup $pageName state -var CLEANUP_MODE
     254    book getword diffPendingCleanup $pageName diff_id -var DIFF_ID
     255    book getword diffPendingCleanup $pageName dbname -var DBNAME
     256
     257    # specify choice of local or remote host based on camera and diff (class_id)
     258    set.host.for.camera $CAMERA FPA
     259
     260    stdout $LOGDIR/diff.cleanup.log
     261    stderr $LOGDIR/diff.cleanup.log
     262
     263    # XXX is everything listed here needed?
     264    $run = ipp_cleanup.pl --stage diff --stage_id $DIFF_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 diffPendingCleanup $options:0 $JOB_STATUS
     280  end
     281
     282  # operation timed out?
     283  task.exit    timeout
     284    showcommand timeout
     285    book setword diffPendingCleanup $options:0 pantaskState TIMEOUT
     286  end
     287end
Note: See TracChangeset for help on using the changeset viewer.