Salome HOME
bos #29864 Irrelevant assert in test.
[modules/yacs.git] / doc / execxml.rst
1
2 .. _execxml:
3
4 Executing a calculation scheme in console mode 
5 ========================================================
6
7 A well-configured SALOME installation is necessary to execute a calculation scheme in the XML format in console mode.  
8 SALOME execution mode from a SALOME application will be used in the remainder of this document.
9
10 Steps to run a calculation scheme from the application directory:
11
12 1. run SALOME: ./salome -t
13 2. execute the YACS supervisor: ./salome shell -- driver schema.xml
14 3. stop every SALOME session: ./salome killall
15
16 Steps 2 and 3 can be done from inside a SALOME session. YACS can be executed and SALOME can be stopped within this session as follows:
17
18 1. initialise the session:  ./salome shell
19 2. execute the YACS supervisor:  driver schema.xml
20 3. stop SALOME:  shutdownSalome.py or killSalome.py
21 4. exit from the session:  CTRL+D
22
23 The YACS supervisor in console (driver) mode accepts a few options to set parameters for its execution::
24
25   Usage: driver [OPTION...] graph.xml
26   driver -- a SALOME YACS graph executor
27
28     -d, --display=level        Display dot files: 0=never to 3=very often
29                                (default 0)
30     -e, --dump-on-error[=file] Stop on first error and dump state
31     -f, --dump-final[=file]    dump final state
32     -g, --dump[=nbsec]         dump state
33     -i, --init_port[=value]    Initialisation value of a port, specified as
34                                bloc.node.port=value.
35     -k, --kill-port=port       Kill Salome application running on the specified
36                                port if the driver process is killed (with SIGINT
37                                or SIGTERM)
38     -l, --load-state=file      Load State from a previous partial execution
39     -r, --reset=level          Reset the schema before execution: 0=nothing,
40                                1=reset error nodes to ready state (default 0)
41     -s, --stop-on-error        Stop on first error
42     -t, --shutdown=level       Shutdown the schema: 0=no shutdown to 3=full
43                                shutdown (default 1)
44     -v, --verbose              Produce verbose output
45     -x, --save-xml-schema[=file]   dump xml schema
46     -?, --help                 Give this help list
47         --usage                Give a short usage message
48     -V, --version              Print program version
49
50 The following gives a few typical uses of the driver.
51
52 Standard execution
53 --------------------
54 During a standard execution, the supervisor reads the XML file that describes the scheme, executes it and then produces 
55 an error report (see :ref:`errorreport`) if necessary::
56
57   driver schema.xml
58
59 Execution displaying states of nodes during execution
60 ----------------------------------------------------------------------
61 ::
62
63   driver --display=1 schema.xml
64  
65
66 Execution saving the final state of the scheme
67 ----------------------------------------------------------------------
68 ::
69
70   driver --dump-final=mystate.xml schema.xml
71
72 Execution loading the initial state of the scheme
73 ----------------------------------------------------------------------
74 ::
75
76   driver --load-state=mystate.xml schema.xml
77
78 .. _xml_shutdown:
79
80 How to configure schema shutdown
81 ---------------------------------------------
82 No shutdown::
83
84   driver --shutdown=0 schema.xml
85
86 Full shutdown::
87
88   driver --shutdown=3 schema.xml
89
90 Restart a schema with reset of nodes in error
91 ----------------------------------------------------------------------
92 ::
93
94   driver --reset=1 --load-state=mystate.xml schema.xml
95
96 Execute a scheme and save the state of execution every 30 seconds
97 ----------------------------------------------------------------------
98 ::
99
100   driver -g30 -fmystate.xml schema.xml
101
102 Change the values of some input ports before execution
103 ----------------------------------------------------------------------
104 ::
105
106   driver -imynode.i=5 -imynode.d=.7 -imynode.b=False -imynode.s=lili schema.xml
107
108 In this example, the ports "i", "d", "b" and "s" of the node "mynode" are initialized and the schema is launched.
109
110 Only the ports of the following types can be initialized this way:
111
112  - int
113  - double
114  - bool
115  - string
116
117 How to manage several SALOME sessions
118 ----------------------------------------------------------------------
119 When you need to launch several SALOME session to execute several schemas in parallel, you have to
120 store the SALOME session number to be able to shutdown or kill one of the sessions but not all of them.
121 The session number can be stored in a file by using the --ns-port-log argument of the runAppli command.
122
123 Here is an example with 2 SALOME sessions:
124
125 1. Launch first SALOME session with execution of a schema::
126
127       <appli>/salome -t --ns-port-log=/tmp/session1.log
128       <appli>/salome shell -- driver schema1.xml
129
130 2. Launch second SALOME session with execution of another schema::
131
132       <appli>/salome -t --ns-port-log=/tmp/session2.log
133       <appli>/salome shell -- driver schema2.xml
134
135 3. Shutdown first session::
136
137       <appli>/salome kill `cat /tmp/session1.log`
138
139 4. Kill second session::
140
141       <appli>/salome kill `cat /tmp/session2.log`
142
143