23 import SALOME_ComponentPy
24 import SALOME_DriverPy
36 class proc_i(YACS_ORB__POA.ProcExec):
38 self.
ll = loader.YACSLoader()
39 self.
ee = pilot.ExecutorSwig()
42 self.
pp = self.
ll.load(xmlFile)
77 return self.
pp.getNodeErrorDetails(nodeNumid)
80 return self.
pp.getNodeErrorReport(nodeNumid)
83 return self.
pp.getNodeContainerLog(nodeNumid)
86 return self.
pp.shutdown(level)
102 def runProc(self,debug, isPyThread, fromscratch):
103 print(
"**************************Begin schema execution %s**************************" % self.
xmlFilexmlFile)
104 self.
ee.RunPy(self.
pp,debug, isPyThread, fromscratch)
105 print(
"**************************End schema execution %s****************************" % self.
xmlFilexmlFile)
108 if self.
run1run1
is not None:
110 if execState >= pilot.FINISHED:
114 if self.
run1run1
is None:
115 self.
run1run1 = threading.Thread(
None, self.
runProcrunProc,
"CORBAExec", (0,
True,
True))
116 self.
run1run1.start()
119 """Start an execution from the state given by the file xmlFile
120 If xmlFile == "", start execution from the current state
122 if self.
run1run1
is not None:
124 if execState >= pilot.FINISHED:
131 self.
pp.exUpdateState();
132 sp = loader.stateParser()
133 sl = loader.stateLoader(sp,self.
pp)
135 except IOError
as ex:
136 print(
"IO Error: ", ex)
138 except ValueError
as ex:
139 print(
"Caught ValueError Exception:",ex)
141 except pilot.Exception
as ex:
145 print(
"Unknown exception!")
148 if self.
run1run1
is None:
149 self.
run1run1 = threading.Thread(
None, self.
runProcrunProc,
"CORBAExec", (0,
True,
False))
150 self.
run1run1.start()
153 """Reset the procedure state to ready state for all nodes in error
154 if xmlFile exists first try to load the state from this file.
157 if self.
run1run1
is not None:
159 if execState >= pilot.FINISHED:
166 if os.path.exists(xmlFile):
168 sp = loader.stateParser()
169 sl = loader.stateLoader(sp,self.
pp)
172 self.
pp.resetState(1)
173 self.
pp.exUpdateState();
177 if self.
run1run1
is None:
178 self.
run1run1 = threading.Thread(
None, self.
runProcrunProc,
"CORBAExec", (0,
True,
False))
179 self.
run1run1.start()
182 disp = SALOMERuntime.SALOMEDispatcher_getSALOMEDispatcher()
183 disp.addObserver(obs, numid, event)
187 if mode == YACS_ORB.CONTINUE:
190 if mode == YACS_ORB.STEPBYSTEP:
193 if mode == YACS_ORB.STOPBEFORENODES:
232 class YACS(YACS_ORB__POA.YACS_Gen,
233 SALOME_ComponentPy.SALOME_ComponentPy_i,
234 SALOME_DriverPy.SALOME_DriverPy_i):
236 To be a SALOME component, this Python class must have the component name
237 (YACS) and inherit the YACS_Gen class build from idl compilation
238 with omniidl and also the class SALOME_ComponentPy_i which defines general
239 SALOME component behaviour.
241 def __init__ ( self, orb, poa, contID, containerName, instanceName,
243 print(
"YACS.__init__: ", containerName,
';', instanceName)
244 SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, contID,
245 containerName, instanceName,
246 interfaceName,
False)
247 SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName)
249 SALOMERuntime.RuntimeSALOME.setRuntime(1)
250 SALOMERuntime.SALOMEDispatcher_setSALOMEDispatcher()
255 modul_catalog = self._naming_service.Resolve(
"/Kernel/ModulCatalog")
256 ior= orb.object_to_string(modul_catalog)
257 cata=r.loadCatalog(
"session",ior)
263 Get version information.
267 rt = SALOMERuntime.getSALOMERuntime()
268 version = rt.getVersion()
276 load an XML graph in a YACS::ENGINE::proc, create a CORBA servant
277 associated to the proc, and return a ref on the servant.
280 procExec_i =
proc_i(xmlFile)
281 logger=procExec_i.p.getLogger(
"parser")
282 if not logger.isEmpty():
283 print(
"The imported file has errors :")
284 print(logger.getStr())
287 except IOError
as ex:
288 print(
"IO Error: ", ex, file=sys.stderr)
290 except ValueError
as ex:
291 print(
"Caught ValueError Exception:",ex, file=sys.stderr)
293 except pilot.Exception
as ex:
294 print(ex.what(), file=sys.stderr)
297 traceback.print_exc()
299 procExec_o = procExec_i._this()
304 load a SUPERV xml graph, convert it and return the new filename.
307 r = pilot.getRuntime()
308 lo = salomeloader.SalomeLoader()
309 e = pilot.ExecutorSwig()
311 s = pilot.SchemaSave(p)
312 hnd, convertedFile = tempfile.mkstemp(
".xml",
"yacs_",
"/tmp")
313 s.save(convertedFile)
def __init__(self, orb, poa, contID, containerName, instanceName, interfaceName)
def LoadProc(self, xmlFile)
def convertSupervFile(self, xmlFile)
def getContainerLog(self, nodeNumid)
def getNodeState(self, numid)
def RunFromState(self, xmlFile)
def getNodeProgress(self, numid)
def setInPortValue(self, nodeName, portName, value)
def runProc(self, debug, isPyThread, fromscratch)
def saveState(self, xmlFile)
def setListOfBreakPoints(self, listOfBreakPoints)
def getOutPortValue(self, nodeNumid, portName)
def unsetStopOnError(self)
def __init__(self, xmlFile)
def getXMLState(self, numid)
def shutdownProc(self, level)
def getErrorReport(self, nodeNumid)
def resumeCurrentBreakPoint(self)
def addObserver(self, obs, numid, event)
def setStopOnError(self, dumpRequested, xmlFile)
def setExecMode(self, mode)
def getInPortValue(self, nodeNumid, portName)
def setStepsToExecute(self, listToExecute)
def RestartFromState(self, xmlFile)
def getErrorDetails(self, nodeNumid)
def getExecutorState(self)