1 ======================================================================
2 SALOME Application Concept. Configuration for one or more computers
3 ======================================================================
5 *html version of this document is produced with docutils*::
7 rst2html doc.txt > doc.html
9 This document corresponds to SALOME2 3.2.0
14 +-------------------------------------------+
15 | **WORK in PROGRESS, INCOMPLETE DOCUMENT** |
16 +-------------------------------------------+
18 -------------------------------------------------------------------------------
20 The following explains how to configure your own application with your list of
21 modules, how to define and run this application on one or more computers.
26 A SALOME application is defined by a set of modules (GEOM, SMESH, ASTER...).
28 A SALOME User can define several SALOME Applications. These applications are
29 runnable from the same user account. These applications may share the same
30 KERNEL and modules. Thus, the application configuration is independant of
31 KERNEL and must not be put in KERNEL_ROOT_DIR.
33 Furthermore, prerequisites may not be the same on all the applications.
35 A SALOME Session can run on a several computers.
37 Binary modules and prerequisites are installed on the different computers.
38 There is no need to have all the modules on each computer (the minimum is
41 There is no need of standardization or centralised information on the details
42 of configuration on each computer (PATH, LD_LIBRARY_PATH, environment
43 variables) provided the application modules are version - compatible. Details
44 of configuration stay private to the computer, and are held by scripts on each
47 There is no hierarchy between the computers (for example only one master
48 computer used to launch application).
50 The SALOME user has an account on all the computers. Access between
51 account@computer is via rsh or ssh and must be configured for use without
52 password (key exchange for ssh). Account may be different on each
58 Two ways for creation of an application directory
59 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61 First way - references to different module directories
62 ''''''''''''''''''''''''''''''''''''''''''''''''''''''
64 The script createAppli.sh in ${KERNEL_ROOT_DIR}/bin/salome creates an
65 application directory with the given path in parameter. ${APPLI} is a path
68 The directory is only a skeleton, the user has to edit several files to
69 configure his own application. These files are described after, the list is:
72 - env.d/envProducts.sh
74 - CatalogResources.xml
77 Second and easiest way - one single virtual install directory
78 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
80 The user must create a SALOME application configuration file by modifying a
81 copy of ${KERNEL_ROOT_DIR}/bin/salome/config_appli.xml.
82 The file describes the list of SALOME modules used in the application, with
83 their respective installation path. The configuration file also defines the
84 path of an existing script which sets the SALOME prerequisites,
85 and optionnaly, the path of samples directory (SAMPLES_SRC).
86 The following command::
88 python <KERNEL_ROOT_DIR>/bin/salome/appli_gen.py --prefix=<install directory> --config=<configuration file>
90 creates a virtual installation of SALOME in the application directory ${APPLI}
91 (bin, lib, doc, share...), with, for each file (executable, script, data,
92 library, resources...), symbolic links to the actual file.
94 Providing an existing an existing script for SALOME prerequisites (the same one
95 used for modules compilation, or given with the modules installation), the
96 installation works without further modification for a single computer (unless
97 some modules needs a special environment not defined in the above script).
98 For a distributed application (several computers), one must copy and adapt
99 CatalogResources.xml from ${KERNEL_ROOT_DIR}/bin/salome/appliskel (see below).
104 Directory ${APPLI} must be created on each computer of the application.
105 The easiest way is to use the same relative path (to ${HOME}) on each computer.
106 (Sometimes it is not possible to use the same path everywhere, for instance
107 when ${HOME} is shared with NFS, so it is possible to define different path
108 following the computers).
110 The ${APPLI} directory contains scripts for environment and runs. Environment
111 scripts must be configured (by the user) on each computer. All the environment
112 scripts are in the ${APPLI}/env.d directory.
114 The script ${APPLI}/envd sources **all** the files (\*.sh) in ${APPLI}/env.d
115 in alphanumeric order (after edition, think to remove backup files). the envd
116 script is used by run scripts.
121 With the first way of installation, each user **must define** his own
122 configuration for these scripts, following the above rules.
123 With the virtual installation (second way, above), env.d
124 scripts are built automatically.
126 **The following is only an example proposed by createAppli.sh, (first way of installation) not working as it is**.
129 Sets the computer configuration not directly related to SALOME,
130 like useful tools, default PATH.
133 Sets the SALOME prerequisites.
136 Sets all the MODULE_ROOT_DIR that can be used in the SALOME application.
138 SalomeAppConfig is also defined by::
140 export SalomeAppConfig=${HOME}/${APPLI}
142 where SalomeAppConfig designates the directory containing SalomeApp.xml.
143 Note that ${APPLI} is already defined by the calling scripts when
144 env.d/envSalome.sh is sourced.
149 The SALOME user can use 4 scripts:
152 Launches a SALOME Session
153 (similar to ${KERNEL_ROOT_DIR}/bin/salome/runSalome but with a different
154 name to avoid confusions).
157 Launches a shell script in the SALOME application environment, with access
158 to the current (last launched) SALOME session (naming service), if any.
159 Without arguments, the script is interactive. With arguments, the script
160 executes the command in the SALOME application environment.
163 Gives a python console connected to the current SALOME Session.
164 It is also possible to use runSession, then python.
167 Similar to runSession, used for unit testing. runSession tries to use an
168 already existing naming service definition from a running session (hostname
169 and port number), runTests defines a new configuration for naming service
172 SALOME internal run scripts
173 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
176 Sets SALOME application environment, envd is sourced by other scripts.
178 For remote calls, SALOME uses one script.
181 This script is mainly used to launch containers. The first 2 arguments
182 define the hostname and port userd for naming service, the remaining
183 arguments define the command to execute.
185 Other configuration files
186 ~~~~~~~~~~~~~~~~~~~~~~~~~
189 This file is similar to the default given
190 in ${GUI_ROOT_DIR}/share/salome/resources/gui
193 CatalogRessources.xml
194 This files describes all the computers the application can use. The given
195 example is minimal and suppose ${APPLI} is the same relative path
196 to ${HOME}, on all the computers. A different directory can be set on a
197 particular computer with a line::
199 appliPath="my/specific/path/on/this/computer"
205 Launch a SALOME session with a GUI interface
206 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208 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::
219 Note that, without argument, runAppli is a non interactive Python application,
220 and, with arguments, runAppli is an interactive Python interpreter.
222 Several options are already defined by default in SalomeApp.xml files. Optional
223 arguments given in the command override the SalomeApp.xml configuration.
225 Several sessions can run simultaneously, each session use a different port for
226 CORBA naming service, so the sessions are totally separated from each other.
228 When the GUI is closed, the different SALOME servers are still running.
230 Close a SALOME session, kill all the servers
231 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233 Inside the interactive python interpreter you get when you use runAppli
234 with arguments, you can kill all the servers of your session with::
238 or the servers of all the sessions with::
242 If you have no active Python interpreter connected to your session, you can
243 kill all the SALOME servers of **all the sessions** on a given computer::
245 ./runSession killSalome.py
247 Remember! it's the same idea in *Windows (R) operating system* [#]_ :
248 use the start menu to stop...
250 When you use only one session at a time, you don't need more.
252 To kill a given session (when several session are running), one needs
253 the naming service port number::
255 ./runSession killSalomeWithPort 2810
257 Note that the port number of the last launched session can be found on Linux,
258 in the prompt, within a runSession shell (see below).
260 It is also possible to get the Naming Service host and port number of
261 the last launched session with::
263 ./runSession NSparam.py
265 .. [#] Microsoft and Windows are either registered trademarks or trademarks of
266 Microsoft Corporation in the United States and/or other countries.
268 Launch a SALOME session without GUI interface
269 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
271 This is used to launch a SALOME Python script without GUI
272 (no GUI server = SALOME_session_server)
274 Example of script (test_session_geom.py)::
276 import salome_session
277 salome_session.startSession(modules=["GEOM"])
278 import GEOM_usinggeom
279 raw_input("Press a key and the servers will be killed ...")
281 This script is run in a non interactive way with::
283 ./runSession python test_session_geom.py
285 All the process are automatically killed when Python is closed
286 (with salome_session delete).
288 Add an external Python interpretor to a running session
289 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291 It's often easier to develop and try Python scripts outside the GUI embedded
292 Python interpreter. Imagine, for instance, you are writing a script involving
293 geometry and mesh modules.
294 first, launch a SALOME session with gui, then, on another terminal::
299 Import salome module. salome_init() without arguments creates a new study
300 in the running session (note: salome_init(n) attachs to a running session whose
306 An example of script given with SMESH::
308 import ex01_cube2build
310 It is possible to connect the GUI interface to the study created in the above
311 script with the file/connect menu, then browse study and display objects.
312 Further modifications on study can be done either with GUI or external script
313 (use refresh popup in GUI object browser to see study modifications generated
314 by the external script). **AVOID modifications with GUI when a Python script
315 is running**. Not all the modules are protected against concurrent actions...
318 Different uses of the runSession shell interpreter
319 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
321 runSession invoked without arguments gives an interactive shell with the full
322 environment of SALOME (PATH, LD_LIBRARY_PATH, PYTHONPATH, other variables).
323 If there are running sessions of the same SALOME application, runSession
324 connects to the last launched session (i.e. gets the naming service references
325 of the session: hostname and port)
327 On Linux, the shell prompt (bash) gives information on naming service
328 references, hostname and port::
330 [NS=cli76cc:2811]prascle@cli76cc:~/SALOME2/Run/Virtual$
332 If there is no running session, prompt looks like::
334 [NS=:]prascle@cli76cc:~/SALOME2/Run/Virtual$
336 runSession is useful to launch any script or program which needs the complete
337 SALOME environment, with or without a session already running.
338 For instance, to launch the ddd debugger interface on the gui server, first
339 launch a SALOME session with gui, then, on another terminal::
343 Then attach to the running SALOME_Session_Server process.
346 -------------------------------------------------------------------------------
348 +----------------------------------+------------------------------------------+
349 | `General KERNEL documentation`_ | `End User KERNEL Doxygen documentation`_ |
350 +----------------------------------+------------------------------------------+
352 .. _`General KERNEL documentation`: ./index.html
353 .. _`End User KERNEL Doxygen documentation`: ./tui/KERNEL/index.html