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.reject.pro

    r10745 r11011  
    1 
    21## this file contains the tasks for running the detrend processing stage
    32
    4 # dettool -residdetrun -simple
    5 # 1      0    bias
    6 # DET_ID ITER TYPE
    7 
    8 # detrend_reject_exp.pl 1      0    bias
    9 # detrend_reject_exp.pl DET_ID ITER TYPE
    10 
    11 ## these tasks use the queue DetrendResidExp
    12 ## the DetrendRejectExp queue contains:
    13 ## STATE DET_ID ITER TYPE
    14 
    15 queueinit DetrendRejectExp
    163if ($?network == 0)
    174  $network = 1
     
    207  $parallel = 0
    218end
    22 
    23 $DetrendRejectExpFail = 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
    3520
     21book init DetrendRejectExp
     22
    3623macro detreject.status
    37   queueprint DetrendRejectExp
    38   echo "DetrendRejectExpFail: $DetrendRejectExpFail"
     24  book listbook DetrendRejectExp
    3925end
    4026
     
    5339
    5440  task.exec
    55     command dettool -residdetrun -simple -limit {$DetrendRejectExpFail + 20}
     41    command dettool -residdetrun -limit 20
    5642  end
    5743
    5844  # success
    5945  task.exit    0
    60     local i Nqueue
    61 
    62     # compare output with newImage queue
    63     # only add entries which don't 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       $MODE     = $word:3
    75       $CAMERA   = $word:4
    76       queuepush DetrendRejectExp -uniq -key 1:2 "NEW $DET_ID $ITER $DET_TYPE $MODE $CAMERA"
     46    # convert 'stdout' to book format
     47    ipptool2book stdout DetrendRejectExp -key det_id:iter -uniq
     48    if ($VERBOSE > 2)
     49      book listbook DetrendRejectExp
    7750    end
    7851
    7952    # delete existing entries which are DONE
    80     queuedrop DetrendRejectExp -key 0 DONE
     53    book delpage DetrendRejectExp -key state DONE
    8154  end
    8255
     
    9972
    10073  task.exec
    101     queuesize DetrendRejectExp -var N
     74    book npages DetrendRejectExp -var N
    10275    if ($N == 0) break
    10376    if ($network == 0) break
    10477   
    105     # look for new images on the internal DetrendRejectExp queue
    106     # caution with these 'if' statements: syntax errors
    107     # will make the task fail without given a good status
    108     queuepop DetrendRejectExp -var line -key 0 NEW
    109     if ("$line" == "NULL") break
     78    # look for new images in DetrendRejectExp
     79    book getpage DetrendRejectExp 0 -var pageName -key state NULL
     80    if ($pageName == NULL) break
    11081
    111     strpop line state
    112     queuepush DetrendRejectExp -replace -key 1:2 "RUN $line"
    113 
    114     ## the DetrendRejectExp queue contains:
    115     ## STATE DET_ID ITER TYPE
    116     ## NOTE: the queue has the STATE prepended
    117     list word -split $line
    118     $DET_ID   = $word:0
    119     $ITER     = $word:1
    120     $DET_TYPE = $word:2
    121     $MODE     = $word:3
    122     $CAMERA   = $word:4
    123 
    124     # I'd like to add CAMERA to the log file...
    125     stdout $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
    126     stderr $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     82    book setword DetrendRejectExp $pageName state RUN
     83    book getword DetrendRejectExp $pageName DET_ID   -var DET_ID   
     84    book getword DetrendRejectExp $pageName ITER     -var ITER     
     85    book getword DetrendRejectExp $pageName DET_TYPE -var DET_TYPE
     86    book getword DetrendRejectExp $pageName MODE     -var MODE     
     87    book getword DetrendRejectExp $pageName CAMERA   -var CAMERA   
    12788
    12889    # specify choice of remote host:
     
    13394    end
    13495
     96    # I'd like to add CAMERA to the log file...
     97    stdout $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     98    stderr $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITER.log
     99
     100    # save the pageName for future reference below
     101    options $pageName
     102
    135103    # create example job options as a demonstration
    136     options "$line"
    137104    if ($VERBOSE > 1)
    138105      echo command detrend_reject_exp.pl --det_id $DET_ID --iteration $ITER --det_type $DET_TYPE --camera $CAMERA
     
    143110  # success
    144111  task.exit 0
    145     queuepush DetrendRejectExp -replace -key 1:2 "DONE $options:0"
     112    book setword DetrendRejectExp $options:0 state DONE
    146113  end
    147114
     
    149116  task.exit    default
    150117    showcommand failure
    151     queuepush DetrendRejectExp -replace -key 1:2 "FAIL $options:0"
    152     $DetrendRejectExpFail ++
     118    book setword DetrendRejectExp $options:0 state FAIL
    153119  end
    154120
     
    156122  task.exit    timeout
    157123    showcommand failure
    158     queuepush DetrendRejectExp -replace -key 1:2 "TIMEOUT $options:0"
    159    $DetrendRejectExpFail ++
     124    book setword DetrendRejectExp $options:0 state TIMEOUT
    160125  end
    161126end
Note: See TracChangeset for help on using the changeset viewer.