IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 10, 2007, 12:12:35 PM (20 years ago)
Author:
eugene
Message:

first pass on convering queues to books

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_00/ippTasks/detrend.stack.pro

    r10745 r11011  
    11## this file contains the tasks for running the detrend stacking stage
    22
    3 # get a list of imfiles to stack
    4 # dettool -tostack -simple
    5 # 1 0 bias mc
    6 # DET_ID ITER TYPE CLASS_ID
    7 
    8 # function to stack the imfiles:
    9 # detrend_stack.pl 1 0 mc bias
    10 
    11 ## these tasks use the queue DetrendStackClass
    12 ## the DetrendStackClass queue contains:
    13 ## STATE DET_ID ITER TYPE CLASS_ID CAMERA
    14 
    15 queueinit DetrendStackClass
    163if ($?network == 0)
    174  $network = 1
     
    207  $parallel = 0
    218end
    22 
    23 $DetrendStackClassFail = 0
    24 
    259if ($?VERBOSE == 0)
    2610  echo "VERBOSE not defined: load pantasks.pro first"
     
    3115  break
    3216end
     17
    3318$LOGSUBDIR = $LOGDIR/detrend
    3419exec mkdir -p $LOGSUBDIR
     20
     21book init DetrendStackClass
    3522
    3623macro detstack.status
     
    3926end
    4027
    41 # select images ready for copy
    42 # new entries are added to queue DetrendStackClass
     28# select images ready for detrend_stack.pl
     29# new entries are added to DetrendStackClass
    4330# compare the new list with the ones already selected
    4431task           dettool.stack.load
     
    5340
    5441  task.exec
    55     command dettool -tostacked -simple -limit {$DetrendStackClassFail + 20}
     42    command dettool -tostacked -limit 20
    5643  end
    5744
    5845  # success
    5946  task.exit    0
    60     local i Nqueue
    61 
    62     # compare output with newImage queue
    63     # only add entries which do not exist in queue
    64     queuesize stdout -var Nqueue
    65     for i 0 $Nqueue
    66       queuepop stdout -var line
    67       if ($VERBOSE > 2)
    68         echo $line
    69       end
    70       list word -split $line
    71       $DET_ID   = $word:0
    72       $ITER     = $word:1
    73       $DET_TYPE = $word:2
    74       $CLASS_ID = $word:3
    75       $CAMERA   = $word:4
    76       queuepush DetrendStackClass -uniq -key 1:2:4 "NEW $DET_ID $ITER $DET_TYPE $CLASS_ID $CAMERA"
     47    # convert 'stdout' to book format
     48    ipptool2book stdout DetrendStackClass -key det_id:iter:class_id -uniq
     49    if ($VERBOSE > 2)
     50      book listbook DetrendStackClass
    7751    end
    7852
    7953    # delete existing entries which are DONE
    80     queuedrop DetrendStackClass -key 0 DONE
     54    book delpage DetrendStackClass -key state DONE
    8155  end
    8256
     
    9973
    10074  task.exec
    101     queuesize DetrendStackClass -var N
     75    book npages DetrendStackClass -var N
    10276    if ($N == 0) break
    10377    if ($network == 0) break
    10478   
    105     # look for new images on the internal DetrendStackClass queue
    106     # caution with these 'if' statements: syntax errors
    107     # will make the task fail without given a good status
    108     queuepop DetrendStackClass -var line -key 0 NEW
    109     if ("$line" == "NULL") break
     79    # look for new images in DetrendStackClass
     80    book getpage DetrendStackClass 0 -var pageName -key state NULL
     81    if ($pageName == NULL) break
    11082
    111     strpop line state
    112     queuepush DetrendStackClass -replace -key 1:2:4 "RUN $line"
    113 
    114     # the DetrendStackClass queue contains:
    115     # STATE DET_ID ITER TYPE CLASS_ID
    116     ## NOTE: the queue has the STATE prepended
    117     # use local variables
    118     list word -split $line
    119     $DET_ID   = $word:0
    120     $ITER     = $word:1
    121     $DET_TYPE = $word:2
    122     $CLASS_ID = $word:3
    123     $CAMERA   = $word:4
    124 
    125     # XXX add $WORKDIR/$LOG_DIR
    126     stdout $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.log
    127     stderr $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.log
     83    book setword DetrendStackClass $pageName state RUN
     84    book getword DetrendStackClass $pageName det_id   -var DET_ID
     85    book getword DetrendStackClass $pageName iter     -var ITER
     86    book getword DetrendStackClass $pageName det_type -var DET_TYPE
     87    book getword DetrendStackClass $pageName class_id -var CLASS_ID
     88    book getword DetrendStackClass $pageName camera   -var CAMERA 
    12889
    12990    # specify choice of remote host:
     
    13495    end
    13596
    136     # create example job options as a demonstration
    137     options "$line"
     97    # XXX add $WORKDIR/$LOG_DIR
     98    stdout $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.log
     99    stderr $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.$CLASS_ID.log
     100
     101    # save the pageName for future reference below
     102    options $pageName
     103
     104    # create the command line
    138105    if ($VERBOSE > 1)
    139106      echo command detrend_stack.pl --det_id $DET_ID --iteration $ITER --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA
     
    144111  # success
    145112  task.exit 0
    146     queuepush DetrendStackClass -replace -key 1:2:4 "DONE $options:0"
     113    book setword DetrendStackClass $options:0 state DONE
    147114  end
    148115
     
    150117  task.exit    default
    151118    showcommand failure
    152    queuepush DetrendStackClass -replace -key 1:2:4 "FAIL $options:0"
    153    $DetrendStackClassFail ++
     119    book setword DetrendStackClass $options:0 state FAIL
    154120  end
    155121
     
    157123  task.exit    timeout
    158124    showcommand timeout
    159     queuepush DetrendStackClass -replace -key 1:2:4 "TIMEOUT $options:0"
    160     $DetrendStackClassFail ++
     125    book setword DetrendStackClass $options:0 state TIMEOUT
    161126  end
    162127end
Note: See TracChangeset for help on using the changeset viewer.