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/detrend.stack.pro

    r18129 r19089  
    77
    88book init detPendingStackedImfile
     9book init detCleanupStackedImfile
    910
    1011macro detstack.reset
    1112  book init detPendingStackedImfile
     13  book init detCleanupStackedImfile
    1214end
    1315
     
    1517  echo detPendingStackedImfile
    1618  book listbook detPendingStackedImfile
     19  echo detCleanupStackedImfile
     20  book listbook detCleanupStackedImfile
    1721end
    1822
     
    2428    active true
    2529  end
     30  task detrend.cleanup.stack.load
     31    active true
     32  end
     33  task detrend.cleanup.stack.run
     34    active true
     35  end
    2636end
    2737
     
    3343    active false
    3444  end
     45  task detrend.cleanup.stack.load
     46    active false
     47  end
     48  task detrend.cleanup.stack.run
     49    active false
     50  end
    3551end
    3652
    3753# this variable will cycle through the known database names
    3854$detPendingStackedImfile_DB = 0
     55$detCleanupStackedImfile_DB = 0
    3956
    4057# select images ready for detrend_stack.pl
     
    5067
    5168  stdout NULL
    52   stderr $LOGDIR/detrend.stack.load.log
     69  stderr $LOGDIR/detrend.stack.log
    5370
    5471  task.exec
     
    122139    sprintf outroot "%s/%s.%s.%s/%s.%s.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID $ITERATION
    123140
    124     stdout $LOGDIR/detrend.stack.run.log
    125     stderr $LOGDIR/detrend.stack.run.log
    126 
    127     $run = detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA --outroot $outroot --redirect-output --verbose
     141    stdout $LOGDIR/detrend.stack.log
     142    stderr $LOGDIR/detrend.stack.log
     143
     144    $run = detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA --outroot $outroot --redirect-output
    128145    if ("$REDUCTION" != "NULL")
    129146      $run = $run --reduction $REDUCTION
     
    152169  end
    153170end
     171
     172########## cleanup stack ###########
     173task           detrend.cleanup.stack.load
     174  host         local
     175
     176  periods      -poll $LOADPOLL
     177  periods      -exec $LOADEXEC
     178  periods      -timeout 30
     179  npending     1
     180  active       true
     181
     182  stdout NULL
     183  stderr $LOGDIR/detrend.cleanup.stack.log
     184
     185  task.exec
     186    if ($DB:n == 0)
     187      option DEFAULT
     188      command dettool -pendingcleanup_stacked -limit 20
     189    else
     190      # save the DB name for the exit tasks
     191      option $DB:$detCleanupStackedImfile_DB
     192      command dettool -pendingcleanup_stacked -limit 20 -dbname $DB:$detCleanupStackedImfile_DB
     193      $detCleanupStackedImfile_DB ++
     194      if ($detCleanupStackedImfile_DB >= $DB:n) set detCleanupStackedImfile_DB = 0
     195    end
     196  end
     197
     198  # success
     199  task.exit    0
     200    # convert 'stdout' to book format
     201    ipptool2book stdout detCleanupStackedImfile -key det_id:iteration:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     202    if ($VERBOSE > 2)
     203      book listbook detCleanupStackedImfile
     204    end
     205
     206    # delete existing entries in the appropriate pantaskStates
     207    process_cleanup detCleanupStackedImfile
     208  end
     209
     210  # locked list
     211  task.exit    default
     212    showcommand failure
     213  end
     214
     215  # operation times out?
     216  task.exit    timeout
     217    showcommand timeout
     218  end
     219end
     220
     221# run the ipp_cleanup.pl script on pending images
     222task           detrend.cleanup.stack.run
     223  periods      -poll $RUNPOLL
     224  periods      -exec $RUNEXEC
     225  periods      -timeout 60
     226  active       true
     227
     228  task.exec
     229    book npages detCleanupStackedImfile -var N
     230    if ($N == 0) break
     231    if ($NETWORK == 0) break
     232   
     233    # look for new images in detCleanupStackedImfile (pantaskState == INIT)
     234    book getpage detCleanupStackedImfile 0 -var pageName -key pantaskState INIT
     235    if ("$pageName" == "NULL") break
     236
     237    book setword detCleanupStackedImfile $pageName pantaskState RUN
     238    book getword detCleanupStackedImfile $pageName det_id   -var DET_ID   
     239    book getword detCleanupStackedImfile $pageName iteration -var ITERATION
     240    book getword detCleanupStackedImfile $pageName class_id -var CLASS_ID
     241    book getword detCleanupStackedImfile $pageName camera -var CAMERA
     242    book getword detCleanupStackedImfile $pageName state -var CLEANUP_MODE
     243    book getword detCleanupStackedImfile $pageName dbname -var DBNAME
     244
     245    # specify choice of local or remote host based on camera and chip (class_id)
     246    set.host.for.camera $CAMERA FPA
     247
     248    stdout $LOGDIR/detrend.cleanup.stack.log
     249    stderr $LOGDIR/detrend.cleanup.stack.log
     250
     251    # XXX is everything listed here needed?
     252    $run = ipp_cleanup.pl --stage detrend.stack.imfile --stage_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --camera $CAMERA --mode $CLEANUP_MODE
     253    add_standard_args run
     254
     255    # save the pageName for future reference below
     256    options $pageName
     257
     258    # create the command line
     259    if ($VERBOSE > 1)
     260      echo command $run
     261    end
     262    command $run
     263  end
     264
     265  # default exit status
     266  task.exit    default
     267    process_exit detCleanupStackedImfile $options:0 $JOB_STATUS
     268  end
     269
     270  # operation timed out?
     271  task.exit    timeout
     272    showcommand timeout
     273    book setword detCleanupStackedImfile $options:0 pantaskState TIMEOUT
     274  end
     275end
     276 
Note: See TracChangeset for help on using the changeset viewer.