IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 19, 2007, 5:24:59 PM (19 years ago)
Author:
eugene
Message:

converting to book version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/detrend.stack.pro

    r10745 r11210  
    11## this file contains the tasks for running the detrend stacking stage
     2## these tasks use the book detPendingStackedImfile
    23
    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
    164if ($?network == 0)
    175  $network = 1
     
    208  $parallel = 0
    219end
    22 
    23 $DetrendStackClassFail = 0
    24 
    2510if ($?VERBOSE == 0)
    2611  echo "VERBOSE not defined: load pantasks.pro first"
     
    3116  break
    3217end
     18
    3319$LOGSUBDIR = $LOGDIR/detrend
    3420exec mkdir -p $LOGSUBDIR
    3521
     22book init detPendingStackedImfile
     23
    3624macro detstack.status
    37   queueprint DetrendStackClass
    38   echo "DetrendStackClassFail: $DetrendStackClassFail"
     25  book listbook detPendingStackedImfile
    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 detPendingStackedImfile
    4330# compare the new list with the ones already selected
    4431task           dettool.stack.load
     
    4936  periods      -timeout 30
    5037
    51   stdout $LOGSUBDIR/detstack.log
     38  stdout NULL
    5239  stderr $LOGSUBDIR/detstack.log
    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 detPendingStackedImfile -key det_id:iteration:class_id -uniq
     49    if ($VERBOSE > 2)
     50      book listbook detPendingStackedImfile
    7751    end
    7852
    7953    # delete existing entries which are DONE
    80     queuedrop DetrendStackClass -key 0 DONE
     54    book delpage detPendingStackedImfile -key state DONE
    8155  end
    8256
     
    9973
    10074  task.exec
    101     queuesize DetrendStackClass -var N
     75    book npages detPendingStackedImfile -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 detPendingStackedImfile
     80    book getpage detPendingStackedImfile 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 detPendingStackedImfile $pageName state RUN
     84    book getword detPendingStackedImfile $pageName det_id    -var DET_ID
     85    book getword detPendingStackedImfile $pageName iteration -var ITERATION
     86    book getword detPendingStackedImfile $pageName det_type  -var DET_TYPE
     87    book getword detPendingStackedImfile $pageName class_id  -var CLASS_ID
     88    book getword detPendingStackedImfile $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    # XXX use ipp_filename.pl to lookup output file names
     99    stdout $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITERATION.$CLASS_ID.log
     100    stderr $LOGSUBDIR/$CAMERA.$DET_TYPE.$DET_ID.$ITERATION.$CLASS_ID.log
     101
     102    # save the pageName for future reference below
     103    options $pageName
     104
     105    # create the command line
    138106    if ($VERBOSE > 1)
    139       echo command detrend_stack.pl --det_id $DET_ID --iteration $ITER --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA
     107      echo command detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA
    140108    end
    141     command detrend_stack.pl --det_id $DET_ID --iteration $ITER --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA
    142   end
    143 
    144   # success
    145   task.exit 0
    146     queuepush DetrendStackClass -replace -key 1:2:4 "DONE $options:0"
     109    command detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA
    147110  end
    148111
    149112  # default exit status
    150113  task.exit    default
    151     showcommand failure
    152    queuepush DetrendStackClass -replace -key 1:2:4 "FAIL $options:0"
    153    $DetrendStackClassFail ++
     114    process_exit detPendingStackedImfile $options:0 $JOB_STATUS
    154115  end
    155116
     
    157118  task.exit    timeout
    158119    showcommand timeout
    159     queuepush DetrendStackClass -replace -key 1:2:4 "TIMEOUT $options:0"
    160     $DetrendStackClassFail ++
     120    book setword detPendingStackedImfile $options:0 state TIMEOUT
    161121  end
    162122end
Note: See TracChangeset for help on using the changeset viewer.