ParaView:Server Configuration

From KitwarePublic
Jump to navigationJump to search


Several sites have set of visualization clusters that are available to the users to connect to. These sites may want to provide a default set of server configurations available to the users. Additionally, there may be some options that may be needed to be specified before connecting to the server. All this can be managed using server configuration xmls. This document illustrates a few example use-cases.

Default Servers

When ParaView starts up, it looks for several server definition files in the following order:

  • On Unix-based systems and Mac OS X
    • default_servers.pvsc in the ParaView executable directory
    • $HOME/.config/ParaView/servers.pvsc
    • /usr/share/ParaView/servers.pvsc
  • On Windows
    • default_servers.pvsc in the ParaView executable directory
    • %APPDATA%\ParaView\servers.pvsc
    • %COMMON_APPDATA%\ParaView\servers.pvsc

If the same server is defined in multiple files, the definition read last will overwrite any previous definition.

Use Cases

Case One: Simple server connection

In this use-case, we are setting a configuration for a simple server connection (to a pvserver processes) running on a node named "amber1", at port 20234. The pvserver process will be started manually by the user.

  <Server name="case1" resource="cs://amber1:20234" owner="site">
    <ManualStartup />

Here, resource identifies the type if the connection (cs -- implying client-server), host name and port. If the port number i.e. :20234 part is not specified in the resource, then the default port number (which is 11111) is assumed; owner is simply used to determine edit-ability of the configuration from ParaView GUI (as explained earlier). Since the user starts pvserver processes manually, we use <ManualStartup /> tag.

Case Two: Server connection with user-specified port

This is the same as Case One except that we want to ask the user each time the port number to connect to the pvserver at.

  <Server name="case2" resource="cs://amber1" owner="site">
        <Option name="PV_SERVER_PORT" label="Server Port: ">
          <Range type="int" min="1" max="65535" step="1" default="11111" />

Here the only difference is the <Options/> element. This element is used to specify run-time options that the user specifies when connecting to the server. The Runtime Environment section defines some predefined variables that will be obtained from the user. In this case, we want to show the user an integral spin-box to select the port number, hence we use the <Range /> element to specify the type of the option. When the user connects to this server, he is shown a dialog similar to the following image:


Case Three: Simple connection to a data-server/render-server

This is the same as Case One, except that instead of a single server (i.e. pvserver) we are connecting to a separate render-server/data-server (pvrenderserver, pvdataserver) with data server running on port 20230 on amber1 and render server running port 20233 on node amber2

  <Server name="case3" resource="cdsrs://amber1:20230//amber2:20233" owner="site">
    <ManualStartup />

The only difference from case 1, is the resource specification. cdsrs indicates that it is a client-dataserver-renderserver configuration. The first host:port pair is the dataserver while the second one is the render server.

Case Four: Connection to a data-server/render-server with user specified server port

This is a combination of Case Two and Case Three, where we want to ask the user for the port number for both the render server and the data server.

  <Server name="case4" resource="cdsrs://localhost//localhost" owner="site">
        <Option name="PV_DATA_SERVER_PORT" label="Data Server Port: ">
          <Range type="int" min="1" max="65535" step="1" default="11111" />
        <Option name="PV_RENDER_SERVER_PORT" label="Render Server Port: ">
          <Range type="int" min="1" max="65535" step="1" default="22222" />

The XML is quite self-explanatory given what we have already seen. The options dialog produced by this XML looks as follows:


Case Five: Reverse Connection

By default the client connects to the server processes. However it is possible to tell the paraview client to wait for the server to connect to it instead. This is called a reverse connection. In such a case the server processes must be started with --reverse-connection or -rc flag.

To indicate reverse connection in the server configuration xml, the only change is suffixing the resource protocol part with "rc" (for reverse connection). eg.

 resource="csrc://localhost" -- connect to pvserver on localhost using reverse connection
 resource="cdsrsrc://localhost//localhost" -- connect to pvdataserver/pvrenderserver using reverse connection.

Case Six: Server connection including starting a pvserver

All the use-cases until now assumed that the user (or someone else) starts the server processes manually. That can be quite inconvenient. Fortunately, the server configuration is powerful enough to incorporate start of the server processes as well, as illustrated below:

   <Server name="case6" resource="cs://localhost" owner="site">
        <!-- The user chooses the port on which to start the server -->
        <Option name="PV_SERVER_PORT" label="Server Port: ">
          <Range type="int" min="1" max="65535" step="1" default="11111" />
      <Command exec="/home/utkarsh/Kitware/ParaView3/ParaView3Bin/bin/pvserver"
          <Argument value="-sp=$PV_SERVER_PORT$" />

In this case, the <ManualStartup/> element has been replaced by a <CommandStartup/> element, which contains <Command> elements which are the commands executed to start the server processes. Here, exec is the executable to run while delay indicates the time in seconds the client waits before attempting to connect to the server process. Command line arguments can be passed to the command executed using the <Arguments/> element. All runtime environment variables specified as $name$ are replaced with the actual values eg. in this case $PV_SERVER_PORT$ gets replaced by the port number chosen by the user in the options dialog.

