Version: 9.16.0
CORBAEngineTest.py
Go to the documentation of this file.
1# Copyright (C) 2006-2026 CEA, EDF
2#
3# This library is free software; you can redistribute it and/or
4# modify it under the terms of the GNU Lesser General Public
5# License as published by the Free Software Foundation; either
6# version 2.1 of the License, or (at your option) any later version.
7#
8# This library is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11# Lesser General Public License for more details.
12#
13# You should have received a copy of the GNU Lesser General Public
14# License along with this library; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16#
17# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18#
19
20import time
21
22import salome
23salome.salome_init()
24
25import YACS_ORB
26comp = salome.lcc.FindOrLoadComponent( "YACSContainer","YACS" )
27yacsgen = comp._narrow(YACS_ORB.YACS_Gen)
28
29# -----------------------------------------------------------------------------
30# --- schema OK
31
32procEx = yacsgen.LoadProc("samples/legendre7.xml")
33procEx.setExecMode(YACS_ORB.CONTINUE)
34procEx.Run()
35
36# --- wait until executor is paused, finished or stopped
37
38isRunning = 1
39while isRunning:
40 time.sleep(0.5)
41 state = procEx.getExecutorState()
42 isRunning = (state < 304)
43 print("executorState: ", state)
44 pass
45
46procEx.saveState("res.xml")
47numids,names = procEx.getIds()
48
49dico = {}
50i=0
51for name in names:
52 dico[name] = numids[i]
53 i+=1
54 pass
55
56print(procEx.getOutPortValue(dico["poly_7"],"Pn"))
57print(procEx.getInPortValue(dico["poly_7"],"x"))
58print(procEx.getInPortValue(dico["poly_7"],"notAPort"))
59print(procEx.getInPortValue(dico["Legendre.loopIter"],"nsteps"))
60
61# -----------------------------------------------------------------------------
62# --- schema with errors (echoSrv must be launched)
63
64procEx = yacsgen.LoadProc("samples/aschema.xml")
65procEx.setExecMode(YACS_ORB.CONTINUE)
66procEx.Run()
67
68# --- wait until executor is paused, finised or stopped
69
70isRunning = 1
71while isRunning:
72 time.sleep(0.5)
73 state = procEx.getExecutorState()
74 isRunning = (state < 304)
75 print("executorState: ", state)
76 pass
77
78procEx.saveState("res2.xml")
79numids,names = procEx.getIds()
80
81dico = {}
82i=0
83for name in names:
84 dico[name] = numids[i]
85 i+=1
86 pass
87
88print(procEx.getErrorDetails(dico["c1"]))
89print(procEx.getErrorDetails(dico["node13"]))
90
91# -----------------------------------------------------------------------------
92# --- schema with errors
93
94procEx = yacsgen.LoadProc("samples/triangle5error.xml")
95procEx.setExecMode(YACS_ORB.CONTINUE)
96procEx.setStopOnError(1,"execError2.xml")
97#procEx.unsetStopOnError()
98procEx.Run()
99
100isRunning = 1
101while isRunning:
102 time.sleep(0.5)
103 state = procEx.getExecutorState()
104 isRunning = (state < 304)
105 print("executorState: ", state)
106 pass
107
108#procEx.resumeCurrentBreakPoint()
109
110procEx.saveState("res3.xml")
111
112# -----------------------------------------------------------------------------
113# --- schema with breakpoints
114
115procEx = yacsgen.LoadProc("samples/legendre7.xml")
116procEx.setListOfBreakPoints(["Legendre.loopIter.deuxIter.iter2"])
117procEx.setExecMode(YACS_ORB.STOPBEFORENODES)
118procEx.Run()
119
120isRunning = 1
121while isRunning:
122 time.sleep(0.5)
123 state = procEx.getExecutorState()
124 isRunning = (state < 304)
125 print("executorState: ", state)
126 pass
127
128procEx.saveState("partialExec.xml")
129
130procEx = yacsgen.LoadProc("samples/legendre7.xml")
131procEx.setExecMode(YACS_ORB.CONTINUE)
132procEx.RunFromState("partialExec.xml")
133
134isRunning = 1
135while isRunning:
136 time.sleep(0.5)
137 state = procEx.getExecutorState()
138 isRunning = (state < 304)
139 print("executorState: ", state)
140 pass
141
142procEx.saveState("finishExec.xml")
143