1 def buildScheme(fname):
4 SALOMERuntime.RuntimeSALOME.setRuntime()
5 r=SALOMERuntime.getSALOMERuntime()
7 td=p.createType("double","double")
9 cont=p.createContainer("zeCont","Salome")
11 n0=r.createFuncNode("Salome","node0")
15 n0.setScript("""def func0(a,b):
18 n0.setExecutionMode("remote")
19 a=n0.edAddInputPort("a",td)
20 b=n0.edAddInputPort("b",td) ; b.edInitPy(1.3)
21 c=n0.edAddOutputPort("c",td)
23 n1=r.createFuncNode("Salome","node1")
27 n1.setScript("""def func1(a,b):
30 n1.setExecutionMode("remote")
31 d=n1.edAddInputPort("d",td)
32 e=n1.edAddInputPort("e",td) ; e.edInitPy(2.5) # agy : useless but for test
33 f=n1.edAddOutputPort("f",td)
34 g=n1.edAddOutputPort("g",td)
43 session=evalyfx.YACSEvalSession()
46 efx=evalyfx.YACSEvalYFX.BuildFromFile(fileName)
47 inps=efx.getFreeInputPorts()
49 inps[0].setDefaultValue(3.4)
51 inps[0].setDefaultValue(None)
52 inps[2].setDefaultValue(2.7)
53 inps[2].setDefaultValue(None)
55 outps=efx.getFreeOutputPorts()
56 # prepare for execution
57 inps[0].setDefaultValue(1.1)
58 inps[1].setSequenceOfValuesToEval([10.1,10.2,10.3])
59 a,b=inps[2].hasSequenceOfValuesToEval()
60 inps[2].setSequenceOfValuesToEval([20.1,20.2,30.3,40.4])
61 a,b=inps[2].hasSequenceOfValuesToEval()
62 inps[2].setSequenceOfValuesToEval([20.1,20.2,30.3])
63 efx.lockPortsForEvaluation([outps[0],outps[2]])
65 g=efx.getUndergroundGeneratedGraph()
66 g.saveSchema("toto.xml")
67 rss=efx.giveResources()
68 rss[0][0].setWantedMachine("localhost")
72 assert(efx.getResults()==[[11.110000000000001, 11.22, 11.330000000000002], [93.63, 94.26, 124.89000000000001]])
75 #l=loader.YACSLoader()
76 #p=l.load("/home/H87074/aaaaaaa.xml")
77 #ex=pilot.ExecutorSwig()
78 #ex.RunW(efx.getUndergroundGeneratedGraph())
85 zePath=os.path.join(os.environ["KERNEL_ROOT_DIR"],"bin","salome","appliskel")
86 sys.path.append(zePath)
87 import salome_test_session
88 port=salome_test_session.startSession(shutdownAtExit=False)
89 omniorb_cfg=os.environ["OMNIORB_CONFIG"]
90 SALOMERuntime.RuntimeSALOME.setRuntime()
91 r=SALOMERuntime.getSALOMERuntime()
93 p=l.load("/home/H87074/aaaaaaa.xml")
94 ex=pilot.ExecutorSwig()
96 salome_test_session.terminateSession(port)