Case Seven: Using connection-id

In many cases, a server cluster may be running different pvserver (or pvdataserver/pvrenderserver) processes for different users. In that case we need some level of authentication between the server and the client. This can be achieved (at a very basic level) with the connect-id option. If specified on the command line when starting the server processes (using --connect-id) then the server will allow only that client which reports the same connection id to connect.

This can be set up as follows:

 <Server name="case7" resource="cs://localhost" owner="site">
       <Option name="PV_CONNECT_ID" label="Connect ID" readonly="true">
         <Range type="int" min="1" max="65535" step="1" default="random" />
     <Command exec="/usr/bin/pvserver" delay="5">
         <Argument value="--connect-id=$PV_CONNECT_ID$" />

In this case, the readonly attribute on the <Option/> indicates that the value cannot be changed by the user, it is only shown for information purposes. The default value for the PV_CONNECT_ID is set to random so that ParaView makes up a value at run time.

Case Eight: Starting server using ssh

In this use case the server process is spawned on some remote host using ssh. We want the user to be able to specify the ssh executable. We also want to preserve the ssh executable path across ParaView sessions so that the user does not have to enter it each time.

  <Server name="case8" resource="cs://localhost:11111" owner="user">
        <Option name="SSH_USER" label="SSH Username" save="true">
          <!-- choose the username. Since 'save' is true, this value will 
               be maintained across sessions -->
          <String default="utkarsh" />
        <Option name="SSH_EXE" label="SSH Executable" save="true">
          <!-- select the SSH executable. Since 'save' is true, this value will
               also be maintinaed across sessions -->
          <File default="ssh" />
      <Command exec="$SSH_EXE$" delay="5">
          <Argument value="-L11111:amber5:11111" /> <!-- port forwarding -->
          <Argument value="amber5" />
          <Argument value="-l" />
          <Argument value="$SSH_USER$" />
          <Argument value="/usr/bin/pvserver" />


Note here that the value for the exec attribute is set to $SSH_EXE$ hence it gets replaced by the user selected ssh executable. We use the optional attribute save on the <Option/> element to tell ParaView to preserve the user chosen value across ParaView sessions so that the user doesn't have to enter the username and the ssh executable every time he wants to connect to this server.

Case Nine: Starting server using custom script with custom user-settable options

This example will illustrate the full capability of server configuration. Suppose we have a custom script "MyServerStarter" that takes in a bunch of arguments to start the server process. We want the user to be able to set up values for these arguments when he tries to connect to using this configuration. As an example, let's say MyServerStarter takes the following arguments:

  • --use-offscreen -- to indicate use of offscreen rendering
  • --use-onscreen -- to indicate on-screen rendering (this can be assumed from absence of --use-offscreen, but we are using it as an example)
  • --session-name=<string> -- some string identifying the session
  • --mpitype=<mpich1.2|mpich2|openmpi> -- choose between available MPI implementations
  • --num-procs=<num> -- number of server processess
  • --server-port -- port number passed the pvserver processes

All (except the --server-port) of these must be settable by the user at the connection time. This can be achieved as follows:

  <Server name="case9" resource="cs://localhost" owner="site">
        <Option name="OFFSCREEN" label="Use offscreen rendering">
          <Boolean true="--use-offscreen" false="--use-onscreen" default="false" />
        <Option name="SESSIONID" label="Session Identifier">
          <String default="session01"/>
        <Option name="MPITYPE" label="MPI Implementation">
          <Enumeration default="mpich1.2">
            <Entry value="mpich1.2" label="MPICH Ver. 1.2" />
            <Entry value="mpich2" label="MPICH Ver 2.0" />
            <Entry value="openmpi" label="Open MPI" />
        <Option name="NUMPROC" label="Number Of Processes">
          <Range type="int" min="1" max="256" step="4" default="1" />
      <Command exec="/tmp/MyServerStarter" delay="5">
          <Argument value="--server-port=$PV_SERVER_PORT$" />
          <Argument value="--mpitype=$MPITYPE$" />
          <Argument value="--num-procs=$NUMPROC$" />
          <Argument value="$OFFSCREEN$" />
          <Argument value="--session-name=$SESSIONID$" />

Each <Option /> defines a new run-time variable that can be accessed as ${name}$ in the <Command /> section. When the user tries to connect using this configuration, he is shown the following options dialog:


This can be extended to start the server processes using ssh or any batch scheduler etc. as may be the required by the server administrator. This can also be set up to use reverse connection (by changing the protocol in the resource attribute).

XML Schema

