Changeset 158


Ignore:
Timestamp:
Jan 29, 2006 8:24:25 PM (15 years ago)
Author:
mmc
Message:
  • Fixed installation so that this "gui" part can be installed with standard autoconf techniques: configure, make all, make install The "gui" library is loaded via "package require RapptureGUI"
  • Added C code for Rappture::rlimit, to support limits on CPU time and file sizes. Default limits are 15 mins of CPU and 1MB for each file. These can be overridden in tool.xml by using <tool><limits><cputime> and <tool><limits><filesize>.
  • Added C code for Rappture::rusage, so we can collect resource usage for all child processes. Each Simulation now reports a line of usage to stderr as follows:

MiddlewareTime?: job=# event=simulation start=xxx cputime=xxx ...

  • Fixed Rappture::exec so that it reports proper error messages when rlimits are execeeded.
Location:
trunk
Files:
18 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/apps/driver

    r115 r158  
    2727
    2828package require Rappture
     29package require RapptureGUI
    2930
    3031option add *MainWin.mode desktop startupFile
  • trunk/gui/scripts/exec.tcl

    r115 r158  
    2828proc Rappture::exec {args} {
    2929    variable execout
     30    variable execctl
    3031
    3132    set execout(output) ""
     
    3334    set execout(extra) ""
    3435
    35     eval blt::bgexec control \
     36    set status [catch {eval blt::bgexec ::Rappture::execctl \
    3637        -keepnewline yes \
    3738        -onoutput {{::Rappture::_exec_out stdout}} \
    3839        -onerror {{::Rappture::_exec_out stderr}} \
    39         $args
     40        $args} result]
    4041
    4142    # add any extra stuff pending from the last stdout/stderr change
    4243    append execout(output) $execout(extra)
    4344
     45    if {$status != 0} {
     46        if {[regexp {^KILLED} $execctl] && [llength $execctl] == 4} {
     47            set reason [lindex $execctl end]
     48            set result "job killed: $reason"
     49        }
     50        error $result
     51    }
    4452    return $execout(output)
    4553}
  • trunk/gui/scripts/tool.tcl

    r115 r158  
    3434    private variable _outputcb ""    ;# callback for tool output
    3535    private common job               ;# array var used for blt::bgexec jobs
     36    private common jobnum 0          ;# counter for unique job number
    3637}
    3738                                                                               
     
    103104    } result]
    104105
     106    # set limits for cpu time and file size
     107    set limit [$_xmlobj get tool.limits.cputime]
     108    if {"" == $limit || [catch {Rappture::rlimit set cputime $limit}]} {
     109        Rappture::rlimit set cputime 900  ;# 15 mins by default
     110    }
     111
     112    set limit [$_xmlobj get tool.limits.filesize]
     113    if {"" == $limit || [catch {Rappture::rlimit set filesize $limit}]} {
     114        Rappture::rlimit set filesize 1000000  ;# 1MB by default
     115    }
     116
    105117    # execute the tool using the path from the tool description
    106118    if {$status == 0} {
     
    108120        regsub -all @tool $cmd $_installdir cmd
    109121        regsub -all @driver $cmd $file cmd
     122
     123        # starting job...
     124        Rappture::rusage mark
    110125
    111126        set status [catch {eval blt::bgexec \
     
    115130            -output ::Rappture::Tool::job(output) \
    116131            -error ::Rappture::Tool::job(error) $cmd} result]
     132
     133        # ...job is finished
     134        array set times [Rappture::rusage measure]
     135        puts stderr "MiddlewareTime: job=[incr jobnum] event=simulation start=$times(start) walltime=$times(walltime) cputime=$times(cputime) status=$status"
     136
    117137    } else {
    118138        set job(error) "$result\n$errorInfo"
  • trunk/tcl/install.tcl

    r115 r158  
    1616
    1717set package "Rappture"
    18 set version "0.9"
     18set version "1.0"
    1919
    2020proc find {dir} {
     
    5050}
    5151
    52 set origdir [pwd]
    53 foreach context {. ../gui} {
    54     cd $context
    55 
    56     foreach file [find .] {
    57         set target [file join $targetdir $file]
    58         if {[file isdirectory $file]} {
    59             puts "making directory $target..."
    60             catch {file mkdir $target}
    61             fixperms $target ugo+rx
    62         } else {
    63             puts "installing $target..."
    64             file copy -force $file $target
    65             fixperms $target ugo+r
    66         }
    67     }
     52set sdir [file join $targetdir scripts]
     53if {![file exists $sdir]} {
     54    puts "making directory $sdir..."
     55    catch {file mkdir $sdir}
     56    fixperms $sdir ugo+rx
    6857}
    6958
    70 cd ..
    71 catch {file mkdir [file join $targetdir lib]}
    72 foreach file [find ./lib] {
    73     set target [file join $targetdir $file]
    74     if {[file isdirectory $file]} {
    75         puts "making directory $target..."
    76         catch {file mkdir $target}
    77         fixperms $target ugo+rx
    78     } else {
    79         puts "installing $target..."
    80         file copy -force $file $target
    81         fixperms $target ugo+r
    82     }
     59foreach file {
     60    ./scripts/library.tcl
     61    ../gui/scripts/exec.tcl
     62    ../gui/scripts/units.tcl
     63    ../gui/scripts/result.tcl
     64} {
     65    set target [file join $targetdir scripts [file tail $file]]
     66    puts "installing $target..."
     67    file copy -force $file $target
     68    fixperms $target ugo+r
    8369}
    84 
    85 cd $origdir
    8670
    8771set fid [open [file join $targetdir pkgIndex.tcl] w]
Note: See TracChangeset for help on using the changeset viewer.