Changeset 462


Ignore:
Timestamp:
Jun 5, 2006 9:21:06 PM (14 years ago)
Author:
mmc
Message:

Fixed nanovis to take a series of server names as a comma-separated
list, and to try them one after another to make a connection. That
way, if one server is down, you can still reach the rest of the farm.

Added a customized bug handler that looks a little less frightening
than the standard Tcl dialog. Someday, this should log all errors
to a web service, but for now, it just encourages the user to do so.

Location:
trunk/gui
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/apps/driver

    r413 r462  
    2929package require Rappture
    3030package require RapptureGUI
     31
     32# install a better bug handler
     33Rappture::bugreport::install
    3134
    3235option add *MainWin.mode desktop startupFile
  • trunk/gui/scripts/field3dresult.tcl

    r460 r462  
    4040
    4141    # resources file tells us the nanovis server
    42     public common _nanovisHost ""
    43     public common _nanovisPort ""
    44     public proc setNanovisServer {name} {
    45         if {[regexp {^([a-zA-Z0-9\.]+):([0-9]+)$} $name match host port]} {
    46             set _nanovisHost $host
    47             set _nanovisPort $port
     42    public common _nanovisHosts ""
     43    public proc setNanovisServer {namelist} {
     44        if {[regexp {^[a-zA-Z0-9\.]+:[0-9]+(,[a-zA-Z0-9\.]+:[0-9]+)*$} $namelist match]} {
     45            set _nanovisHosts $namelist
    4846        } else {
    49             error "bad nanovis server address \"$name\": should be host:port"
     47            error "bad nanovis server address \"$namelist\": should be host:port,host:port,..."
    5048        }
    5149    }
     
    7270    array set flags $args
    7371
    74     if {"" != $_nanovisHost && "" != $_nanovisPort && $flags(-mode) != "vtk"} {
     72    if {"" != $_nanovisHosts && $flags(-mode) != "vtk"} {
    7573        itk_component add renderer {
    76             Rappture::NanovisViewer $itk_interior.ren \
    77                 $_nanovisHost $_nanovisPort
     74            Rappture::NanovisViewer $itk_interior.ren $_nanovisHosts
    7875        }
    7976        pack $itk_component(renderer) -expand yes -fill both
  • trunk/gui/scripts/nanovisviewer.tcl

    r459 r462  
    3434    itk_option define -plotoutline plotOutline PlotOutline ""
    3535
    36     constructor {host port args} { # defined below }
     36    constructor {hostlist args} { # defined below }
    3737    destructor { # defined below }
    3838
     
    4343    public method download {option}
    4444
    45     public method connect {{host ""} {port ""}}
     45    public method connect {{hostlist ""}}
    4646    public method disconnect {}
    4747    public method isconnected {}
     
    7171    private variable _dispatcher "" ;# dispatcher for !events
    7272
    73     private variable _nvhost ""    ;# host name for nanovis server
    74     private variable _nvport ""    ;# port number for nanovis server
     73    private variable _nvhosts ""   ;# list of hosts for nanovis server
    7574    private variable _sid ""       ;# socket connection to nanovis server
    7675    private variable _parser ""    ;# interpreter for incoming commands
     
    9897# CONSTRUCTOR
    9998# ----------------------------------------------------------------------
    100 itcl::body Rappture::NanovisViewer::constructor {nvhost nvport args} {
     99itcl::body Rappture::NanovisViewer::constructor {hostlist args} {
    101100    Rappture::dispatcher _dispatcher
    102101    $_dispatcher register !legend
     
    412411    eval itk_initialize $args
    413412
    414     connect $nvhost $nvport
     413    connect $hostlist
    415414}
    416415
     
    590589
    591590# ----------------------------------------------------------------------
    592 # USAGE: connect ?<host>? ?<port>?
     591# USAGE: connect ?<host:port>,<host:port>...?
    593592#
    594593# Clients use this method to establish a connection to a new
     
    596595# Any existing connection is automatically closed.
    597596# ----------------------------------------------------------------------
    598 itcl::body Rappture::NanovisViewer::connect {{host ""} {port ""}} {
     597itcl::body Rappture::NanovisViewer::connect {{hostlist ""}} {
    599598    disconnect
    600599
    601     if {"" != $host} { set _nvhost $host }
    602     if {"" != $port} { set _nvport $port }
    603 
    604     if {"" == $_nvhost || "" == $_nvport} {
     600    if {"" != $hostlist} { set _nvhosts $hostlist }
     601
     602    if {"" == $_nvhosts} {
    605603        return 0
    606604    }
     
    616614    # forward us to another.
    617615    #
     616    set try [split $_nvhosts ,]
     617    foreach {hostname port} [split [lindex $try 0] :] break
     618    set try [lrange $try 1 end]
     619
    618620    while {1} {
    619         if {[catch {socket $_nvhost $_nvport} sid]} {
    620             return 0
     621        if {[catch {socket $hostname $port} sid]} {
     622            if {[llength $try] == 0} {
     623                return 0
     624            }
     625            foreach {hostname port} [split [lindex $try 0] :] break
     626            set try [lrange $try 1 end]
     627            continue
    621628        }
    622629        fconfigure $sid -translation binary -encoding binary
Note: See TracChangeset for help on using the changeset viewer.