This default_server.pvsc is an xml file describing either the available server configurations. The structure of this xml is as follows:

  • The <Servers> tag is the root element of the document, which contains zero-to-many <Server> tags.
  • Each <Server> tag represents a configured server:
    • The "name" attribute uniquely identifies the server configuration, and is displayed in the user interface.
    • The "resource" attribute specifies the type of server connection, server host(s) and optional port(s) for making a connection. Values are
      • cs://<host>:<port> - for client-pvserver configurations with forward connection i.e. client connects to the server
      • csrc://<host>:<port> - for client-pvserver configurations with reverse connection i.e. server connects to the client
      • cdsrs://<ds-host>:<ds-port>//<rs-host>:<rs-port> - for client-pvdataserver-pvrenderserver configurations with forward connection
      • cdsrsrc://<ds-host>:<ds-port>//<rs-host>:<rs-port> - for client-pvdataserver-pvrenderserver configurations with reverse connection
    • The "owner" attribute specifies where the configuration originated, current valid values are "builtin" (the configuration was hard-coded into the application), "site" (the configuration was setup by site administrators), or "user" (the configuration was setup by the user). The client uses this information to set policy, e.g: "builtin" and "site" configurations are read-only, only "user" configurations are stored in per-user preferences, etc.
  • The <CommandStartup> tag is used to run an external command to start a server.
    • An optional <Options> tag can be used to prompt the user for options required at startup.
      • Each <Option> tag represents an option that the user will be prompted to modify before startup.
        • The "name" attribute defines the name of the option, which will become its variable name when used as a run-time environment variable, and for purposes of string-substitution in <Argument> tags.
        • The "label" attribute defines a human-readable label for the option, which will be used in the user interface.
        • The optional "readonly" attribute can be used to designate options which are user-visible, but cannot be modified.
        • The optional "save" attribute can be used to indicate that the value choosen by the user for this option will be saved in the registry so that it's preserved across ParaView sessions.
        • A <Range> tag designates a numeric option that is only valid over a range of values.
          • The "type" attribute controls the type of number controlled. Valid values are "int" for integers and "double" for floating-point numbers, respectively.
          • The "min" and "max" attributes specify the minimum and maximum allowable values for the option (inclusive).
          • The "step" attribute specifies the preferred amount to increment / decrement values in the user interface.
          • The "default" attribute specifies the initial value of the option.
            • As a special-case for integer ranges, a default value of "random" will generate a random number as the default each time the user is prompted for a value. This is particularly useful with PV_CONNECT_ID.
        • A <String> tag designates an option that accepts freeform text as its value.
          • The "default" attribute specifies the initial value of the option.
        • A <File> tag designates an option that accepts freeform text along with a file browse button to assist in choosing a filepath
          • The "default" attribute specifies the initial value of the option.
        • A <Boolean> tag designates an option that is either on/off or true/false.
          • The "true" attribute specifies what the option value will be if enabled by the user.
          • The "false" attribute specifies what the option value will be if disabled by the user.
          • The "default" attribute specifies the initial value of the option, either "true" or "false".
        • An <Enumeration> tag designates an option that can be one of a finite set of values.
          • The "default" attribute specifies the initial value of the option, which must be one of its enumerated values.
          • Each <Entry> tag describes one allowed value.
            • The "name" tag specifies the value for that choice.
            • The "label" tag provides human-readable text that will be displayed in the user interface for that choice.
    • A <Command> tag is used to specify the external command and its startup arguments.
      • The "exec" attribute specifies the filename of the command to be run. The system PATH will be used to search for the command, unless an absolute path is specified. If the value for this attribute is specified as $STRING$, then it will be replaced with the value of a predefined or user-defined (through <Option/>) variable.
      • The "timeout" attribute specifies the maximum amount of time (in seconds) that the client will wait for the server to start (currently not implemented).
      • The "delay" attribute specifies a delay (in seconds) between the time the startup command completes and the time that the client attempts a connection to the server.
      • <Argument> tags are command-line arguments that will be passed to the startup command.
        • String substitution is performed on each argument, replacing each $STRING$ with the value of a predefined or user-defined variable.
        • Arguments whose value is an empty string are not passed to the startup command.
  • The <ManualStartup> tag indicates that the user will manually start the given server prior to connecting.
    • An optional <Options> tag can be used to prompt the user for options required at startup. Note that PV_SERVER_PORT, PV_DATA_SERVER_PORT, PV_RENDER_SREVER_PORT, and PV_CONNECT_ID are the only variables that make sense in this context.
  • Other startup type tags may be added in the future to support e.g: builtin SSH client functionality.

Runtime Environment

When a startup command is run, its environment will include all of the user-defined variables specified in <Option> tags, plus the following predefined variables:

  • PV_USERNAME (currently not implemented)

If an <Option> tag defines a variable with the same name as a predefined variable, the <Option> tag value takes precedence. This can be used to override defaults that are normally hidden from the user. As an example, if a site wanted users to be able to override default port numbers, the server configuration might specify an <Option> of PV_SERVER_PORT.

ParaView: [Welcome | Site Map]