IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30049 for trunk/ippTasks


Ignore:
Timestamp:
Dec 15, 2010, 1:29:28 PM (15 years ago)
Author:
watersc1
Message:

Merge of realtime burntool and new nightly science code into trunk.

Location:
trunk
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ippTasks/Makefile.am

    r29614 r30049  
    3636        minidvodb.pro \
    3737        minidvodbcopy.pro \
    38         nightly_stacks.pro \
     38        nightly_science.pro \
    3939        burntool.pro \
    4040        lossy_compress.pro \
     
    4747        site.manoa.pro \
    4848        site.mhpcc.pro \
     49        site.mhpcc_testing.pro \
    4950        surveys.mhpcc.config \
    5051        simtest.pro \
  • trunk/ippTasks/nightly_stacks.pro

    r29656 r30049  
    77    ns.detrends.off
    88    ns.dqstats.on
    9     ns.sweetspot.on
    10     ns.registration.on
    11     ns.burntool.on
    12     ns.chips.on
     9#    ns.sweetspot.on
     10#    ns.registration.on
     11#    ns.burntool.on
     12#    ns.chips.on
    1313    ns.stacks.on
     14    ns.diffs.on
    1415end
    1516
     
    1819    ns.detrends.off
    1920    ns.dqstats.off
    20     ns.sweetspot.off
    21     ns.registration.off
    22     ns.burntool.off
    23     ns.chips.off
     21#    ns.sweetspot.off
     22#    ns.registration.off
     23#    ns.burntool.off
     24#    ns.chips.off
    2425    ns.stacks.off
     26    ns.diffs.off
    2527end
    2628
     
    5153end
    5254
    53 macro ns.sweetspot.on
    54   task ns.sweetspot.load
    55     active true
    56   end
    57 end
    58 
    59 macro ns.registration.on
    60   task ns.registration.load
    61     active true
    62   end
    63 end
    64 
    65 macro ns.burntool.on
    66   task ns.burntool.load
    67     active true
    68   end
    69   task ns.burntool.run
    70     active true
    71   end
    72 end
    73 
    74 macro ns.chips.on
    75   task ns.chips.load
    76     active true
    77   end
    78   task ns.chips.run
    79     active true
    80   end
    81 end
     55# macro ns.sweetspot.on
     56#   task ns.sweetspot.load
     57#     active true
     58#   end
     59# end
     60
     61# macro ns.registration.on
     62#   task ns.registration.load
     63#     active true
     64#   end
     65# end
     66
     67# macro ns.burntool.on
     68#   task ns.burntool.load
     69#     active true
     70#   end
     71#   task ns.burntool.run
     72#     active true
     73#   end
     74# end
     75
     76# macro ns.chips.on
     77#   task ns.chips.load
     78#     active true
     79#   end
     80#   task ns.chips.run
     81#     active true
     82#   end
     83# end
    8284
    8385macro ns.stacks.on
     
    9395end
    9496
     97macro ns.diffs.on
     98  task ns.diffs.load
     99    active false
     100  end
     101  task ns.diffs.run
     102    active true
     103  end
     104end
     105
    95106macro ns.initday.off
    96107  task ns.initday.load
     
    111122end
    112123
    113 macro ns.sweetspot.off
    114   task ns.sweetspot.load
    115     active false
    116   end
    117 end
    118 
    119 macro ns.registration.off
    120   task ns.registration.load
    121     active false
    122   end
    123 end
    124 
    125 macro ns.burntool.off
    126   task ns.burntool.load
    127     active false
    128   end
    129   task ns.burntool.run
    130     active false
    131   end
    132 end
    133 
    134 macro ns.chips.off
    135   task ns.chips.load
    136     active false
    137   end
    138   task ns.chips.run
    139     active false
    140   end
    141 end
     124# macro ns.sweetspot.off
     125#   task ns.sweetspot.load
     126#     active false
     127#   end
     128# end
     129
     130# macro ns.registration.off
     131#   task ns.registration.load
     132#     active false
     133#   end
     134# end
     135
     136# macro ns.burntool.off
     137#   task ns.burntool.load
     138#     active false
     139#   end
     140#   task ns.burntool.run
     141#     active false
     142#   end
     143# end
     144
     145# macro ns.chips.off
     146#   task ns.chips.load
     147#     active false
     148#   end
     149#   task ns.chips.run
     150#     active false
     151#   end
     152# end
    142153
    143154macro ns.stacks.off
     
    150161end
    151162
    152 $ns_regPAGE = 0
    153 $ns_burnPAGE = 0
    154 $ns_RburnPAGE = 0
    155 $ns_RburnCELL = 0
    156 $ns_chipPAGE = 0
    157 $ns_RchipPAGE = 0
     163macro ns.diffs.off
     164  task ns.diffs.load
     165    active false
     166  end
     167  task ns.diffs.run
     168    active false
     169  end
     170end
     171
     172# $ns_regPAGE = 0
     173# $ns_burnPAGE = 0
     174# $ns_RburnPAGE = 0
     175# $ns_RburnCELL = 0
     176# $ns_chipPAGE = 0
     177# $ns_RchipPAGE = 0
    158178$ns_stackPAGE = 0
    159179$ns_RstackPAGE = 0
    160180$ns_CstackPAGE = 0
     181$ns_diffPAGE = 0
     182$ns_RdiffPAGE = 0
    161183
    162184book init nsData
    163 book init nsBurntool
     185# book init nsBurntool
    164186#
    165187# Macros to control the book.
     
    177199       echo $date $state
    178200    end
    179     book npages nsBurntool -var Npages
     201#    book npages nsBurntool -var Npages
    180202end
    181203
     
    198220  periods         -exec $LOADEXEC
    199221  periods         -timeout 30
    200   trange          16:30:00 17:30:00 -nmax 1
     222  trange          0:00:00 1:00:00 -nmax 1
    201223  npending        1
    202224
     
    204226    stdout $LOGDIR/ns.initday.log
    205227    stderr $LOGDIR/ns.initday.log
    206     $today = `date +%Y-%m-%d`
     228    $today = `date -u +%Y-%m-%d`
    207229    book newpage nsData $today
    208230    book setword nsData $today nsState NEW
     
    242264    stdout $LOGDIR/ns.detrends.log
    243265    stdout $LOGDIR/ns.detrends.log
    244     $today = `date +%Y-%m-%d`
     266    $today = `date -u +%Y-%m-%d`
    245267
    246268    command automate_stacks.pl --queue_detrends --date $today
     
    278300    stdout $LOGDIR/ns.dqstats.log
    279301    stderr $LOGDIR/ns.dqstats.log
    280     $today = `date +%Y-%m-%d`
     302    $today = `date -u +%Y-%m-%d`
    281303
    282304    command automate_stacks.pl --queue_dqstats --date $today
     
    313335    stdout $LOGDIR/ns.sweetspot.log
    314336    stderr $LOGDIR/ns.sweetspot.log
    315     $today = `date +%Y-%m-%d`
     337    $today = `date -u +%Y-%m-%d`
    316338
    317339    command automate_stacks.pl --queue_sweetspot --date $today
     
    337359# Check to see if registration is complete
    338360#
    339 task              ns.registration.load
    340   host            local
    341   periods         -poll $LOADPOLL
    342   periods         -exec $LOADEXEC
    343   periods         -timeout 30
    344   npending        1
    345 
    346   task.exec
    347     stdout NULL
    348     stderr $LOGDIR/ns.registration.log
    349 
    350     book getpage nsData $ns_regPAGE -var date
    351     book getword nsData $date nsState -var ns_STATE
    352     book npages nsData -var Npages
    353 
    354     if ($VERBOSE > 5)
    355        echo "ns.registration.load: " $ns_regPAGE $date $ns_STATE $Npages
    356     end
    357 
    358     $ns_regPAGE ++
    359     if ($ns_regPAGE >= $Npages) set ns_regPAGE = 0
    360     option $date
    361 
    362     if ("$ns_STATE" != "NEW") break
    363     $run = automate_stacks.pl --check_registration --date $date
    364     command $run
    365   end
    366 
    367   # success
    368   task.exit   0
    369 #    convert 'stdout' to book format
    370     book delpage nsData $options:0
    371     ipptool2book stdout nsData -uniq -key date
    372 
    373     if ($VERBOSE > 2)
    374         book listbook nsData
    375     end
    376   end
    377 
    378   # locked list
    379   task.exit    default
    380     showcommand failure
    381   end
    382   task.exit    crash
    383     showcommand crash
    384   end
    385   #operation times out?
    386   task.exit    timeout
    387     showcommand timeout
    388   end
    389 end
    390 
    391 #
    392 # Check to see if the chips have been properly burntooled and are ready for queueing
    393 #
    394 task              ns.chips.load
    395   host            local
    396   periods         -poll $LOADPOLL
    397   periods         -exec $LOADEXEC
    398   periods         -timeout 300
    399   npending        1
    400 
    401   task.exec
    402      stdout NULL
    403      stderr $LOGDIR/ns.chips.log
    404 
    405      book getpage nsData $ns_chipPAGE -var date
    406      book getword nsData $date nsState -var ns_STATE
    407      book npages nsData -var Npages
    408 
    409      if ($VERBOSE > 5)
    410         echo "ns.chips.load: " $ns_chipPAGE $date $ns_STATE $Npages
    411      end
    412 
    413      $ns_chipPAGE ++
    414      if ($ns_chipPAGE >= $Npages) set ns_chipPAGE = 0
    415      option $date
    416 
    417      if (("$ns_STATE" != "REGISTERED")&&("$ns_STATE" != "BURNING")) break
    418      $run = automate_stacks.pl --check_chips --date $date
    419 
    420      if ("$ns_STATE" == "BURNING")
    421         $run = $run --isburning
    422      end
    423      command $run
    424    end
    425   # success
    426   task.exit   0
    427 #   convert 'stdout' to book format
    428     book delpage nsData $options:0
    429     ipptool2book stdout nsData -uniq -key date
    430 
    431     # remove the burntool page if we're done with it.
    432     book getword nsData $options:0 nsState -var ns_STATE
    433     if ("$ns_STATE" == "QUEUECHIPS")
    434         book delpage nsBurntool $options:0
    435     end
    436 
    437     book getword nsData $options:0 nsNmacros -var ns_Nmacros
    438     if ("$ns_Nmacros" != "NULL")
    439         for i 0 $ns_Nmacros
    440             sprintf macroName "ns%dMacro" $i
    441             book getword nsData $options:0 $macroName -var macroCmd
    442             $macroCmd
    443         end
    444     end
    445 
    446     if ($VERBOSE > 2)
    447         book listbook nsData
    448     end
    449   end
    450 
    451   # locked list
    452   task.exit    default
    453     showcommand failure
    454   end
    455   task.exit    crash
    456     showcommand crash
    457   end
    458   #operation times out?
    459   task.exit    timeout
    460     showcommand timeout
    461   end
    462 end
    463 
    464 #
    465 # Check to see if the chips have been properly burntooled and are ready for queueing
    466 #
    467 task              ns.chips.run
    468   host            local
    469   periods         -poll $LOADPOLL
    470   periods         -exec $LOADEXEC
    471   periods         -timeout 120
    472   npending        1
    473 
    474   task.exec
    475      stdout NULL
    476      stderr $LOGDIR/ns.chips.log
    477 
    478      book getpage nsData $ns_RchipPAGE -var date
    479      book getword nsData $date nsState -var ns_STATE
    480      book npages nsData -var Npages
    481 
    482     if ($VERBOSE > 5)
    483        echo "ns.chips.run: " $ns_RchipPAGE $date $ns_STATE $Npages
    484     end
     361# task              ns.registration.load
     362#   host            local
     363#   periods         -poll $LOADPOLL
     364#   periods         -exec $LOADEXEC
     365#   periods         -timeout 30
     366#   npending        1
     367
     368#   task.exec
     369#     stdout NULL
     370#     stderr $LOGDIR/ns.registration.log
     371
     372#     book getpage nsData $ns_regPAGE -var date
     373#     book getword nsData $date nsState -var ns_STATE
     374#     book npages nsData -var Npages
     375
     376#     if ($VERBOSE > 5)
     377#        echo "ns.registration.load: " $ns_regPAGE $date $ns_STATE $Npages
     378#     end
     379
     380#     $ns_regPAGE ++
     381#     if ($ns_regPAGE >= $Npages) set ns_regPAGE = 0
     382#     option $date
     383
     384#     if ("$ns_STATE" != "NEW") break
     385#     $run = automate_stacks.pl --check_registration --date $date
     386#     command $run
     387#   end
     388
     389#   # success
     390#   task.exit   0
     391# #    convert 'stdout' to book format
     392#     book delpage nsData $options:0
     393#     ipptool2book stdout nsData -uniq -key date
     394
     395#     if ($VERBOSE > 2)
     396#       book listbook nsData
     397#     end
     398#   end
     399
     400#   # locked list
     401#   task.exit    default
     402#     showcommand failure
     403#   end
     404#   task.exit    crash
     405#     showcommand crash
     406#   end
     407#   #operation times out?
     408#   task.exit    timeout
     409#     showcommand timeout
     410#   end
     411# end
     412
     413# #
     414# # Check to see if the chips have been properly burntooled and are ready for queueing
     415# #
     416# task              ns.chips.load
     417#   host            local
     418#   periods         -poll $LOADPOLL
     419#   periods         -exec $LOADEXEC
     420#   periods         -timeout 300
     421#   npending        1
     422
     423#   task.exec
     424#      stdout NULL
     425#      stderr $LOGDIR/ns.chips.log
     426
     427#      book getpage nsData $ns_chipPAGE -var date
     428#      book getword nsData $date nsState -var ns_STATE
     429#      book npages nsData -var Npages
     430
     431#      if ($VERBOSE > 5)
     432#       echo "ns.chips.load: " $ns_chipPAGE $date $ns_STATE $Npages
     433#      end
     434
     435#      $ns_chipPAGE ++
     436#      if ($ns_chipPAGE >= $Npages) set ns_chipPAGE = 0
     437#      option $date
     438
     439#      if (("$ns_STATE" != "REGISTERED")&&("$ns_STATE" != "BURNING")) break
     440#      $run = automate_stacks.pl --check_chips --date $date
     441
     442#      if ("$ns_STATE" == "BURNING")
     443#       $run = $run --isburning
     444#      end
     445#      command $run
     446#    end
     447#   # success
     448#   task.exit   0
     449# #   convert 'stdout' to book format
     450#     book delpage nsData $options:0
     451#     ipptool2book stdout nsData -uniq -key date
     452
     453#     # remove the burntool page if we're done with it.
     454#     book getword nsData $options:0 nsState -var ns_STATE
     455#     if ("$ns_STATE" == "QUEUECHIPS")
     456#       book delpage nsBurntool $options:0
     457#     end
     458
     459#     book getword nsData $options:0 nsNmacros -var ns_Nmacros
     460#     if ("$ns_Nmacros" != "NULL")
     461#       for i 0 $ns_Nmacros
     462#           sprintf macroName "ns%dMacro" $i
     463#           book getword nsData $options:0 $macroName -var macroCmd
     464#           $macroCmd
     465#       end
     466#     end
     467
     468#     if ($VERBOSE > 2)
     469#       book listbook nsData
     470#     end
     471#   end
     472
     473#   # locked list
     474#   task.exit    default
     475#     showcommand failure
     476#   end
     477#   task.exit    crash
     478#     showcommand crash
     479#   end
     480#   #operation times out?
     481#   task.exit    timeout
     482#     showcommand timeout
     483#   end
     484# end
     485
     486# #
     487# # Check to see if the chips have been properly burntooled and are ready for queueing
     488# #
     489# task              ns.chips.run
     490#   host            local
     491#   periods         -poll $LOADPOLL
     492#   periods         -exec $LOADEXEC
     493#   periods         -timeout 120
     494#   npending        1
     495
     496#   task.exec
     497#      stdout NULL
     498#      stderr $LOGDIR/ns.chips.log
     499
     500#      book getpage nsData $ns_RchipPAGE -var date
     501#      book getword nsData $date nsState -var ns_STATE
     502#      book npages nsData -var Npages
     503
     504#     if ($VERBOSE > 5)
     505#        echo "ns.chips.run: " $ns_RchipPAGE $date $ns_STATE $Npages
     506#     end
    485507     
    486      $ns_RchipPAGE ++
    487      if ($ns_RchipPAGE >= $Npages) set ns_RchipPAGE = 0
    488      option $date
    489 
    490      if ("$ns_STATE" != "QUEUECHIPS") break
    491      $BURNTOOLING = 0
    492      $run = automate_stacks.pl --queue_chips --date $date
    493      command $run
    494    end
    495   # success
    496   task.exit   0
    497 #    convert 'stdout' to book format
    498     book delpage nsData $options:0
    499     ipptool2book stdout nsData -uniq -key date
    500 
    501     book getword nsData $options:0 nsNmacros -var ns_Nmacros
    502     if ("$ns_Nmacros" != "NULL")
    503         for i 0 $ns_Nmacros
    504             sprintf macroName "ns%dMacro" $i
    505             book getword nsData $options:0 $macroName -var macroCmd
    506             $macroCmd
    507         end
    508     end
    509 
    510     if ($VERBOSE > 2)
    511         book listbook nsData
    512     end
    513   end
    514 
    515   # locked list
    516   task.exit    default
    517     showcommand failure
    518   end
    519   task.exit    crash
    520     showcommand crash
    521   end
    522   #operation times out?
    523   task.exit    timeout
    524     showcommand timeout
    525   end
    526 end
     508#      $ns_RchipPAGE ++
     509#      if ($ns_RchipPAGE >= $Npages) set ns_RchipPAGE = 0
     510#      option $date
     511
     512#      if ("$ns_STATE" != "QUEUECHIPS") break
     513#      $BURNTOOLING = 0
     514#      $run = automate_stacks.pl --queue_chips --date $date
     515#      command $run
     516#    end
     517#   # success
     518#   task.exit   0
     519# #    convert 'stdout' to book format
     520#     book delpage nsData $options:0
     521#     ipptool2book stdout nsData -uniq -key date
     522
     523#     book getword nsData $options:0 nsNmacros -var ns_Nmacros
     524#     if ("$ns_Nmacros" != "NULL")
     525#       for i 0 $ns_Nmacros
     526#           sprintf macroName "ns%dMacro" $i
     527#           book getword nsData $options:0 $macroName -var macroCmd
     528#           $macroCmd
     529#       end
     530#     end
     531
     532#     if ($VERBOSE > 2)
     533#       book listbook nsData
     534#     end
     535#   end
     536
     537#   # locked list
     538#   task.exit    default
     539#     showcommand failure
     540#   end
     541#   task.exit    crash
     542#     showcommand crash
     543#   end
     544#   #operation times out?
     545#   task.exit    timeout
     546#     showcommand timeout
     547#   end
     548# end
    527549
    528550
     
    557579     command $run
    558580   end
     581
    559582  # success
    560583  task.exit   0
     
    718741end
    719742
    720 #
    721 # Generate a list of date ranges and chips that need to be processed with burntool
    722 #
    723 task              ns.burntool.load
    724   host            local
    725   periods         -poll $LOADPOLL
    726   periods         -exec $LOADEXEC
    727   periods         -timeout 30
    728   npending        1
    729 
    730   task.exec
    731     stdout NULL
    732     stderr $LOGDIR/ns.burntool.log
    733 
    734     book getpage nsData $ns_burnPAGE -var date
    735     book getword nsData $date nsState -var ns_STATE
    736     book npages nsData -var Npages
    737 
    738     if ($VERBOSE > 5)
    739         echo "ns.burntool.load: " $ns_burnPAGE $date $ns_STATE $Npages
    740     end
    741 
    742     $ns_burnPAGE ++
    743     if ($ns_burnPAGE >= $Npages) set ns_burnPAGE = 0
    744     option $date
     743# #
     744# # Generate a list of date ranges and chips that need to be processed with burntool
     745# #
     746# task              ns.burntool.load
     747#   host            local
     748#   periods         -poll $LOADPOLL
     749#   periods         -exec $LOADEXEC
     750#   periods         -timeout 30
     751#   npending        1
     752
     753#   task.exec
     754#     stdout NULL
     755#     stderr $LOGDIR/ns.burntool.log
     756
     757#     book getpage nsData $ns_burnPAGE -var date
     758#     book getword nsData $date nsState -var ns_STATE
     759#     book npages nsData -var Npages
     760
     761#     if ($VERBOSE > 5)
     762#         echo "ns.burntool.load: " $ns_burnPAGE $date $ns_STATE $Npages
     763#     end
     764
     765#     $ns_burnPAGE ++
     766#     if ($ns_burnPAGE >= $Npages) set ns_burnPAGE = 0
     767#     option $date
    745768   
    746     if ("$ns_STATE" != "NEEDSBURNING") break
    747 
    748     $run = automate_stacks.pl --define_burntool --date $date
    749     command $run
    750   end
    751   # success
    752   task.exit   0
    753 #    convert 'stdout' to book format
    754 #    book delpage nsBurntool $options:0
    755     ipptool2book stdout nsBurntool -uniq -key date
    756     book setword nsData $options:0 nsState "QUEUEBURNING"
    757 
    758     book getword nsData $options:0 nsNmacros -var ns_Nmacros
    759     if ("$ns_Nmacros" != "NULL")
    760         for i 0 $ns_Nmacros
    761             sprintf macroName "ns%dMacro" $i
    762             book getword nsData $options:0 $macroName -var macroCmd
    763             $macroCmd
    764         end
    765     end
    766 
    767     if ($VERBOSE > 2)
    768         book listbook nsData
    769     end
    770   end
    771 
    772   # locked list
    773   task.exit    default
    774     showcommand failure
    775   end
    776   task.exit    crash
    777     showcommand crash
    778   end
    779   #operation times out?
    780   task.exit    timeout
    781     showcommand timeout
    782   end
    783 end
    784 
    785 #
    786 # Magically run burntool on the data, based on the information stored in our book.
    787 #
    788 task              ns.burntool.run
    789   periods         -poll $LOADPOLL
    790   periods         -exec $LOADEXEC
    791   periods         -timeout 10800
    792   npending        30
    793   task.exec
    794      stdout NULL
    795      stderr $LOGDIR/ns.burntool.log
    796 
    797      book getpage nsData $ns_RburnPAGE -var date
    798      book getword nsData $date nsState -var ns_STATE
    799      book npages nsData -var Npages
    800 
    801     if ($VERBOSE > 5)
    802         echo "ns.burntool.run: " $ns_RburnPAGE $date $ns_STATE $Npages
    803     end
    804 
    805     $ns_RburnPAGE ++
    806     if ($ns_RburnPAGE >= $Npages) set ns_RburnPAGE = 0
    807     if (("$ns_STATE" != "QUEUEBURNING")&&("$ns_STATE" != "BURNING")) break
    808     $BURNTOOLING = 1
    809     # Find out where in the list of jobs we are
    810     book getword nsBurntool $date btN -var btN
    811     book getword nsBurntool $date btNCounter -var btNcounter
    812 
    813     if ($VERBOSE > 5)
    814         echo "ns.burntool.run: Status: " $btNcounter $date
    815     end
    816 
    817     if ("$ns_STATE" == "QUEUEBURNING")
    818         $new_state = "QUEUEBURNING"
    819     end
    820     if ("$ns_STATE" == "BURNING")
    821         $new_state = "BURNING"
    822     end
    823     if ($btNcounter + 1 > $btN)
    824         $new_state = "BURNING"
    825     end
    826     if ($btNcounter > $btN)
    827         $btNcounter = 0
    828     end
    829     if ($VERBOSE > 5)
    830         echo "ns.burntool.run: Status: " $btNcounter $new_state
    831     end
     769#     if ("$ns_STATE" != "NEEDSBURNING") break
     770
     771#     $run = automate_stacks.pl --define_burntool --date $date
     772#     command $run
     773#   end
     774#   # success
     775#   task.exit   0
     776# #    convert 'stdout' to book format
     777# #    book delpage nsBurntool $options:0
     778#     ipptool2book stdout nsBurntool -uniq -key date
     779#     book setword nsData $options:0 nsState "QUEUEBURNING"
     780
     781#     book getword nsData $options:0 nsNmacros -var ns_Nmacros
     782#     if ("$ns_Nmacros" != "NULL")
     783#       for i 0 $ns_Nmacros
     784#           sprintf macroName "ns%dMacro" $i
     785#           book getword nsData $options:0 $macroName -var macroCmd
     786#           $macroCmd
     787#       end
     788#     end
     789
     790#     if ($VERBOSE > 2)
     791#       book listbook nsData
     792#     end
     793#   end
     794
     795#   # locked list
     796#   task.exit    default
     797#     showcommand failure
     798#   end
     799#   task.exit    crash
     800#     showcommand crash
     801#   end
     802#   #operation times out?
     803#   task.exit    timeout
     804#     showcommand timeout
     805#   end
     806# end
     807
     808# #
     809# # Magically run burntool on the data, based on the information stored in our book.
     810# #
     811# task              ns.burntool.run
     812#   periods         -poll $LOADPOLL
     813#   periods         -exec $LOADEXEC
     814#   periods         -timeout 10800
     815#   npending        30
     816#   task.exec
     817#      stdout NULL
     818#      stderr $LOGDIR/ns.burntool.log
     819
     820#      book getpage nsData $ns_RburnPAGE -var date
     821#      book getword nsData $date nsState -var ns_STATE
     822#      book npages nsData -var Npages
     823
     824#     if ($VERBOSE > 5)
     825#         echo "ns.burntool.run: " $ns_RburnPAGE $date $ns_STATE $Npages
     826#     end
     827
     828#     $ns_RburnPAGE ++
     829#     if ($ns_RburnPAGE >= $Npages) set ns_RburnPAGE = 0
     830#     if (("$ns_STATE" != "QUEUEBURNING")&&("$ns_STATE" != "BURNING")) break
     831#     $BURNTOOLING = 1
     832#     # Find out where in the list of jobs we are
     833#     book getword nsBurntool $date btN -var btN
     834#     book getword nsBurntool $date btNCounter -var btNcounter
     835
     836#     if ($VERBOSE > 5)
     837#       echo "ns.burntool.run: Status: " $btNcounter $date
     838#     end
     839
     840#     if ("$ns_STATE" == "QUEUEBURNING")
     841#       $new_state = "QUEUEBURNING"
     842#     end
     843#     if ("$ns_STATE" == "BURNING")
     844#       $new_state = "BURNING"
     845#     end
     846#     if ($btNcounter + 1 > $btN)
     847#       $new_state = "BURNING"
     848#     end
     849#     if ($btNcounter > $btN)
     850#       $btNcounter = 0
     851#     end
     852#     if ($VERBOSE > 5)
     853#       echo "ns.burntool.run: Status: " $btNcounter $new_state
     854#     end
    832855   
    833     # Increment the counter in the book for the next job.
    834     $counter_update = $btNcounter + 1
    835     book setword nsBurntool $date btNCounter $counter_update
    836 #    book setword nsData $options:0 nsState $options:1
    837     book setword nsData $date nsState $new_state
    838 
    839     # Get the current status of this job, and skip if it doesn't need to process.
    840     sprintf status_label     "bt%dStatus"  $btNcounter
    841     book getword nsBurntool $date $status_label   -var status
    842 
    843     if ($VERBOSE > 5)
    844         echo "ns.burntool.run: Status: " $btNcounter $status $date $status_label
    845     end
    846     if (("$status" == "FINISHED")||("$status" == "RUN")) break 
     856#     # Increment the counter in the book for the next job.
     857#     $counter_update = $btNcounter + 1
     858#     book setword nsBurntool $date btNCounter $counter_update
     859# #    book setword nsData $options:0 nsState $options:1
     860#     book setword nsData $date nsState $new_state
     861
     862#     # Get the current status of this job, and skip if it doesn't need to process.
     863#     sprintf status_label     "bt%dStatus"  $btNcounter
     864#     book getword nsBurntool $date $status_label   -var status
     865
     866#     if ($VERBOSE > 5)
     867#       echo "ns.burntool.run: Status: " $btNcounter $status $date $status_label
     868#     end
     869#     if (("$status" == "FINISHED")||("$status" == "RUN")) break       
    847870   
    848     # Continue loading information to process this job
    849     sprintf start_date_label "bt%dBegin"   $btNcounter
    850     sprintf end_date_label   "bt%dEnd"     $btNcounter
    851     sprintf class_count_label "bt%dClass"   $btNcounter
    852 
    853     book getword nsBurntool $date $start_date_label -var start_date
    854     book getword nsBurntool $date $end_date_label -var end_date
    855     book getword nsBurntool $date $class_count_label -var chip_counter
    856 
    857     # Lookup class_id/host pairs
    858     list word -split $hostmatch:$chip_counter
    859     $class_id = $word:0
    860     $host = $word:1
    861     host $host
    862 #    set.host.for.camera GPC1 $class_id
    863     $logfile = "/data/$host.0/burntool_logs/$class_id.$start_date.log"
    864 
    865     $run = ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $start_date --dateobs_end $end_date --dbname gpc1 --logfile $logfile
     871#     # Continue loading information to process this job
     872#     sprintf start_date_label "bt%dBegin"   $btNcounter
     873#     sprintf end_date_label   "bt%dEnd"     $btNcounter
     874#     sprintf class_count_label "bt%dClass"   $btNcounter
     875
     876#     book getword nsBurntool $date $start_date_label -var start_date
     877#     book getword nsBurntool $date $end_date_label -var end_date
     878#     book getword nsBurntool $date $class_count_label -var chip_counter
     879
     880#     # Lookup class_id/host pairs
     881#     list word -split $hostmatch:$chip_counter
     882#     $class_id = $word:0
     883#     $host = $word:1
     884#     host $host
     885# #    set.host.for.camera GPC1 $class_id
     886#     $logfile = "/data/$host.0/burntool_logs/$class_id.$start_date.log"
     887
     888#     $run = ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $start_date --dateobs_end $end_date --dbname gpc1 --logfile $logfile
    866889       
    867     echo "ns.burntool.run: " $date $btN $btNcounter $start_date $end_date $chip_counter $class_id $host $logfile $run
    868     echo "ns.burntool.run: " $date $btN $btNcounter $chip_counter $new_state
    869 
    870     book setword nsBurntool $date $status_label RUN
    871     option $date $new_state $status_label
    872 
    873     command $run
    874 #     command /bin/true
    875    end
    876   # success
    877   task.exit   0
    878 #    convert 'stdout' to book format
    879     # Set data state based on if we're queueing or waiting
    880     # Set the job state for success.
    881     book setword nsBurntool $options:0 $options:2 FINISHED
    882 
    883     book getword nsData $options:0 nsNmacros -var ns_Nmacros
    884     if ("$ns_Nmacros" != "NULL")
    885         for i 0 $ns_Nmacros
    886             sprintf macroName "ns%dMacro" $i
    887             book getword nsData $options:0 $macroName -var macroCmd
    888             $macroCmd
    889         end
    890     end
    891 
    892     if ($VERBOSE > 2)
    893         book listbook nsData
    894     end
    895   end
    896 
    897   # locked list
    898   task.exit    default
    899     book setword nsBurntool $options:0 $options:2 FAIL
    900     showcommand failure
    901   end
    902   task.exit    crash
    903     book setword nsBurntool $options:0 $options:2 FAIL
    904     showcommand crash
    905   end
    906   #operation times out?
    907   task.exit    timeout
    908     book setword nsBurntool $options:0 $options:2 FAIL
    909     showcommand timeout
    910   end
    911 end
    912 
    913 
    914 #
    915 # This is all burntool related stuff.
    916 #
    917 
    918 macro burntool
    919   if ($0 != 3)
    920     echo "USAGE: burntool (dateobs_begin) (dateobs_end)"
    921     break
    922   end
    923 
    924   for i 0 $hostmatch:n
    925     job -host $word:1 ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $1 --dateobs_end $2 --dbname gpc1 --logfile $logfile
    926   end
    927 end
    928 macro loadhosts
    929   for i 0 $allhosts:n
    930     controller host add $allhosts:$i
    931   end
    932 end
    933 
    934 # sorry this list is messy, it's supposed to be that way to try and keep to burntools from running on the same host at the same time.
    935 
    936 list hostmatch
    937   XY01    ipp014
    938   XY03    ipp038
    939   XY05    ipp023
    940   XY10    ipp039
    941   XY12    ipp024
    942   XY15    ipp040
    943   XY17    ipp020
    944   XY21    ipp041
    945   XY23    ipp042
    946   XY25    ipp043
    947   XY27    ipp028
    948   XY31    ipp044
    949   XY33    ipp029
    950   XY35    ipp045
    951   XY37    ipp030
    952   XY41    ipp046
    953   XY43    ipp031
    954   XY45    ipp047
    955   XY47    ipp032
    956   XY51    ipp048
    957   XY53    ipp033
    958   XY55    ipp049
    959   XY57    ipp034
    960   XY61    ipp050
    961   XY63    ipp035
    962   XY65    ipp051
    963   XY67    ipp036
    964   XY72    ipp052
    965   XY74    ipp015
    966   XY76    ipp053
    967   XY02    ipp014
    968   XY04    ipp038
    969   XY06    ipp023
    970   XY11    ipp039
    971   XY13    ipp024
    972   XY14    ipp040
    973   XY16    ipp020
    974   XY20    ipp041
    975   XY22    ipp042
    976   XY24    ipp043
    977   XY26    ipp028
    978   XY30    ipp044
    979   XY32    ipp029
    980   XY34    ipp045
    981   XY36    ipp030
    982   XY40    ipp046
    983   XY42    ipp031
    984   XY44    ipp047
    985   XY46    ipp032
    986   XY50    ipp048
    987   XY52    ipp033
    988   XY54    ipp049
    989   XY56    ipp034
    990   XY60    ipp050
    991   XY62    ipp035
    992   XY64    ipp051
    993   XY66    ipp036
    994   XY71    ipp052
    995   XY73    ipp015
    996   XY75    ipp053
    997 end
    998 
    999 list allhosts
    1000   ipp043
    1001   ipp014
    1002   ipp015
    1003   ipp023
    1004   ipp024
    1005   ipp020
    1006   ipp028
    1007   ipp029
    1008   ipp030
    1009   ipp031
    1010   ipp032
    1011   ipp033
    1012   ipp034
    1013   ipp035
    1014   ipp036
    1015   ipp038
    1016   ipp039
    1017   ipp040
    1018   ipp041
    1019   ipp042
    1020   ipp044
    1021   ipp045
    1022   ipp046
    1023   ipp047
    1024   ipp048
    1025   ipp049
    1026   ipp050
    1027   ipp051
    1028   ipp052
    1029   ipp053
    1030 end
     890#     echo "ns.burntool.run: " $date $btN $btNcounter $start_date $end_date $chip_counter $class_id $host $logfile $run
     891#     echo "ns.burntool.run: " $date $btN $btNcounter $chip_counter $new_state
     892
     893#     book setword nsBurntool $date $status_label RUN
     894#     option $date $new_state $status_label
     895
     896#     command $run
     897# #     command /bin/true
     898#    end
     899#   # success
     900#   task.exit   0
     901# #    convert 'stdout' to book format
     902#     # Set data state based on if we're queueing or waiting
     903#     # Set the job state for success.
     904#     book setword nsBurntool $options:0 $options:2 FINISHED
     905
     906#     book getword nsData $options:0 nsNmacros -var ns_Nmacros
     907#     if ("$ns_Nmacros" != "NULL")
     908#       for i 0 $ns_Nmacros
     909#           sprintf macroName "ns%dMacro" $i
     910#           book getword nsData $options:0 $macroName -var macroCmd
     911#           $macroCmd
     912#       end
     913#     end
     914
     915#     if ($VERBOSE > 2)
     916#       book listbook nsData
     917#     end
     918#   end
     919
     920#   # locked list
     921#   task.exit    default
     922#     book setword nsBurntool $options:0 $options:2 FAIL
     923#     showcommand failure
     924#   end
     925#   task.exit    crash
     926#     book setword nsBurntool $options:0 $options:2 FAIL
     927#     showcommand crash
     928#   end
     929#   #operation times out?
     930#   task.exit    timeout
     931#     book setword nsBurntool $options:0 $options:2 FAIL
     932#     showcommand timeout
     933#   end
     934# end
     935
     936
     937# #
     938# # This is all burntool related stuff.
     939# #
     940
     941# macro burntool
     942#   if ($0 != 3)
     943#     echo "USAGE: burntool (dateobs_begin) (dateobs_end)"
     944#     break
     945#   end
     946
     947#   for i 0 $hostmatch:n
     948#     job -host $word:1 ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $1 --dateobs_end $2 --dbname gpc1 --logfile $logfile
     949#   end
     950# end
     951# macro loadhosts
     952#   for i 0 $allhosts:n
     953#     controller host add $allhosts:$i
     954#   end
     955# end
     956
     957# # sorry this list is messy, it's supposed to be that way to try and keep to burntools from running on the same host at the same time.
     958
     959# list hostmatch
     960#   XY01    ipp014
     961#   XY03    ipp038
     962#   XY05    ipp023
     963#   XY10    ipp039
     964#   XY12    ipp024
     965#   XY15    ipp040
     966#   XY17    ipp020
     967#   XY21    ipp041
     968#   XY23    ipp042
     969#   XY25    ipp043
     970#   XY27    ipp028
     971#   XY31    ipp044
     972#   XY33    ipp029
     973#   XY35    ipp045
     974#   XY37    ipp030
     975#   XY41    ipp046
     976#   XY43    ipp031
     977#   XY45    ipp047
     978#   XY47    ipp032
     979#   XY51    ipp048
     980#   XY53    ipp033
     981#   XY55    ipp049
     982#   XY57    ipp034
     983#   XY61    ipp050
     984#   XY63    ipp035
     985#   XY65    ipp051
     986#   XY67    ipp036
     987#   XY72    ipp052
     988#   XY74    ipp015
     989#   XY76    ipp053
     990#   XY02    ipp014
     991#   XY04    ipp038
     992#   XY06    ipp023
     993#   XY11    ipp039
     994#   XY13    ipp024
     995#   XY14    ipp040
     996#   XY16    ipp020
     997#   XY20    ipp041
     998#   XY22    ipp042
     999#   XY24    ipp043
     1000#   XY26    ipp028
     1001#   XY30    ipp044
     1002#   XY32    ipp029
     1003#   XY34    ipp045
     1004#   XY36    ipp030
     1005#   XY40    ipp046
     1006#   XY42    ipp031
     1007#   XY44    ipp047
     1008#   XY46    ipp032
     1009#   XY50    ipp048
     1010#   XY52    ipp033
     1011#   XY54    ipp049
     1012#   XY56    ipp034
     1013#   XY60    ipp050
     1014#   XY62    ipp035
     1015#   XY64    ipp051
     1016#   XY66    ipp036
     1017#   XY71    ipp052
     1018#   XY73    ipp015
     1019#   XY75    ipp053
     1020# end
     1021
     1022# list allhosts
     1023#   ipp043
     1024#   ipp014
     1025#   ipp015
     1026#   ipp023
     1027#   ipp024
     1028#   ipp020
     1029#   ipp028
     1030#   ipp029
     1031#   ipp030
     1032#   ipp031
     1033#   ipp032
     1034#   ipp033
     1035#   ipp034
     1036#   ipp035
     1037#   ipp036
     1038#   ipp038
     1039#   ipp039
     1040#   ipp040
     1041#   ipp041
     1042#   ipp042
     1043#   ipp044
     1044#   ipp045
     1045#   ipp046
     1046#   ipp047
     1047#   ipp048
     1048#   ipp049
     1049#   ipp050
     1050#   ipp051
     1051#   ipp052
     1052#   ipp053
     1053# end
  • trunk/ippTasks/register.pro

    r25418 r30049  
    88book init regPendingImfile
    99book init regPendingExp
     10book init regPendingBurntoolImfile
    1011
    1112macro register.reset
    1213  book init regPendingImfile
    1314  book init regPendingExp
     15  book init regPendingBurntoolImfile
    1416end
    1517
     
    1820  book listbook regPendingImfile
    1921  book listbook regPendingExp
     22  book listbook regPendingBurntoolImfile
    2023end
    2124
     
    3336    active true
    3437  end
     38  task register.burntool.load
     39    active true
     40  end
     41  task register.burntool.run
     42    active true
     43  end
    3544end
    3645
     
    4857    active false
    4958  end
    50 end
     59  task register.burntool.load
     60    active false
     61  end
     62  task register.burntool.run
     63    active false
     64  end
     65end
     66
     67$valid_burntool_value = 14
    5168
    5269macro replace.survey.values
     
    129146# these variables will cycle through the known database names
    130147$regPendingImfile_DB = 0
     148$regPendingBurntoolImfile_DB = 0
    131149$regPendingExp_DB = 0
    132150
     
    429447end
    430448
     449
     450# select imfiles that can now be burntooled.
     451task       register.burntool.load
     452  host     local
     453
     454  periods  -poll $LOADPOLL
     455  periods  -exec $LOADEXEC
     456  periods  -timeout 30
     457  npending 1
     458
     459  # silently drop stdout
     460  stdout NULL
     461  stderr $LOGDIR/register.burntool.load.log
     462 
     463  # select entried from the current DB; cycle to the next DB, if it exists
     464  task.exec
     465    $run = regtool -pendingburntoolimfile
     466    $today = `date -u +%Y-%m-%d`
     467# debugging purposes
     468    $today = "2010-12-06"
     469    $run = $run -date $today -valid_burntool $valid_burntool_value
     470    if ($DB:n == 0)
     471      option DEFAULT
     472    else
     473      # save the DB name for the exit tasks
     474      option $DB:$regPendingBurntoolImfile_DB
     475      $run = $run -dbname $DB:$regPendingBurntoolImfile_DB
     476      $regPendingBurntoolImfile_DB ++
     477      if ($regPendingBurntoolImfile_DB >= $DB:n) set regPendingBurntoolImfile_DB = 0
     478    end
     479
     480    echo $run
     481    add_poll_args run
     482    command $run
     483  end
     484
     485  # success
     486  task.exit $EXIT_SUCCESS
     487    # convert 'stdout' to book format
     488    ipptool2book stdout regPendingBurntoolImfile -key exp_id:class_id -uniq -setword dbname $options:0 -setword pantaskState INIT
     489    book shuffle regPendingBurntoolImfile
     490    if ($VERBOSE > 2)
     491      book listbook regPendingBurntoolImfile
     492    end
     493
     494    # delete existing entries in the appropriate pantasksStates
     495    process_cleanup regPendingBurntoolImfile
     496  end
     497
     498  # locked list
     499  task.exit   default
     500    showcommand failure
     501  end
     502  task.exit   crash
     503    showcommand crash
     504  end
     505  task.exit   timeout
     506    showcommand timeout
     507  end
     508end
     509
     510# run the ipp_apply_burntool_single.pl script on the pending images
     511task          register.burntool.run
     512  periods     -poll $RUNPOLL
     513  periods     -exec $RUNEXEC
     514  periods     -timeout 30
     515
     516  task.exec
     517    if ($NETWORK == 0) break
     518    book npages regPendingBurntoolImfile -var N
     519    if ($N == 0)
     520      periods -exec $RUNEXEC
     521      break
     522    end
     523    periods -exec 0.05
     524
     525    # look for new images to burn in regPendingBurntoolImfile
     526    book getpage regPendingBurntoolImfile 0 -var pageName -key pantaskState INIT
     527    if ("$pageName" == "NULL") break
     528
     529    book setword regPendingBurntoolImfile $pageName pantaskState RUN
     530
     531    book getword regPendingBurntoolImfile $pageName exp_id      -var EXP_ID
     532    book getword regPendingBurntoolImfile $pageName class_id    -var CLASS_ID
     533    book getword regPendingBurntoolImfile $pageName uri         -var THIS_URI
     534    book getword regPendingBurntoolImfile $pageName previous_uri -var PREVIOUS_URI
     535    book getword regPendingBurntoolImfile $pageName camera      -var CAMERA
     536    book getword regPendingBurntoolImfile $pageName dbname      -var DBNAME
     537    set.host.for.camera $CAMERA $CLASS_ID
     538
     539    stdout $LOGDIR/register.burntool.run.log
     540    stderr $LOGDIR/register.burntool.run.log
     541
     542    $run = ipp_apply_burntool_single.pl --exp_id $EXP_ID --class_id $CLASS_ID --this_uri $THIS_URI
     543    if ("$PREVIOUS_URI" != "NULL")
     544      $run = $run --previous_uri $PREVIOUS_URI
     545    end
     546
     547    add_standard_args run
     548
     549    options $pageName
     550
     551    if ($VERBOSE > 1)
     552      echo command $run
     553    end
     554    command $run
     555  end
     556
     557  # default exit status
     558  task.exit default
     559    process_exit regPendingBurntoolImfile $options:0 $JOB_STATUS
     560  end
     561
     562  # locked list
     563  task.exit crash
     564    showcommand crash
     565    echo "hostname: $JOB_HOSTNAME"
     566    book setword regPendingBurntoolImfile $options:0 pantaskState CRASH
     567  end
     568
     569  # operation timed out
     570  task.exit  timeout
     571    showcommand timeout
     572    book setword regPendingBurntoolImfile $options:0 pantaskState TIMEOUT
     573  end
     574end
     575
     576   
     577   
     578 
    431579## XXX add a global path to output files 
Note: See TracChangeset for help on using the changeset viewer.