IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 29, 2011, 6:42:12 PM (15 years ago)
Author:
watersc1
Message:

Updates to lap code. laptool should be complete, lap.pro should function, and I'm still debugging lap_science.pl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20110406/ippTasks/lap.pro

    r31385 r31417  
    1 ## reprocessing.pro : -*- sh -*-
     1## lap.pro : -*- sh -*-
    22
    33check.globals
    44
    5 macro reprocessing.on
    6   re.chip.on
    7   re.diff.on
    8   re.stack.on
    9   re.magic.on
    10   re.clean.on
    11 end
    12 
    13 macro reprocessing.off
    14   re.chip.off
    15   re.diff.off
    16   re.stack.off
    17   re.magic.off
    18   re.clean.off
    19 end
    20 
    21 macro re.on
    22   reprocessing.on
    23 end
    24 
    25 macro re.off
    26   reprocessing.off
    27 end
    28 
    29 macro re.chip.on
    30   task re.chip.load
    31     active true
    32   end
    33 end
    34 
    35 macro re.diff.on
    36   task re.diff.load
    37     active true
    38   end
    39 end
    40 
    41 macro re.stack.on
    42   task re.stack.load
    43     active true
    44   end
    45 end
    46 
    47 macro re.magic.on
    48   task re.magic.load
    49     active true
    50   end
    51 end
    52 
    53 macro re.clean.on
    54   task re.clean.load
    55     active true
    56   end
    57 end
    58 
    59 macro re.chip.off
    60   task re.chip.load
    61     active false
    62   end
    63 end
    64 
    65 macro re.diff.off
    66   task re.diff.load
    67     active false
    68   end
    69 end
    70 
    71 macro re.stack.off
    72   task re.stack.load
    73     active false
    74   end
    75 end
    76 
    77 macro re.magic.off
    78   task re.magic.load
    79     active false
    80   end
    81 end
    82 
    83 macro re.clean.off
    84   task re.clean.load
    85     active false
    86   end
    87 end
    88 
    89 book init reData
    90 
    91 task           re.chip.load
     5$lapSeq:n = 0
     6
     7book init lapRuns
     8
     9macro lap.add.sequence
     10  if ($0 != 2)
     11    echo "USAGE: lap.add.sequence (seq_id)"
     12    break
     13  end
     14  if ($?lapSeq:n == 0)
     15    list lapSeq -add $1
     16    return
     17  end
     18
     19  local found
     20  $found = 0
     21  for i 0 $lapSeq:n
     22    if ($lapSeq:$i == $1)
     23      $found = 1
     24      echo "$lapSeq:$i set"
     25      last
     26    end
     27  end
     28
     29  if ($found == 0)
     30    list lapSeq -add $1
     31  end
     32end
     33
     34macro lap.del.sequence
     35  if ($0 != 2)
     36    echo "USAGE: lap.del.sequence (seq_id)"
     37    break
     38  end
     39  if ($?lapSeq:n == 0)
     40    return
     41  end
     42
     43  list lapSeq -del $1
     44end
     45 
     46
     47task           lap.initial.load
    9248  host         local
    9349  periods      -poll $LOADPOLL
     
    9854  task.exec
    9955    stdout NULL
    100     stderr $LOGDEIR/re.chip.log
    101 
    102     $run = echo no command yet
    103     command $run
    104   end
    105   # success
    106   task.exit  0
    107     book delpage reData $options:0
    108     ipptool2book stdout reData -uniq -key proj
    109 
    110     if ($VERBOSE > 2)
    111       book listbook reData
    112     end
    113   end
    114   # locked list
    115   task.exit    default
    116     showcommand failure
    117   end
    118   task.exit    crash
    119     showcommand crash
    120   end
    121   #operation times out?
    122   task.exit    timeout
    123     showcommand timeout
    124   end
    125 end
    126 
    127 
    128 task           re.diff.load
     56    stderr $LOGDIR/lap.load.log
     57
     58    $run = laptool -pendingrun -state new
     59
     60    if ($lapSeq:n == 0)
     61      break
     62    else
     63      option $lapSeq:$lap_N
     64      $run = $run -seq_id $lapSeq:$lap_N
     65      $lap_N ++
     66      if ($lap_N >= $lapSeq:n) set lap_N = 0
     67    end
     68
     69    if ($DB:n == 0)
     70      option DEFAULT
     71    else
     72      option $DB:$lap_DB
     73      $run = $run -dbname $DB:$lap_DB
     74      $lap_DB ++
     75      if ($lap_DB >= $DB:n) set lap_DB = 0
     76    end
     77
     78    command $run
     79  end
     80  # success
     81  task.exit  0
     82    book delpage lapNewRuns $options:0
     83    ipptool2book stdout lapNewRuns -uniq -key proj
     84
     85    if ($VERBOSE > 2)
     86      book listbook lapNewRuns
     87    end
     88  end
     89  # locked list
     90  task.exit    default
     91    showcommand failure
     92  end
     93  task.exit    crash
     94    showcommand crash
     95  end
     96  #operation times out?
     97  task.exit    timeout
     98    showcommand timeout
     99  end
     100end
     101
     102task           lap.initial.run
     103  host         local
     104  periods      -poll $LOADPOLL
     105  periods      -exec $LOADEXEC
     106  periods      -timeout 600
     107# This can probably be increased and spread over hosts in the future.
     108  npending     1           
     109
     110  task.exec
     111    stdout NULL
     112    stderr $LOGDIR/lap.initial.log
     113
     114    book npages lapNewRuns -var N
     115    if ($N == 0) break
     116    if ($NETWORK == 0) break
     117
     118
     119    book getpage lapNewRuns 0 -var pageName -key pantaskState INIT
     120    if ("$pageName" == "NULL") break
     121
     122    book setword lapNewRuns $pageName pantaskState RUN
     123    book getword lapNewRuns $pageName lap_id -var LAP_ID
     124    book getword lapNewRuns $pageName dbname -var DBNAME
     125
     126    $run = lap_science.pl --chip_mode --dbname $DBNAME --lap_id $LAP_ID
     127
     128    command $run
     129
     130  end
     131
     132  # success
     133  task.exit  0
     134    book delpage lapNewRuns $options:0
     135    ipptool2book stdout lapNewRuns -uniq -key proj
     136
     137    if ($VERBOSE > 2)
     138      book listbook lapNewRuns
     139    end
     140  end
     141  # locked list
     142  task.exit    default
     143    showcommand failure
     144  end
     145  task.exit    crash
     146    showcommand crash
     147  end
     148  #operation times out?
     149  task.exit    timeout
     150    showcommand timeout
     151  end
     152end
     153
     154
     155
     156task           lap.monitor.load
    129157  host         local
    130158  periods      -poll $LOADPOLL
     
    135163  task.exec
    136164    stdout NULL
    137     stderr $LOGDEIR/re.diff.log
    138 
    139     $run = echo no command yet
    140     command $run
    141   end
    142   # success
    143   task.exit  0
    144     book delpage reData $options:0
    145     ipptool2book stdout reData -uniq -key proj
    146 
    147     if ($VERBOSE > 2)
    148       book listbook reData
    149     end
    150   end
    151   # locked list
    152   task.exit    default
    153     showcommand failure
    154   end
    155   task.exit    crash
    156     showcommand crash
    157   end
    158   #operation times out?
    159   task.exit    timeout
    160     showcommand timeout
    161   end
    162 end
    163 
    164 task           re.magic.load
     165    stderr $LOGDIR/lap.load.log
     166
     167    $run = laptool -pendingrun -state run
     168
     169    if ($lapSeq:n != 0)
     170      option $lapSeq:$lap_N
     171      $run = $run -seq_id $lapSeq:$lap_N
     172      $lap_N ++
     173      if ($lap_N >= $lapSeq:n) set lap_N = 0
     174    end
     175
     176    if ($DB:n == 0)
     177      option DEFAULT
     178    else
     179      option $DB:$lap_DB
     180      $run = $run -dbname $DB:$lap_DB
     181      $lap_DB ++
     182      if ($lap_DB >= $DB:n) set lap_DB = 0
     183    end
     184
     185    add_poll_labels run
     186
     187    command $run
     188  end
     189  # success
     190  task.exit  0
     191    book delpage lapRuRuns $options:0
     192    ipptool2book stdout lapRunRuns -uniq -key lap_id
     193
     194    if ($VERBOSE > 2)
     195      book listbook lapRunRuns
     196    end
     197  end
     198  # locked list
     199  task.exit    default
     200    showcommand failure
     201  end
     202  task.exit    crash
     203    showcommand crash
     204  end
     205  #operation times out?
     206  task.exit    timeout
     207    showcommand timeout
     208  end
     209end
     210
     211task           lap.monitor.run
     212  host         local
     213  periods      -poll $LOADPOLL
     214  periods      -exec $LOADEXEC
     215  periods      -timeout 600
     216# This can probably be increased and spread over hosts in the future.
     217  npending     1           
     218
     219  task.exec
     220    stdout NULL
     221    stderr $LOGDIR/lap.initial.log
     222
     223    book npages lapRunRuns -var N
     224    if ($N == 0) break
     225    if ($NETWORK == 0) break
     226
     227
     228    book getpage lapNewRuns 0 -var pageName -key pantaskState INIT
     229    if ("$pageName" == "NULL") break
     230
     231    book setword lapNewRuns $pageName pantaskState RUN
     232    book getword lapNewRuns $pageName lap_id -var LAP_ID
     233    book getword lapNewRuns $pageName dbname -var DBNAME
     234
     235    $run = lap_science.pl --monitor_mode --dbname $DBNAME --lap_id $LAP_ID
     236
     237    command $run
     238
     239  end
     240
     241  # success
     242  task.exit  0
     243    book delpage lapRunRuns $options:0
     244    ipptool2book stdout lapRunRuns -uniq -key proj
     245
     246    if ($VERBOSE > 2)
     247      book listbook lapRunRuns
     248    end
     249  end
     250  # locked list
     251  task.exit    default
     252    showcommand failure
     253  end
     254  task.exit    crash
     255    showcommand crash
     256  end
     257  #operation times out?
     258  task.exit    timeout
     259    showcommand timeout
     260  end
     261end
     262
     263
     264
     265task           lap.cleanup.load
    165266  host         local
    166267  periods      -poll $LOADPOLL
     
    171272  task.exec
    172273    stdout NULL
    173     stderr $LOGDEIR/re.magic.log
    174 
    175     $run = echo no command yet
    176     command $run
    177   end
    178   # success
    179   task.exit  0
    180     book delpage reData $options:0
    181     ipptool2book stdout reData -uniq -key proj
    182 
    183     if ($VERBOSE > 2)
    184       book listbook reData
    185     end
    186   end
    187   # locked list
    188   task.exit    default
    189     showcommand failure
    190   end
    191   task.exit    crash
    192     showcommand crash
    193   end
    194   #operation times out?
    195   task.exit    timeout
    196     showcommand timeout
    197   end
    198 end
    199 
    200 task           re.stack.load
    201   host         local
    202   periods      -poll $LOADPOLL
    203   periods      -exec $LOADEXEC
    204   periods      -timeout 30
    205   npending     1
    206 
    207   task.exec
    208     stdout NULL
    209     stderr $LOGDEIR/re.stack.log
    210 
    211     $run = echo no command yet
    212     command $run
    213   end
    214   # success
    215   task.exit  0
    216     book delpage reData $options:0
    217     ipptool2book stdout reData -uniq -key proj
    218 
    219     if ($VERBOSE > 2)
    220       book listbook reData
    221     end
    222   end
    223   # locked list
    224   task.exit    default
    225     showcommand failure
    226   end
    227   task.exit    crash
    228     showcommand crash
    229   end
    230   #operation times out?
    231   task.exit    timeout
    232     showcommand timeout
    233   end
    234 end
    235 
    236 task           re.clean.load
    237   host         local
    238   periods      -poll $LOADPOLL
    239   periods      -exec $LOADEXEC
    240   periods      -timeout 30
    241   npending     1
    242 
    243   task.exec
    244     stdout NULL
    245     stderr $LOGDEIR/re.clean.log
    246 
    247     $run = echo no command yet
    248     command $run
    249   end
    250   # success
    251   task.exit  0
    252     book delpage reData $options:0
    253     ipptool2book stdout reData -uniq -key proj
    254 
    255     if ($VERBOSE > 2)
    256       book listbook reData
    257     end
    258   end
    259   # locked list
    260   task.exit    default
    261     showcommand failure
    262   end
    263   task.exit    crash
    264     showcommand crash
    265   end
    266   #operation times out?
    267   task.exit    timeout
    268     showcommand timeout
    269   end
    270 end
     274    stderr $LOGDIR/lap.load.log
     275
     276    $run = laptool -pendingrun -state done
     277
     278    if ($lapSeq:n != 0)
     279      option $lapSeq:$lap_N
     280      $run = $run -seq_id $lapSeq:$lap_N
     281      $lap_N ++
     282      if ($lap_N >= $lapSeq:n) set lap_N = 0
     283    end
     284
     285    if ($DB:n == 0)
     286      option DEFAULT
     287    else
     288      option $DB:$lap_DB
     289      $run = $run -dbname $DB:$lap_DB
     290      $lap_DB ++
     291      if ($lap_DB >= $DB:n) set lap_DB = 0
     292    end
     293
     294    add_poll_labels run
     295
     296    command $run
     297  end
     298  # success
     299  task.exit  0
     300    book delpage lapDoneRuns $options:0
     301    ipptool2book stdout lapDoneRuns -uniq -key lap_id
     302
     303    if ($VERBOSE > 2)
     304      book listbook lapRuns
     305    end
     306  end
     307  # locked list
     308  task.exit    default
     309    showcommand failure
     310  end
     311  task.exit    crash
     312    showcommand crash
     313  end
     314  #operation times out?
     315  task.exit    timeout
     316    showcommand timeout
     317  end
     318end
     319
     320task           lap.cleanup.run
     321  host         local
     322  periods      -poll $LOADPOLL
     323  periods      -exec $LOADEXEC
     324  periods      -timeout 600
     325# This can probably be increased and spread over hosts in the future.
     326  npending     1           
     327
     328  task.exec
     329    stdout NULL
     330    stderr $LOGDIR/lap.cleanup.log
     331
     332    book npages lapNewRuns -var N
     333    if ($N == 0) break
     334    if ($NETWORK == 0) break
     335
     336
     337    book getpage lapNewRuns 0 -var pageName -key pantaskState INIT
     338    if ("$pageName" == "NULL") break
     339
     340    book setword lapDoneRuns $pageName pantaskState RUN
     341    book getword lapDoneRuns $pageName lap_id -var LAP_ID
     342    book getword lapDoneRuns $pageName dbname -var DBNAME
     343
     344    $run = lap_science.pl --cleanup_mode --dbname $DBNAME --lap_id $LAP_ID
     345
     346    command $run
     347
     348  end
     349
     350  # success
     351  task.exit  0
     352    book delpage lapDoneRuns $options:0
     353    ipptool2book stdout lapDoneRuns -uniq -key proj
     354
     355    if ($VERBOSE > 2)
     356      book listbook lapDoneRuns
     357    end
     358  end
     359  # locked list
     360  task.exit    default
     361    showcommand failure
     362  end
     363  task.exit    crash
     364    showcommand crash
     365  end
     366  #operation times out?
     367  task.exit    timeout
     368    showcommand timeout
     369  end
     370end
Note: See TracChangeset for help on using the changeset viewer.