Changeset 733


Ignore:
Timestamp:
May 12, 2007 5:53:51 PM (17 years ago)
Author:
mmc
Message:

Fixed long messages (usually resulting from "Problem launching job")
so that they will show as much of the job output (including the tail
end) and as much of the Rappture input as it can. It used to show
the first part of job output and the last part of the Rappture input,
and that wasn't very helpful.

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/analyzer.tcl

    r728 r733  
    395395        # It may be a real problem.
    396396        if {[Rappture::bugreport::shouldReport for jobs]} {
    397             Rappture::bugreport::register "Problem launching job:\n\n$result\n-----\n[$_tool xml xml]"
     397            Rappture::bugreport::register "Problem launching job:\n\n$result\n== RAPPTURE INPUT ==\n[$_tool xml xml]"
    398398        }
    399399    } else {
  • trunk/gui/scripts/bugreport.tcl

    r728 r733  
    215215
    216216    # make sure that the stack trace isn't too long
    217     if {[string length $stackTrace] > 20000} {
    218         set stackTrace "[string range $stackTrace 0 20000]..."
     217    set toolong 20000
     218    if {[string length $stackTrace] > $toolong} {
     219        #
     220        # If this came from "Problem launching job", then it will have
     221        # a "== RAPPTURE INPUT ==" part somewhere in the middle.  Try
     222        # to show the first part, this middle part, and the very last
     223        # part, cutting out whatever we have to in the middle.
     224        #
     225        if {[regexp -indices {\n== RAPPTURE INPUT ==\n} $stackTrace match]} {
     226            foreach {smid0 smid1} $match break
     227            set quarter [expr {$toolong/4}]
     228            set s0 $quarter
     229            set smid0 [expr {$smid0-$quarter}]
     230            set smid1 [expr {$smid1+$quarter}]
     231            set s1 [expr {[string length $stackTrace]-$quarter}]
     232
     233            if {$smid0 < $s0} {
     234                # first part is short -- truncate last part
     235                set stackTrace "[string range $stackTrace 0 $smid1]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-($toolong-$smid1)}] end]"
     236            } elseif {$smid1 > $s1} {
     237                # last part is short -- truncate first part
     238                set tailsize [expr {[string length $stackTrace]-$smid0}]
     239                set stackTrace "[string range $stackTrace 0 [expr {$toolong-$tailsize}]]\n...\n[string range $stackTrace $smid0 end]"
     240            } else {
     241                # rappture input line is right about in the middle
     242                set stackTrace "[string range $stackTrace 0 $s0]\n...\n[string range $stackTrace $smid0 $smid1]\n...\n[string range $stackTrace $s1 end]"
     243            }
     244        } else {
     245            # no Rappture input -- just show first part and last part
     246            set half [expr {$toolong/2}]
     247            set stackTrace "[string range $stackTrace 0 $half]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-$half}] end]"
     248        }
    219249    }
    220250
Note: See TracChangeset for help on using the changeset viewer.