Ignore:
Timestamp:
Feb 23, 2008 8:16:38 PM (15 years ago)
Author:
mmc
Message:

Final tweaks on the optimization package. The demo now works properly.
Just run "wish simple.tcl" to see it work.

Fixed the Tool class to work better with the optimizer. The "run"
method now returns the result directly as a Rappture::Library object,
and the Analyzer merely loads the object.

File:
1 edited

Legend:

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

    r775 r903  
    4040
    4141    public common _resources
    42     public proc setAppName {name} { set _resources(-appname) $name }
    43     public proc setHubName {name} { set _resources(-hubname) $name }
    44     public proc setHubURL {name}  { set _resources(-huburl) $name }
    45     public proc setSession {name} { set _resources(-session) $name }
    46     public proc setJobPrt {name}  { set _resources(-jobprotocol) $name }
     42    public proc setAppName {name}   { set _resources(-appname) $name }
     43    public proc setHubName {name}   { set _resources(-hubname) $name }
     44    public proc setHubURL {name}    { set _resources(-huburl) $name }
     45    public proc setSession {name}   { set _resources(-session) $name }
     46    public proc setJobPrt {name}    { set _resources(-jobprotocol) $name }
     47    public proc setResultDir {name} { set _resources(-resultdir) $name }
    4748}
    4849
     
    5051proc tool_init_resources {} {
    5152    Rappture::resources::register \
    52         application_name Rappture::Tool::setAppName \
    53         application_id   Rappture::Tool::setAppId \
    54         hub_name         Rappture::Tool::setHubName \
    55         hub_url          Rappture::Tool::setHubURL \
    56         session_token    Rappture::Tool::setSession \
    57         job_protocol     Rappture::Tool::setJobPrt
     53        application_name  Rappture::Tool::setAppName \
     54        application_id    Rappture::Tool::setAppId \
     55        hub_name          Rappture::Tool::setHubName \
     56        hub_url           Rappture::Tool::setHubURL \
     57        session_token     Rappture::Tool::setSession \
     58        job_protocol      Rappture::Tool::setJobPrt \
     59        results_directory Rappture::Tool::setResultDir
    5860}
    5961                                                                               
     
    263265    #
    264266    if {$status == 0} {
    265         set file [string trim $job(output)]
    266         return [list $status $file]
     267        set result [string trim $job(output)]
     268        if {[regexp {=RAPPTURE-RUN=>([^\n]+)} $result match file]} {
     269            set status [catch {Rappture::library $file} result]
     270            if {$status != 0} {
     271                global errorInfo
     272                set result "$result\n$errorInfo"
     273            }
     274
     275            # if there's a results_directory defined in the resources
     276            # file, then move the run.xml file there for storage
     277            if {[info exists _resources(-resultdir)]
     278                  && "" != $_resources(-resultdir)} {
     279                catch {
     280                    if {![file exists $_resources(-resultdir)]} {
     281                        _mkdir $_resources(-resultdir)
     282                    }
     283                    file rename -force -- $file $_resources(-resultdir)
     284                }
     285            }
     286        } else {
     287            set status 1
     288            set result "Can't find result file in output.\nDid you call Rappture
     289::result in your simulator?"
     290        }
     291        return [list $status $result]
    267292    } elseif {"" != $job(output) || "" != $job(error)} {
    268293        return [list $status [string trim "$job(output)\n$job(error)"]]
Note: See TracChangeset for help on using the changeset viewer.