]> SALOME platform Git repositories - modules/yacs.git/blob - src/evalyfx_swig/test1.py
Salome HOME
e52a597baf0681317a56cd5487ac0cfce2fb19c4
[modules/yacs.git] / src / evalyfx_swig / test1.py
1 # bug revealed by otgui on 8/2/16. Several lock/unlock session. test1.xml is Cogeneration.xml.
2
3 def buildScheme(fname):
4     import SALOMERuntime
5     import loader
6     SALOMERuntime.RuntimeSALOME.setRuntime()
7     r=SALOMERuntime.getSALOMERuntime()
8     p=r.createProc("run")
9     cont=p.createContainer("MyWonderfulContainer","Salome")
10     td=p.createType("double","double")
11     n0=r.createScriptNode("Salome","PyScript0")
12     p.edAddChild(n0)
13     q=n0.edAddInputPort("q",td)
14     e=n0.edAddInputPort("e",td)
15     c=n0.edAddInputPort("c",td)
16     ep=n0.edAddOutputPort("ep",td)
17     n0.setScript("ep=1-(q/((e/((1-0.05)*0.54))+(c/0.8)))")
18     n0.setExecutionMode("remote")
19     n0.setContainer(cont)
20     p.saveSchema(fname)
21     pass
22
23 fname="test1.xml"
24 import evalyfx
25 session=evalyfx.YACSEvalSession()
26 session.launch()
27 efx=evalyfx.YACSEvalYFX.BuildFromFile(fname)
28 efx.setParallelizeStatus(False)
29 inps=efx.getFreeInputPorts()
30 outps=efx.getFreeOutputPorts()
31 for inp in inps:
32     inp.setSequenceOfValuesToEval([0.2,0.3])
33 efx.lockPortsForEvaluation(inps,outps)
34 rss=efx.giveResources()
35 rss[0][0].setWantedMachine("localhost")
36 a,b=efx.run(session) ; assert(a)
37 efx.unlockAll()
38 for ii,inp in enumerate(inps):
39     inp.setSequenceOfValuesToEval([0.5,0.6,0.7])
40 efx.lockPortsForEvaluation(inps,outps)
41 a,b=efx.run(session) ; assert(a)
42 efx.unlockAll()
43 for ii,inp in enumerate(inps):
44     inp.setSequenceOfValuesToEval([0.5,0.6,0.7])
45 efx.lockPortsForEvaluation(inps,outps)
46 a,b=efx.run(session) ; assert(a)