IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27181


Ignore:
Timestamp:
Mar 3, 2010, 5:48:54 PM (16 years ago)
Author:
watersc1
Message:

Updated burntool code. This should auto-requeue failures. At least it did for my test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTasks/nightly_stacks.pro

    r26950 r27181  
    107107
    108108book init nsData
     109book init nsBurntool
    109110#
    110111# Macros to control the book.
     
    122123       echo $date $state
    123124    end
     125    book npages nsBurntool -var Npages
    124126end
    125127
     
    265267    ipptool2book stdout nsData -uniq -key date
    266268
     269    # remove the burntool page if we're done with it.
     270    book getword nsData $options:0 nsState -var ns_STATE
     271    if ("$ns_STATE" == "QUEUECHIPS")
     272        book delpage nsBurntool $options:0
     273    end
     274
    267275    if ($VERBOSE > 2)
    268276        book listbook nsData
     
    427435    book delpage nsData $options:0
    428436# We've queued up stacking. We're done with this date, so don't reload the page.
    429 #    ipptool2book stdout nsData -uniq -key date
     437    ipptool2book stdout nsData -uniq -key date
    430438    if ($VERBOSE > 2)
    431439        book listbook nsData
     
    447455
    448456#
    449 # Generate a list of date ranges that need to be processed with burntool
     457# Generate a list of date ranges and chips that need to be processed with burntool
    450458#
    451459task              ns.burntool.load
     
    457465
    458466  task.exec
    459      stdout NULL
    460      stderr $LOGDIR/ns.burntool.log
    461 
    462      book getpage nsData $ns_burnPAGE -var date
    463      book getword nsData $date nsState -var ns_STATE
    464      book npages nsData -var Npages
    465 
    466     if ($VERBOSE > 5)
    467        echo "ns.burntool.load: " $ns_burnPAGE $date $ns_STATE $Npages
    468     end
    469 
    470      $ns_burnPAGE ++
    471      if ($ns_burnPAGE >= $Npages) set ns_burnPAGE = 0
    472      option $date
    473 
    474      if ("$ns_STATE" != "NEEDSBURNING") break
    475      $run = automate_stacks.pl --define_burntool --date $date
    476      command $run
    477    end
     467    stdout NULL
     468    stderr $LOGDIR/ns.burntool.log
     469
     470    book getpage nsData $ns_burnPAGE -var date
     471    book getword nsData $date nsState -var ns_STATE
     472    book npages nsData -var Npages
     473
     474    if ($VERBOSE > 5)
     475        echo "ns.burntool.load: " $ns_burnPAGE $date $ns_STATE $Npages
     476    end
     477
     478    $ns_burnPAGE ++
     479    if ($ns_burnPAGE >= $Npages) set ns_burnPAGE = 0
     480    option $date
     481   
     482    if ("$ns_STATE" != "NEEDSBURNING") break
     483
     484    $run = automate_stacks.pl --define_burntool --date $date
     485    command $run
     486  end
    478487  # success
    479488  task.exit   0
    480489#    convert 'stdout' to book format
    481     book delpage nsData $options:0
    482     ipptool2book stdout nsData -uniq -key date
     490#    book delpage nsBurntool $options:0
     491    ipptool2book stdout nsBurntool -uniq -key date
     492    book setword nsData $options:0 nsState "QUEUEBURNING"
     493
    483494    if ($VERBOSE > 2)
    484495        book listbook nsData
     
    500511
    501512#
    502 # Magically run burntool on the data, based on the time ranges stored in our book.
     513# Magically run burntool on the data, based on the information stored in our book.
    503514#
    504515task              ns.burntool.run
     
    516527
    517528    if ($VERBOSE > 5)
    518        echo "ns.burntool.run: " $ns_RburnPAGE $date $ns_STATE $Npages
    519     end
    520 
    521      $ns_RburnPAGE ++
    522      if ($ns_RburnPAGE >= $Npages) set ns_RburnPAGE = 0
    523 
    524      if ("$ns_STATE" != "QUEUEBURNING") break
    525         book getword nsData $date btN -var btN
    526         book getword nsData $date btNCounter -var btNcounter
    527 
    528         if ($btNcounter > $btN)
    529             book setword nsData $date nsState "BURNING"
    530             break
    531         end
    532 
    533         sprintf start_date_label "btBegin%d"   $btNcounter
    534         sprintf end_date_label   "btEnd%d"     $btNcounter
    535         sprintf counter_label    "btCounter%d" $btNcounter
    536 
    537         book getword nsData $date $start_date_label -var start_date
    538         book getword nsData $date $end_date_label -var end_date
    539         book getword nsData $date $counter_label -var chip_counter
     529        echo "ns.burntool.run: " $ns_RburnPAGE $date $ns_STATE $Npages
     530    end
     531
     532    $ns_RburnPAGE ++
     533    if ($ns_RburnPAGE >= $Npages) set ns_RburnPAGE = 0
     534    if (("$ns_STATE" != "QUEUEBURNING")&&("$ns_STATE" != "BURNING")) break
     535    # Find out where in the list of jobs we are
     536    book getword nsBurntool $date btN -var btN
     537    book getword nsBurntool $date btNCounter -var btNcounter
     538
     539    if ($VERBOSE > 5)
     540        echo "ns.burntool.run: Status: " $btNcounter $date
     541    end
     542
     543    if ("$ns_STATE" == "QUEUEBURNING")
     544        $new_state = "QUEUEBURNING"
     545    end
     546    if ("$ns_STATE" == "BURNING")
     547        $new_state = "BURNING"
     548    end
     549    if ($btNcounter > $btN)
     550        $new_state = "BURNING"
     551        $btNcounter = 0
     552    end
     553    if ($VERBOSE > 5)
     554        echo "ns.burntool.run: Status: " $btNcounter $new_state
     555    end
     556   
     557    # Increment the counter in the book for the next job.
     558    $counter_update = $btNcounter + 1
     559    book setword nsBurntool $date btNCounter $counter_update
     560
     561    # Get the current status of this job, and skip if it doesn't need to process.
     562    sprintf status_label     "bt%dStatus"  $btNcounter
     563    book getword nsBurntool $date $status_label   -var status
     564
     565    if ($VERBOSE > 5)
     566        echo "ns.burntool.run: Status: " $btNcounter $status $date $status_label
     567    end
     568    if (("$status" == "FINISHED")||("$status" == "RUN")) break 
     569   
     570    # Continue loading information to process this job
     571    sprintf start_date_label "bt%dBegin"   $btNcounter
     572    sprintf end_date_label   "bt%dEnd"     $btNcounter
     573    sprintf class_count_label "bt%dClass"   $btNcounter
     574
     575    book getword nsBurntool $date $start_date_label -var start_date
     576    book getword nsBurntool $date $end_date_label -var end_date
     577    book getword nsBurntool $date $class_count_label -var chip_counter
     578
     579    # Lookup class_id/host pairs
     580    list word -split $hostmatch:$chip_counter
     581    $class_id = $word:0
     582    $host = $word:1
     583    host $host
     584#    set.host.for.camera GPC1 $class_id
     585    $logfile = "burntool_logs/$class_id.$start_date.log"
     586
     587    $run = ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $start_date --dateobs_end $end_date --dbname gpc1 --logfile $logfile
    540588       
    541         list word -split $hostmatch:$chip_counter
    542         $class_id = $word:0
    543         $host = $word:1
    544         host $host
    545         $logfile = "burntool_logs/$class_id.$start_date.log"
    546 
    547         $run = ipp_apply_burntool.pl --class_id $class_id --dateobs_begin $start_date --dateobs_end $end_date --dbname gpc1 --logfile $logfile
    548        
    549         echo "ns.burntool.run: " $date $btN $btNcounter $start_date $end_date $chip_counter $class_id $host $logfile $run
    550         $chip_counter ++
    551         if ($chip_counter >= $hostmatch:n)
    552            $chip_counter = 0
    553            $btNcounter ++
    554         end
    555         $new_state = "QUEUEBURNING"
    556         if ($btNcounter > $btN)
    557             $new_state = "BURNING"
    558         end
    559 
    560         echo "ns.burntool.run: " $date $btN $btNcounter $chip_counter $new_state
    561         book setword nsData $date $counter_label $chip_counter
    562         book setword nsData $date btNCounter $btNcounter
    563         option $date $new_state
    564        
    565         command $run
     589    echo "ns.burntool.run: " $date $btN $btNcounter $start_date $end_date $chip_counter $class_id $host $logfile $run
     590    echo "ns.burntool.run: " $date $btN $btNcounter $chip_counter $new_state
     591
     592    book setword nsBurntool $date $status_label RUN
     593    option $date $new_state $status_label
     594
     595    command $run
    566596#     command /bin/true
    567597   end
     
    569599  task.exit   0
    570600#    convert 'stdout' to book format
    571 #    book delpage nsData $options:0
    572 #    ipptool2book stdout nsData -uniq -key date
     601    # Set data state based on if we're queueing or waiting
    573602    book setword nsData $options:0 nsState $options:1
    574 
     603    # Set the job state for success.
     604    book setword nsBurntool $options:0 $options:2 FINISHED
    575605    if ($VERBOSE > 2)
    576606        book listbook nsData
     
    580610  # locked list
    581611  task.exit    default
     612    book setword nsBurntool $options:0 $options:2 FAIL
    582613    showcommand failure
    583614  end
    584615  task.exit    crash
     616    book setword nsBurntool $options:0 $options:2 FAIL
    585617    showcommand crash
    586618  end
    587619  #operation times out?
    588620  task.exit    timeout
     621    book setword nsBurntool $options:0 $options:2 FAIL
    589622    showcommand timeout
    590623  end
Note: See TracChangeset for help on using the changeset viewer.