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

    r18509 r19089  
    88check.globals
    99
    10 $LOGSUBDIR = $LOGDIR/diff
    11 exec mkdir -p $LOGSUBDIR
    12 
    1310### Initialise the books containing the tasks to do
    1411book init diffSkyfile
     12book init diffCleanup
    1513
    1614### Database lists
    1715$diffSkycell_DB = 0
     16$diffCleanup_DB = 0
    1817
    1918### Check status of diffing tasks
    2019macro diff.status
    2120  book listbook diffSkyfile
     21  book listbook diffCleanup
    2222end
    2323
     
    2525macro diff.reset
    2626  book init diffSkyfile
     27  book init diffCleanup
    2728end
    2829
     
    3536    active true
    3637  end
     38  task diff.cleanup.load
     39    active true
     40  end
     41  task diff.cleanup.run
     42    active true
     43  end
    3744end
    3845
     
    4350  end
    4451  task diff.skycell.run
     52    active false
     53  end
     54  task diff.cleanup.load
     55    active false
     56  end
     57  task diff.cleanup.run
    4558    active false
    4659  end
     
    5972
    6073  stdout NULL
    61   stderr $LOGSUBDIR/diff.skycell.log
     74  stderr $LOGDIR/diff.skycell.log
    6275
    6376  task.exec
     
    122135
    123136    ### XXX Instead of setting these by camera, need to set by skycell_id
     137    ### XXX change these to use the --redirect scheme
    124138#    set.host.for.camera $CAMERA $DIFF_ID
    125139#    set.workdir.by.camera $CAMERA $DIFF_ID $WORKDIR_TEMPLATE $default_host WORKDIR
     
    167181end
    168182
     183# select images ready for diff analysis
     184# new entries are added to diffPendingImfile
     185# skip already-present entries
     186task           diff.cleanup.load
     187  host         local
     188
     189  periods      -poll $LOADPOLL
     190  periods      -exec $LOADEXEC
     191  periods      -timeout 30
     192  npending     1
     193  active       true
     194
     195  stdout NULL
     196  stderr $LOGDIR/diff.cleanup.log
     197
     198  task.exec
     199    if ($DB:n == 0)
     200      option DEFAULT
     201      command difftool -pendingcleanuprun -limit 20
     202    else
     203      # save the DB name for the exit tasks
     204      option $DB:$diffCleanup_DB
     205      command difftool -pendingcleanuprun -limit 20 -dbname $DB:$diffCleanup_DB
     206      $diffCleanup_DB ++
     207      if ($diffCleanup_DB >= $DB:n) set diffCleanup_DB = 0
     208    end
     209  end
     210
     211  # success
     212  task.exit    0
     213    # convert 'stdout' to book format
     214    ipptool2book stdout diffCleanup -key diff_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     215    if ($VERBOSE > 2)
     216      book listbook diffCleanup
     217    end
     218
     219    # delete existing entries in the appropriate pantaskStates
     220    process_cleanup diffCleanup
     221  end
     222
     223  # locked list
     224  task.exit    default
     225    showcommand failure
     226  end
     227
     228  # operation times out?
     229  task.exit    timeout
     230    showcommand timeout
     231  end
     232end
     233
     234# run the ipp_cleanup.pl script on pending images
     235task           diff.cleanup.run
     236  periods      -poll $RUNPOLL
     237  periods      -exec $RUNEXEC
     238  periods      -timeout 60
     239  active       true
     240
     241  task.exec
     242    book npages diffCleanup -var N
     243    if ($N == 0) break
     244    if ($NETWORK == 0) break
     245   
     246    # look for new images in diffCleanup (pantaskState == INIT)
     247    book getpage diffCleanup 0 -var pageName -key pantaskState INIT
     248    if ("$pageName" == "NULL") break
     249
     250    book setword diffCleanup $pageName pantaskState RUN
     251    book getword diffCleanup $pageName camera -var CAMERA
     252    book getword diffCleanup $pageName state -var CLEANUP_MODE
     253    book getword diffCleanup $pageName diff_id -var DIFF_ID
     254    book getword diffCleanup $pageName dbname -var DBNAME
     255
     256    # specify choice of local or remote host based on camera and diff (class_id)
     257    set.host.for.camera $CAMERA FPA
     258
     259    stdout $LOGDIR/diff.cleanup.log
     260    stderr $LOGDIR/diff.cleanup.log
     261
     262    # XXX is everything listed here needed?
     263    $run = ipp_cleanup.pl --stage diff --stage_id $DIFF_ID --camera $CAMERA --mode $CLEANUP_MODE
     264    add_standard_args run
     265
     266    # save the pageName for future reference below
     267    options $pageName
     268
     269    # create the command line
     270    if ($VERBOSE > 1)
     271      echo command $run
     272    end
     273    command $run
     274  end
     275
     276  # default exit status
     277  task.exit    default
     278    process_exit diffCleanup $options:0 $JOB_STATUS
     279  end
     280
     281  # operation timed out?
     282  task.exit    timeout
     283    showcommand timeout
     284    book setword diffCleanup $options:0 pantaskState TIMEOUT
     285  end
     286end
Note: See TracChangeset for help on using the changeset viewer.