2 \page SALOME_Application SALOME Application Concept
4 <b>Configuration for one or more computers</b>
7 <b> **WORK in PROGRESS, INCOMPLETE DOCUMENT** </b>
9 The following explains how to configure your own application with your list of
10 modules, how to define and run this application on one or more computers.
12 \section S1_sal_appl General principles
14 %A %SALOME application is defined by a set of modules (GEOM, SMESH, ASTER...).
16 %A %SALOME User can define several %SALOME Applications. These applications are
17 runnable from the same user account. These applications may share the same
18 KERNEL and modules. Thus, the application configuration is independant of
19 KERNEL and must not be put in KERNEL_ROOT_DIR.
21 Furthermore, prerequisites may not be the same on all the applications.
23 %A %SALOME Session can run on a several computers.
25 Binary modules and prerequisites are installed on the different computers.
26 There is no need to have all the modules on each computer (the minimum is
29 There is no need of standardization or centralised information on the details
30 of configuration on each computer (PATH, LD_LIBRARY_PATH, environment
31 variables) provided the application modules are version - compatible. Details
32 of configuration stay private to the computer, and are held by scripts on each
35 There is no hierarchy between the computers (for example only one master
36 computer used to launch application).
38 The %SALOME user has an account on all the computers. Access between
39 account@computer is via rsh or ssh and must be configured for use without
40 password (key exchange for ssh). Account may be different on each
43 \section S2_sal_appl Application Directory
45 There is two ways for creation of an application directory
49 <b>First way - references to different module directories</b>
51 The script createAppli.sh in ${KERNEL_ROOT_DIR}/bin/SALOME creates an
52 application directory with the given path in parameter. ${APPLI} is a path
55 The directory is only a skeleton, the user has to edit several files to
56 configure his own application. These files are described after, the list is:
59 - env.d/envProducts.sh
61 - CatalogResources.xml
66 <b>Second and easiest way - one single virtual install directory</b>
68 The user must create a %SALOME application configuration file by modifying a
69 copy of ${KERNEL_ROOT_DIR}/bin/SALOME/config_appli.xml.
70 The file describes the list of %SALOME modules used in the application, with
71 their respective installation path. The configuration file also defines the
72 path of an existing script which sets the %SALOME prerequisites,
73 and optionnaly, the path of samples directory (SAMPLES_SRC).
74 The following command::
77 python <KERNEL_ROOT_DIR>/bin/SALOME/appli_gen.py --prefix=<install directory> --config=<configuration file>
80 creates a virtual installation of %SALOME in the application directory ${APPLI}
81 (bin, lib, doc, share...), with, for each file (executable, script, data,
82 library, resources...), symbolic links to the actual file.
84 Providing an existing an existing script for %SALOME prerequisites (the same one
85 used for modules compilation, or given with the modules installation), the
86 installation works without further modification for a single computer (unless
87 some modules needs a special environment not defined in the above script).
88 For a distributed application (several computers), one must copy and adapt
89 CatalogResources.xml from ${KERNEL_ROOT_DIR}/bin/SALOME/appliskel (see below).
93 \section S3_sal_appl General rules
95 Directory ${APPLI} must be created on each computer of the application.
96 The easiest way is to use the same relative path (to ${HOME}) on each computer.
97 (Sometimes it is not possible to use the same path everywhere, for instance
98 when ${HOME} is shared with NFS, so it is possible to define different path
99 following the computers).
101 The ${APPLI} directory contains scripts for environment and runs. Environment
102 scripts must be configured (by the user) on each computer. All the environment
103 scripts are in the ${APPLI}/env.d directory.
105 The script ${APPLI}/envd sources **all** the files (\*.sh) in ${APPLI}/env.d
106 in alphanumeric order (after edition, think to remove backup files). the envd
107 script is used by run scripts.
113 With the first way of installation, each user **must define** his own
114 configuration for these scripts, following the above rules.
115 With the virtual installation (second way, above), env.d
116 scripts are built automatically.
118 **The following is only an example proposed by createAppli.sh, (first way of installation) not working as it is**.
121 Sets the computer configuration not directly related to %SALOME,
122 like useful tools, default PATH.
125 Sets the %SALOME prerequisites.
128 Sets all the MODULE_ROOT_DIR that can be used in the %SALOME application.
130 SALOMEAppConfig is also defined by:
133 export SALOMEAppConfig=${HOME}/${APPLI}
136 where SALOMEAppConfig designates the directory containing SALOMEApp.xml.
137 Note that ${APPLI} is already defined by the calling scripts when
138 env.d/envSALOME.sh is sourced.
141 <b>User run scripts</b>
143 The %SALOME user can use 4 scripts:
146 Launches a %SALOME Session
147 (similar to ${KERNEL_ROOT_DIR}/bin/SALOME/runSALOME but with a different
148 name to avoid confusions).
151 Launches a shell script in the %SALOME application environment, with access
152 to the current (last launched) %SALOME session (naming service), if any.
153 Without arguments, the script is interactive. With arguments, the script
154 executes the command in the %SALOME application environment.
157 Gives a python console connected to the current %SALOME Session.
158 It is also possible to use runSession, then python.
161 Similar to runSession, used for unit testing. runSession tries to use an
162 already existing naming service definition from a running session (hostname
163 and port number), runTests defines a new configuration for naming service
167 <b>%SALOME internal run scripts</b>
170 Sets %SALOME application environment, envd is sourced by other scripts.
172 For remote calls, %SALOME uses one script.
175 This script is mainly used to launch containers. The first 2 arguments
176 define the hostname and port userd for naming service, the remaining
177 arguments define the command to execute.
180 <b>Other configuration files</b>
183 This file is similar to the default given
184 in ${GUI_ROOT_DIR}/share/SALOME/resources/gui
187 - CatalogRessources.xml
188 This files describes all the computers the application can use. The given
189 example is minimal and suppose ${APPLI} is the same relative path
190 to ${HOME}, on all the computers. %A different directory can be set on a
191 particular computer with a line:
194 appliPath="my/specific/path/on/this/computer"
200 \section S4_sal_appl Examples of use
204 <b>Launch a %SALOME session with a GUI interface</b>
206 Launch is done with a command like::
212 The --logger option means here : collect all the traces from the all the
213 distributed process, via CORBA, in a single file : logger.log.
215 There are a lot of options, a complete list is given by::
221 Note that, without argument, runAppli is a non interactive Python application,
222 and, with arguments, runAppli is an interactive Python interpreter.
224 Several options are already defined by default in SALOMEApp.xml files. Optional
225 arguments given in the command override the SALOMEApp.xml configuration.
227 Several sessions can run simultaneously, each session use a different port for
228 CORBA naming service, so the sessions are totally separated from each other.
230 When the GUI is closed, the different %SALOME servers are still running.
233 <b>Close a %SALOME session, kill all the servers</b>
235 Inside the interactive python interpreter you get when you use runAppli
236 with arguments, you can kill all the servers of your session with::
242 or the servers of all the sessions with::
248 If you have no active Python interpreter connected to your session, you can
249 kill all the %SALOME servers of **all the sessions** on a given computer::
252 ./runSession killSALOME.py
255 Remember! it's the same idea in *Windows (R) operating system* (Microsoft and Windows are either registered trademarks or trademarks of
256 Microsoft Corporation in the United States and/or other countries) :
257 use the start menu to stop...
259 When you use only one session at a time, you don't need more.
261 To kill a given session (when several session are running), one needs
262 the naming service port number::
265 ./runSession killSALOMEWithPort 2810
268 Note that the port number of the last launched session can be found on Linux,
269 in the prompt, within a runSession shell (see below).
271 It is also possible to get the Naming Service host and port number of
272 the last launched session with::
275 ./runSession NSparam.py
280 <b>Launch a %SALOME session without GUI interface</b>
282 This is used to launch a %SALOME Python script without GUI
283 (no GUI %server = SALOME_session_server)
285 Example of script (test_session_geom.py):
288 import SALOME_session
289 SALOME_session.startSession(modules=["GEOM"])
290 import GEOM_usinggeom
291 raw_input("Press a key and the servers will be killed ...")
294 This script is run in a non interactive way with::
297 ./runSession python test_session_geom.py
300 All the process are automatically killed when Python is closed
301 (with SALOME_session delete).
304 <b>Add an external Python interpretor to a running session</b>
306 It's often easier to develop and try Python scripts outside the GUI embedded
307 Python interpreter. Imagine, for instance, you are writing a script involving
308 geometry and mesh modules.
309 first, launch a %SALOME session with gui, then, on another terminal::
316 Import %SALOME module. SALOME_init() without arguments creates a new study
317 in the running session (note: SALOME_init(n) attachs to a running session whose
325 An example of script given with SMESH::
328 import ex01_cube2build
331 It is possible to connect the GUI interface to the study created in the above
332 script with the file/connect menu, then browse study and display objects.
333 Further modifications on study can be done either with GUI or external script
334 (use refresh popup in GUI %object browser to see study modifications generated
335 by the external script). **AVOID modifications with GUI when a Python script
336 is running**. Not all the modules are protected against concurrent actions...
339 <b>Different uses of the runSession shell interpreter</b>
341 runSession invoked without arguments gives an interactive shell with the full
342 environment of %SALOME (PATH, LD_LIBRARY_PATH, PYTHONPATH, other variables).
343 If there are running sessions of the same %SALOME application, runSession
344 connects to the last launched session (i.e. gets the naming service references
345 of the session: hostname and port)
347 On Linux, the shell prompt (bash) gives information on naming service
348 references, hostname and port::
351 [NS=cli76cc:2811]prascle@cli76cc:~/SALOME2/Run/Virtual$
354 If there is no running session, prompt looks like::
357 [NS=:]prascle@cli76cc:~/SALOME2/Run/Virtual$
360 runSession is useful to launch any script or program which needs the complete
361 %SALOME environment, with or without a session already running.
362 For instance, to launch the ddd debugger interface on the gui %server, first
363 launch a %SALOME session with gui, then, on another terminal::
369 Then attach to the running SALOME_Session_Server process.