1 # Copyright (C) 2006-2020 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
30 class TestSaveLoadRun(unittest.TestCase):
32 SALOMERuntime.RuntimeSALOME.setRuntime()
33 self.r=SALOMERuntime.getSALOMERuntime()
34 self.workdir = tempfile.mkdtemp(suffix=".yacstest")
38 """First test of HP Container no loop here only the 3 sorts of python nodes (the Distributed is it still used and useful ?) """
39 fname=os.path.join(self.workdir, "TestSaveLoadRun0.xml")
41 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
43 p=self.r.createProc("prTest0")
44 td=p.createType("double","double")
45 ti=p.createType("int","int")
47 pg.setData([("localhost",4)])
48 cont=p.createContainer("gg","HPSalome")
49 cont.setProperty("name","localhost")
50 cont.setProperty("hostname","localhost")
51 cont.setProperty("nb_proc_per_node","1")
57 ref=datetime.datetime.now()
58 t=0. ; pas=1./float(nb)
62 t+=1.+cos(1.*(x*3.14159))
65 print("coucou from script0-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
71 ref=datetime.datetime.now()
72 o2=0. ; pas=1./float(i1)
76 o2+=1.+cos(1.*(x*3.14159))
78 print("coucou from script1-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
80 for i in range(nbOfNodes):
81 node0=self.r.createFuncNode("DistPython","node%i"%(i))
84 node0.setContainer(cont)
85 node0.setScript(script0)
86 nb=node0.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
87 dbg=node0.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
88 out0=node0.edAddOutputPort("s",td)
90 nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i))
91 p.edAddChild(nodeMiddle)
92 p.edAddCFLink(node0,nodeMiddle)
93 nodeMiddle.setFname("ff")
94 nodeMiddle.setContainer(cont)
95 nodeMiddle.setScript(script0)
96 nb=nodeMiddle.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
97 dbg=nodeMiddle.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
98 out0=nodeMiddle.edAddOutputPort("s",td)
99 nodeMiddle.setExecutionMode("remote")
101 nodeEnd=self.r.createScriptNode("Salome","node%i_2"%(i+1))
102 p.edAddChild(nodeEnd)
103 p.edAddCFLink(nodeMiddle,nodeEnd)
104 nodeEnd.setContainer(cont)
105 nodeEnd.setScript(script1)
106 i1=nodeEnd.edAddInputPort("i1",ti) ; i1.edInitInt(sqrtOfNumberOfTurn)
107 dbg=nodeEnd.edAddInputPort("dbg",ti) ; dbg.edInitInt(i)
108 o2=nodeEnd.edAddOutputPort("o2",td)
109 nodeEnd.setExecutionMode("remote")
113 ex=pilot.ExecutorSwig()
114 self.assertEqual(p.getState(),pilot.READY)
115 st=datetime.datetime.now()
116 p.propagePlayGround(pg)
119 print("Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st)))
120 self.assertEqual(p.getState(),pilot.DONE)
121 # 2nd exec using the same already launched remote python interpreters
122 st=datetime.datetime.now()
124 print("Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st)))
125 self.assertEqual(p.getState(),pilot.DONE)
126 # 3rd exec using the same already launched remote python interpreters
127 st=datetime.datetime.now()
129 print("Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st)))
130 self.assertEqual(p.getState(),pilot.DONE)
134 """ HP Container again like test0 but the initialization key of HPContainer is used here."""
135 fname=os.path.join(self.workdir, "TestSaveLoadRun1.xml")
137 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
138 l=loader.YACSLoader()
139 p=self.r.createProc("prTest1")
140 td=p.createType("double","double")
141 ti=p.createType("int","int")
142 pg=pilot.PlayGround()
143 pg.setData([("localhost",4)])
144 cont=p.createContainer("gg","HPSalome")
145 cont.setProperty("InitializeScriptKey","aa=123.456")
146 cont.setProperty("name","localhost")
147 cont.setProperty("hostname","localhost")
148 cont.setProperty("nb_proc_per_node","1")
154 ref=datetime.datetime.now()
155 t=0. ; pas=1./float(nb)
159 t+=1.+cos(1.*(x*3.14159))
162 print("coucou from script0-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
165 # here in script1 aa is refered ! aa will exist thanks to HPCont Init Script
169 ref=datetime.datetime.now()
170 o2=0. ; pas=1./float(i1)
174 o2+=1.+cos(1.*(x*3.14159))
176 print("coucou %lf from script1-%i -> %s"%(aa,dbg,str(datetime.datetime.now()-ref)))
180 for i in range(nbOfNodes):
181 nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i)) # PyFuncNode remote
182 p.edAddChild(nodeMiddle)
183 nodeMiddle.setFname("ff")
184 nodeMiddle.setContainer(cont)
185 nodeMiddle.setScript(script0)
186 nb=nodeMiddle.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
187 dbg=nodeMiddle.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
188 out0=nodeMiddle.edAddOutputPort("s",td)
189 nodeMiddle.setExecutionMode("remote")
191 nodeEnd=self.r.createScriptNode("Salome","node%i_2"%(i+1)) # PythonNode remote
192 p.edAddChild(nodeEnd)
193 p.edAddCFLink(nodeMiddle,nodeEnd)
194 nodeEnd.setContainer(cont)
195 nodeEnd.setScript(script1)
196 i1=nodeEnd.edAddInputPort("i1",ti) ; i1.edInitInt(sqrtOfNumberOfTurn)
197 dbg=nodeEnd.edAddInputPort("dbg",ti) ; dbg.edInitInt(i)
198 o2=nodeEnd.edAddOutputPort("o2",td)
199 nodeEnd.setExecutionMode("remote")
204 self.assertEqual(p.edGetDirectDescendants()[0].getContainer().getProperty("InitializeScriptKey"),"aa=123.456")
205 p.propagePlayGround(pg)
207 ex=pilot.ExecutorSwig()
208 self.assertEqual(p.getState(),pilot.READY)
209 st=datetime.datetime.now()
211 print("Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st)))
212 self.assertEqual(p.getState(),pilot.DONE)
214 st=datetime.datetime.now()
216 print("Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st)))
217 self.assertEqual(p.getState(),pilot.DONE)
219 st=datetime.datetime.now()
221 print("Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st)))
222 self.assertEqual(p.getState(),pilot.DONE)
226 """ Test on HP Containers in foreach context."""
229 print("%%lf - %%s"%%(aa,str(my_container)))
232 script1="""from math import cos
234 ref=datetime.datetime.now()
235 o2=0. ; pas=1./float(i1)
239 o2+=1.+cos(1.*(x*3.14159))
241 print("coucou %lf from script -> %s"%(aa,str(datetime.datetime.now()-ref)))
245 script2="""o9=sum(i8)
247 fname=os.path.join(self.workdir, "TestSaveLoadRun2.xml")
249 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
250 l=loader.YACSLoader()
251 p=self.r.createProc("prTest1")
252 td=p.createType("double","double")
253 ti=p.createType("int","int")
254 tdi=p.createSequenceTc("seqint","seqint",ti)
255 tdd=p.createSequenceTc("seqdouble","seqdouble",td)
256 pg=pilot.PlayGround()
257 pg.setData([("localhost",4)])
258 cont=p.createContainer("gg","HPSalome")
259 cont.setProperty("InitializeScriptKey","aa=123.456")
260 cont.setProperty("name","localhost")
261 cont.setProperty("hostname","localhost")
262 cont.setProperty("nb_proc_per_node","1")
264 node0=self.r.createFuncNode("Salome","PyFunction0") # PyFuncNode remote
267 node0.setContainer(cont)
268 node0.setScript(script0%(sqrtOfNumberOfTurn))
269 out0_0=node0.edAddOutputPort("o1",tdi)
270 out1_0=node0.edAddOutputPort("o2",ti)
271 node0.setExecutionMode("remote")
273 node1=self.r.createForEachLoop("node1",ti)
275 p.edAddCFLink(node0,node1)
276 p.edAddLink(out0_0,node1.edGetSeqOfSamplesPort())
277 node1.edGetNbOfBranchesPort().edInitInt(8)
279 node2=self.r.createScriptNode("Salome","PyScript3")
280 node1.edAddChild(node2)
281 node2.setContainer(cont)
282 node2.setScript(script1)
283 i1=node2.edAddInputPort("i1",ti)
284 p.edAddLink(node1.edGetSamplePort(),i1)
285 out0_2=node2.edAddOutputPort("o2",td)
286 out1_2=node2.edAddOutputPort("o3",ti)
287 node2.setExecutionMode("remote")
289 node3=self.r.createScriptNode("Salome","PyScript7")
291 node3.setScript(script2)
292 p.edAddCFLink(node1,node3)
293 i8=node3.edAddInputPort("i8",tdd)
294 o9=node3.edAddOutputPort("o9",td)
295 p.edAddLink(out0_2,i8)
299 o9=p.getChildByName("PyScript7").getOutputPort("o9")
300 self.assertTrue(len(p.edGetDirectDescendants()[1].getChildByName("PyScript3").getContainer().getProperty("InitializeScriptKey"))!=0)
302 refExpected=16016013.514623128
303 ex=pilot.ExecutorSwig()
304 p.propagePlayGround(pg)
305 self.assertEqual(p.getState(),pilot.READY)
306 st=datetime.datetime.now()
308 print("Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st)))
309 self.assertEqual(p.getState(),pilot.DONE)
310 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
312 st=datetime.datetime.now()
314 print("Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st)))
315 self.assertEqual(p.getState(),pilot.DONE)
316 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
318 st=datetime.datetime.now()
320 print("Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st)))
321 self.assertEqual(p.getState(),pilot.DONE)
322 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
326 """ Test that focuses on parallel load of containers."""
329 print("%%lf - %%s"%%(aa,str(my_container)))
332 script1="""from math import cos
334 ref=datetime.datetime.now()
335 o2=0. ; pas=1./float(i1)
339 o2+=1.+cos(1.*(x*3.14159))
341 print("coucou %lf from script -> %s"%(aa,str(datetime.datetime.now()-ref)))
345 script2="""o9=sum(i8)
347 fname=os.path.join(self.workdir, "TestSaveLoadRun3.xml")
349 sqrtOfNumberOfTurn=10
350 l=loader.YACSLoader()
351 p=self.r.createProc("prTest1")
352 td=p.createType("double","double")
353 ti=p.createType("int","int")
354 tdi=p.createSequenceTc("seqint","seqint",ti)
355 tdd=p.createSequenceTc("seqdouble","seqdouble",td)
356 cont=p.createContainer("gg","HPSalome")
357 pg=pilot.PlayGround()
358 pg.setData([("localhost",8)])
359 cont.setProperty("InitializeScriptKey","aa=123.456")
360 cont.setProperty("name","localhost")
361 cont.setProperty("hostname","localhost")
362 cont.setProperty("nb_proc_per_node","1")
364 node0=self.r.createFuncNode("Salome","PyFunction0") # PyFuncNode remote
367 node0.setContainer(cont)
368 node0.setScript(script0%(sqrtOfNumberOfTurn))
369 out0_0=node0.edAddOutputPort("o1",tdi)
370 out1_0=node0.edAddOutputPort("o2",ti)
371 node0.setExecutionMode("remote")
373 node1=self.r.createForEachLoop("node1",ti)
375 p.edAddCFLink(node0,node1)
376 p.edAddLink(out0_0,node1.edGetSeqOfSamplesPort())
377 node1.edGetNbOfBranchesPort().edInitInt(16)
379 node2=self.r.createScriptNode("Salome","PyScript3")
380 node1.edAddChild(node2)
381 node2.setContainer(cont)
382 node2.setScript(script1)
383 i1=node2.edAddInputPort("i1",ti)
384 p.edAddLink(node1.edGetSamplePort(),i1)
385 out0_2=node2.edAddOutputPort("o2",td)
386 out1_2=node2.edAddOutputPort("o3",ti)
387 node2.setExecutionMode("remote")
389 node3=self.r.createScriptNode("Salome","PyScript7")
391 node3.setScript(script2)
392 p.edAddCFLink(node1,node3)
393 i8=node3.edAddInputPort("i8",tdd)
394 o9=node3.edAddOutputPort("o9",td)
395 p.edAddLink(out0_2,i8)
399 o9=p.getChildByName("PyScript7").getOutputPort("o9")
400 self.assertTrue(len(p.edGetDirectDescendants()[1].getChildByName("PyScript3").getContainer().getProperty("InitializeScriptKey"))!=0)
402 refExpected=11000.008377058712
403 ex=pilot.ExecutorSwig()
404 p.propagePlayGround(pg)
405 self.assertEqual(p.getState(),pilot.READY)
406 st=datetime.datetime.now()
408 print("Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st)))
409 self.assertEqual(p.getState(),pilot.DONE)
410 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
412 st=datetime.datetime.now()
414 print("Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st)))
415 self.assertEqual(p.getState(),pilot.DONE)
416 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
418 st=datetime.datetime.now()
420 print("Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st)))
421 self.assertEqual(p.getState(),pilot.DONE)
422 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
426 """Non regression test of multi pyScriptNode, pyFuncNode sharing the same HPContainer instance."""
427 fname=os.path.join(self.workdir, "TestSaveLoadRun4.xml")
433 for j in range(i+10):
440 l=loader.YACSLoader()
441 ex=pilot.ExecutorSwig()
442 p=self.r.createProc("pr")
443 pg=pilot.PlayGround()
444 pg.setData([("localhost",10)])
445 cont=p.createContainer("gg","HPSalome")
446 cont.setProperty("nb_proc_per_node","1")
447 td=p.createType("int","int")
448 td2=p.createSequenceTc("seqint","seqint",td)
449 td3=p.createSequenceTc("seqintvec","seqintvec",td2)
450 node1=self.r.createScriptNode("","node1")
451 node1.setScript(script1)
452 o1=node1.edAddOutputPort("o1",td3)
455 node2=self.r.createForEachLoop("node2",td2)
457 p.edAddCFLink(node1,node2)
458 p.edAddLink(o1,node2.edGetSeqOfSamplesPort())
459 node2.edGetNbOfBranchesPort().edInitInt(2)
460 node20=self.r.createBloc("node20")
461 node2.edAddChild(node20)
462 node200=self.r.createForEachLoop("node200",td)
463 node20.edAddChild(node200)
464 node200.edGetNbOfBranchesPort().edInitInt(10)
465 p.edAddLink(node2.edGetSamplePort(),node200.edGetSeqOfSamplesPort())
466 node2000=self.r.createScriptNode("","node2000")
467 node2000.setContainer(cont)
468 node2000.setExecutionMode("remote")
469 node200.edAddChild(node2000)
470 i5=node2000.edAddInputPort("i5",td)
471 o6=node2000.edAddOutputPort("o6",td)
472 node2000.setScript("o6=2+i5")
473 p.edAddLink(node200.edGetSamplePort(),i5)
475 node3=self.r.createForEachLoop("node3",td2)
477 p.edAddCFLink(node2,node3)
478 p.edAddLink(o6,node3.edGetSeqOfSamplesPort())
479 node3.edGetNbOfBranchesPort().edInitInt(2)
480 node30=self.r.createBloc("node30")
481 node3.edAddChild(node30)
482 node300=self.r.createForEachLoop("node300",td)
483 node30.edAddChild(node300)
484 node300.edGetNbOfBranchesPort().edInitInt(10)
485 p.edAddLink(node3.edGetSamplePort(),node300.edGetSeqOfSamplesPort())
486 node3000=self.r.createScriptNode("","node3000")
487 node3000.setContainer(cont)
488 node3000.setExecutionMode("remote")
489 node300.edAddChild(node3000)
490 i14=node3000.edAddInputPort("i14",td)
491 o15=node3000.edAddOutputPort("o15",td)
492 node3000.setScript("o15=3+i14")
493 p.edAddLink(node300.edGetSamplePort(),i14)
495 node4=self.r.createScriptNode("","node4")
496 node4.setScript("o9=i8")
498 i8=node4.edAddInputPort("i8",td3)
499 o9=node4.edAddOutputPort("o9",td3)
500 p.edAddCFLink(node3,node4)
504 p.propagePlayGround(pg)
505 ex = pilot.ExecutorSwig()
506 self.assertEqual(p.getState(),pilot.READY)
508 self.assertEqual(p.getState(),pilot.DONE)
509 zeResu=p.getChildByName("node4").getOutputPort("o9").get()
510 self.assertEqual(zeResu,[[5,6,7,8,9,10,11,12,13,14],[15,16,17,18,19,20,21,22,23,24,25],[26,27,28,29,30,31,32,33,34,35,36,37],[38,39,40,41,42,43,44,45,46,47,48,49,50],[51,52,53,54,55,56,57,58,59,60,61,62,63,64],[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79], [80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95]])
514 """Non regression test 2 of multi pyNode, pyFuncNode sharing the same HPContainer instance."""
515 fname=os.path.join(self.workdir, "TestSaveLoadRun5.xml")
521 for j in range(i+10):
528 l=loader.YACSLoader()
529 ex=pilot.ExecutorSwig()
530 p=self.r.createProc("pr")
531 pg=pilot.PlayGround()
532 pg.setData([("localhost",10)])
533 cont=p.createContainer("gg","HPSalome")
534 cont.setProperty("nb_proc_per_node","1")
535 td=p.createType("int","int")
536 td2=p.createSequenceTc("seqint","seqint",td)
537 td3=p.createSequenceTc("seqintvec","seqintvec",td2)
538 node1=self.r.createScriptNode("","node1")
539 node1.setScript(script1)
540 o1=node1.edAddOutputPort("o1",td3)
543 node2=self.r.createForEachLoop("node2",td2)
545 p.edAddCFLink(node1,node2)
546 p.edAddLink(o1,node2.edGetSeqOfSamplesPort())
547 node2.edGetNbOfBranchesPort().edInitInt(2)
548 node20=self.r.createBloc("node20")
549 node2.edAddChild(node20)
550 node200=self.r.createForEachLoop("node200",td)
551 node20.edAddChild(node200)
552 node200.edGetNbOfBranchesPort().edInitInt(10)
553 p.edAddLink(node2.edGetSamplePort(),node200.edGetSeqOfSamplesPort())
554 node2000=self.r.createFuncNode("Salome","node2000")
555 node2000.setFname("ff")
556 node2000.setContainer(cont)
557 node2000.setExecutionMode("remote")
558 node200.edAddChild(node2000)
559 i5=node2000.edAddInputPort("i5",td)
560 o6=node2000.edAddOutputPort("o6",td)
561 node2000.setScript("def ff(x):\n return 2+x")
562 p.edAddLink(node200.edGetSamplePort(),i5)
564 node3=self.r.createForEachLoop("node3",td2)
566 p.edAddCFLink(node2,node3)
567 p.edAddLink(o6,node3.edGetSeqOfSamplesPort())
568 node3.edGetNbOfBranchesPort().edInitInt(2)
569 node30=self.r.createBloc("node30")
570 node3.edAddChild(node30)
571 node300=self.r.createForEachLoop("node300",td)
572 node30.edAddChild(node300)
573 node300.edGetNbOfBranchesPort().edInitInt(10)
574 p.edAddLink(node3.edGetSamplePort(),node300.edGetSeqOfSamplesPort())
575 node3000=self.r.createFuncNode("Salome","node3000")
576 node3000.setFname("ff")
577 node3000.setContainer(cont)
578 node3000.setExecutionMode("remote")
579 node300.edAddChild(node3000)
580 i14=node3000.edAddInputPort("i14",td)
581 o15=node3000.edAddOutputPort("o15",td)
582 node3000.setScript("def ff(x):\n return 3+x")
583 p.edAddLink(node300.edGetSamplePort(),i14)
585 node4=self.r.createScriptNode("","node4")
586 node4.setScript("o9=i8")
588 i8=node4.edAddInputPort("i8",td3)
589 o9=node4.edAddOutputPort("o9",td3)
590 p.edAddCFLink(node3,node4)
594 p.propagePlayGround(pg)
595 ex = pilot.ExecutorSwig()
596 self.assertEqual(p.getState(),pilot.READY)
598 self.assertEqual(p.getState(),pilot.DONE)
599 zeResu=p.getChildByName("node4").getOutputPort("o9").get()
600 self.assertEqual(zeResu,[[5,6,7,8,9,10,11,12,13,14],[15,16,17,18,19,20,21,22,23,24,25],[26,27,28,29,30,31,32,33,34,35,36,37],[38,39,40,41,42,43,44,45,46,47,48,49,50],[51,52,53,54,55,56,57,58,59,60,61,62,63,64],[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79], [80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95]])
604 fname=os.path.join(self.workdir, "test6.xml")
605 p=self.r.createProc("prTest0")
606 td=p.createType("double","double")
607 ti=p.createType("int","int")
608 tsi=p.createSequenceTc("seqint","seqint",ti)
609 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
610 n0=self.r.createScriptNode("","n0")
611 o0=n0.edAddOutputPort("o0",tsi)
612 n0.setScript("o0=[3,6,8,9,-2,5]")
614 n1=self.r.createForEachLoop("n1",ti)
615 n10=self.r.createScriptNode("","n10")
617 n10.setScript("o2=2*i1")
618 i1=n10.edAddInputPort("i1",ti)
619 o2=n10.edAddOutputPort("o2",ti)
621 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
622 p.edAddLink(n1.edGetSamplePort(),i1)
624 n1.edGetNbOfBranchesPort().edInitPy(1)
625 n2=self.r.createScriptNode("","n2")
626 n2.setScript("o4=i3")
627 i3=n2.edAddInputPort("i3",tsi)
628 o4=n2.edAddOutputPort("o4",tsi)
629 n2.setScript("o4=i3")
635 l=loader.YACSLoader()
637 n1=p.getChildByName("n1")
638 ex=pilot.ExecutorSwig()
642 self.assertEqual(n1.getState(),pilot.DONE)
643 n1.edGetSeqOfSamplesPort().getPyObj()
644 a,b,c=n1.getPassedResults(ex)
645 self.assertEqual(a,list(range(6)))
646 self.assertEqual([elt.getPyObj() for elt in b],[[6, 12, 16, 18, -4, 10]])
647 self.assertEqual(c,['n10_o2_interceptor'])
651 fname=os.path.join(self.workdir, "test7.xml")
652 p=self.r.createProc("prTest1")
653 cont=p.createContainer("gg","Salome")
654 cont.setProperty("name","localhost")
655 cont.setProperty("hostname","localhost")
656 cont.setProperty("type","multi")
657 td=p.createType("double","double")
658 ti=p.createType("int","int")
659 tsi=p.createSequenceTc("seqint","seqint",ti)
660 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
661 n0=self.r.createScriptNode("","n0")
662 o0=n0.edAddOutputPort("o0",tsi)
663 n0.setScript("o0=[3,6,8,9,-2,5]")
665 n1=self.r.createForEachLoop("n1",ti)
666 n10=self.r.createScriptNode("","n10")
667 n10.setExecutionMode("remote")
668 n10.setContainer(cont)
674 raise Exception("Simulated error !")
678 i1=n10.edAddInputPort("i1",ti)
679 o2=n10.edAddOutputPort("o2",ti)
681 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
682 p.edAddLink(n1.edGetSamplePort(),i1)
684 n1.edGetNbOfBranchesPort().edInitPy(1)
685 n2=self.r.createScriptNode("","n2")
686 n2.setScript("o4=i3")
687 i3=n2.edAddInputPort("i3",tsi)
688 o4=n2.edAddOutputPort("o4",tsi)
689 n2.setScript("o4=i3")
695 l=loader.YACSLoader()
697 n1=p.getChildByName("n1")
698 ex=pilot.ExecutorSwig()
702 self.assertEqual(n1.getState(),pilot.FAILED)
703 n1.edGetSeqOfSamplesPort().getPyObj()
704 a,b,c=n1.getPassedResults(ex)
705 self.assertEqual(a,list(range(3)))
706 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16]])
707 self.assertEqual(c,['n10_o2_interceptor'])
711 from datetime import datetime
712 fname=os.path.join(self.workdir, "test8.xml")
713 p=self.r.createProc("prTest2")
714 cont=p.createContainer("gg","Salome")
715 cont.setProperty("name","localhost")
716 cont.setProperty("hostname","localhost")
717 cont.setProperty("type","multi")
718 td=p.createType("double","double")
719 ti=p.createType("int","int")
720 tsi=p.createSequenceTc("seqint","seqint",ti)
721 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
722 n0=self.r.createScriptNode("","n0")
723 o0=n0.edAddOutputPort("o0",tsi)
724 n0.setScript("o0=[3,6,8,9,-2,5]")
726 n1=self.r.createForEachLoop("n1",ti)
727 n10=self.r.createScriptNode("","n10")
728 n10.setExecutionMode("remote")
729 n10.setContainer(cont)
734 raise Exception("Simulated error !")
739 i1=n10.edAddInputPort("i1",ti)
740 o2=n10.edAddOutputPort("o2",ti)
742 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
743 p.edAddLink(n1.edGetSamplePort(),i1)
745 n1.edGetNbOfBranchesPort().edInitPy(2)
746 n2=self.r.createScriptNode("","n2")
747 n2.setScript("o4=i3")
748 i3=n2.edAddInputPort("i3",tsi)
749 o4=n2.edAddOutputPort("o4",tsi)
750 n2.setScript("o4=i3")
756 l=loader.YACSLoader()
758 n1=p.getChildByName("n1")
759 ex=pilot.ExecutorSwig()
760 ex.setKeepGoingProperty(True)
762 startt=datetime.now()
764 t0=datetime.now()-startt
766 self.assertEqual(n1.getState(),pilot.FAILED)
767 n1.edGetSeqOfSamplesPort().getPyObj()
768 a,b,c=n1.getPassedResults(ex)
769 self.assertEqual(a,[0,1,2,4,5])
770 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
771 self.assertEqual(c,['n10_o2_interceptor'])
773 p.getChildByName("n1").getChildByName("n10").setScript("""
777 raise Exception("Simulated error !")
781 ex=pilot.ExecutorSwig()
782 ex.setKeepGoingProperty(True)
784 startt=datetime.now()
786 t1=datetime.now()-startt
788 self.assertEqual(n1.getState(),pilot.FAILED)
789 n1.edGetSeqOfSamplesPort().getPyObj()
790 a,b,c=n1.getPassedResults(ex)
791 self.assertEqual(a,[1,2,3,4,5])
792 self.assertEqual([elt.getPyObj() for elt in b],[[12,16,18,-4,10]])
793 self.assertEqual(c,['n10_o2_interceptor'])
797 """ Test of assignation of already computed values for foreach node."""
798 fname=os.path.join(self.workdir, "test9.xml")
799 from datetime import datetime
800 p=self.r.createProc("prTest2")
801 cont=p.createContainer("gg","Salome")
802 cont.setProperty("name","localhost")
803 cont.setProperty("hostname","localhost")
804 cont.setProperty("type","multi")
805 td=p.createType("double","double")
806 ti=p.createType("int","int")
807 tsi=p.createSequenceTc("seqint","seqint",ti)
808 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
809 n0=self.r.createScriptNode("","n0")
810 o0=n0.edAddOutputPort("o0",tsi)
811 n0.setScript("o0=[3,6,8,9,-2,5]")
813 n1=self.r.createForEachLoop("n1",ti)
814 n10=self.r.createScriptNode("","n10")
815 n10.setExecutionMode("remote")
816 n10.setContainer(cont)
821 raise Exception("Simulated error !")
826 i1=n10.edAddInputPort("i1",ti)
827 o2=n10.edAddOutputPort("o2",ti)
829 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
830 p.edAddLink(n1.edGetSamplePort(),i1)
832 n1.edGetNbOfBranchesPort().edInitPy(2)
833 n2=self.r.createScriptNode("","n2")
834 n2.setScript("o4=i3")
835 i3=n2.edAddInputPort("i3",tsi)
836 o4=n2.edAddOutputPort("o4",tsi)
837 n2.setScript("o4=i3")
843 l=loader.YACSLoader()
845 n1=p.getChildByName("n1")
846 ex=pilot.ExecutorSwig()
847 ex.setKeepGoingProperty(True)
849 startt=datetime.now()
851 t0=datetime.now()-startt
853 self.assertEqual(p.getState(),pilot.FAILED)
854 self.assertEqual(n1.getState(),pilot.FAILED)
855 n1.edGetSeqOfSamplesPort().getPyObj()
856 a,b,c=n1.getPassedResults(ex)
857 self.assertEqual(a,[0,1,2,4,5])
858 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
859 self.assertEqual(c,['n10_o2_interceptor'])
861 p.getChildByName("n1").getChildByName("n10").setScript("""
866 ex=pilot.ExecutorSwig()
867 ex.setKeepGoingProperty(True)
868 p.getChildByName("n1").assignPassedResults(a,b,c)
870 startt=datetime.now()
872 t1=datetime.now()-startt
874 self.assertEqual(n1.getState(),pilot.DONE)
875 self.assertEqual(p.getState(),pilot.DONE)
876 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6,12,16,63,-4,10])
880 fname=os.path.join(self.workdir, "test10.xml")
881 from datetime import datetime
882 p=self.r.createProc("prTest2")
883 cont=p.createContainer("gg","Salome")
884 cont.setProperty("name","localhost")
885 cont.setProperty("hostname","localhost")
886 cont.setProperty("type","multi")
887 td=p.createType("double","double")
888 ti=p.createType("int","int")
889 tsi=p.createSequenceTc("seqint","seqint",ti)
890 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
891 n0=self.r.createScriptNode("","n0")
892 o0=n0.edAddOutputPort("o0",tsi)
893 n0.setScript("o0=[ 3*elt for elt in range(12) ]")
895 n1=self.r.createForEachLoop("n1",ti)
896 n10=self.r.createScriptNode("","n10")
897 n10.setExecutionMode("remote")
898 n10.setContainer(cont)
903 raise Exception("Simulated error !")
908 i1=n10.edAddInputPort("i1",ti)
909 o2=n10.edAddOutputPort("o2",ti)
911 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
912 p.edAddLink(n1.edGetSamplePort(),i1)
914 n1.edGetNbOfBranchesPort().edInitPy(2)
915 n2=self.r.createScriptNode("","n2")
916 n2.setScript("o4=i3")
917 i3=n2.edAddInputPort("i3",tsi)
918 o4=n2.edAddOutputPort("o4",tsi)
919 n2.setScript("o4=i3")
925 l=loader.YACSLoader()
927 n1=p.getChildByName("n1")
928 ex=pilot.ExecutorSwig()
929 ex.setKeepGoingProperty(True)
931 startt=datetime.now()
933 t0=datetime.now()-startt
935 self.assertEqual(p.getState(),pilot.FAILED)
936 self.assertEqual(n1.getState(),pilot.FAILED)
937 n1.edGetSeqOfSamplesPort().getPyObj()
938 a,b,c=n1.getPassedResults(ex)
939 self.assertEqual(a,[1,3,5,7,9,11])
940 self.assertEqual([elt.getPyObj() for elt in b],[[12,36,60,84,108,132]])
941 self.assertEqual(c,['n10_o2_interceptor'])
943 p.getChildByName("n1").getChildByName("n10").setScript("""
946 raise Exception("Simulated error !")
951 ex=pilot.ExecutorSwig()
952 ex.setKeepGoingProperty(True)
953 p.getChildByName("n1").assignPassedResults(a,b,c)
955 startt=datetime.now()
957 t1=datetime.now()-startt
958 #assert(t1.total_seconds()<6.+1.)# normally 6/2+1 s (6 remaining elts in 2 // branches + 1s to launch container)
960 self.assertEqual(n1.getState(),pilot.DONE)
961 self.assertEqual(p.getState(),pilot.DONE)
962 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,12,30,36,60,60,90,84,120,108,150,132])
969 "test if we do not restart from the begining of the schema after an error in a foreach"
970 fname=os.path.join(self.workdir, "test11.xml")
971 from datetime import datetime
972 p=self.r.createProc("prTest2")
973 cont=p.createContainer("gg","Salome")
974 cont.setProperty("name","localhost")
975 cont.setProperty("hostname","localhost")
976 cont.setProperty("type","multi")
977 td=p.createType("double","double")
978 ti=p.createType("int","int")
979 tsi=p.createSequenceTc("seqint","seqint",ti)
980 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
981 n0=self.r.createScriptNode("","n0")
982 o0=n0.edAddOutputPort("o0",tsi)
983 n0.setScript("o0=[ elt for elt in range(12) ]")
985 n1=self.r.createForEachLoop("n1",ti)
986 n10=self.r.createScriptNode("","n10")
987 n10.setExecutionMode("remote")
988 n10.setContainer(cont)
993 raise Exception("Simulated error !")
998 i1=n10.edAddInputPort("i1",ti)
999 o2=n10.edAddOutputPort("o2",ti)
1001 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
1002 p.edAddLink(n1.edGetSamplePort(),i1)
1003 p.edAddCFLink(n0,n1)
1004 n1.edGetNbOfBranchesPort().edInitPy(2)
1005 n2=self.r.createScriptNode("","n2")
1006 n2.setScript("o4=i3")
1007 i3=n2.edAddInputPort("i3",tsi)
1008 o4=n2.edAddOutputPort("o4",tsi)
1009 n2.setScript("o4=i3")
1011 p.edAddCFLink(n1,n2)
1015 l=loader.YACSLoader()
1017 n1=p.getChildByName("n1")
1018 ex=pilot.ExecutorSwig()
1019 ex.setKeepGoingProperty(True)
1021 startt=datetime.now()
1023 t0=datetime.now()-startt
1025 self.assertEqual(p.getState(),pilot.FAILED)
1026 self.assertEqual(n1.getState(),pilot.FAILED)
1027 n1.edGetSeqOfSamplesPort().getPyObj()
1028 a,b,c=n1.getPassedResults(ex)
1030 self.assertEqual(a,[0,2,4,6,8,10])
1031 self.assertEqual([elt.getPyObj() for elt in b],[[0,4,8,12,16,20]])
1033 p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(12) ]")
1034 p.getChildByName("n1").getChildByName("n10").setScript("""
1037 raise Exception("Simulated error !")
1045 p.getChildByName("n1").assignPassedResults(a,b,c)
1048 startt=datetime.now()
1050 t1=datetime.now()-startt
1052 self.assertEqual(n1.getState(),pilot.DONE)
1053 self.assertEqual(p.getState(),pilot.DONE)
1054 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,5,4,15,8,25,12,35,16,45,20,55])
1058 """ Test of nested ForEachLoop with a port connected inside and outside the loop."""
1059 schema = self.r.createProc("schema")
1060 ti = schema.getTypeCode("int")
1061 tiset = schema.createSequenceTc("", "seqint", ti)
1062 tisetseq = schema.createSequenceTc("", "seqintvec", tiset)
1064 n1 = self.r.createScriptNode("", "PyScript2")
1065 n1.edAddInputPort("i3", ti)
1066 n1.edAddInputPort("i4", ti)
1067 n1.edAddOutputPort("o5", ti)
1068 n1.setScript("o5=i3+i4")
1070 n2 = self.r.createScriptNode("", "PyScript1")
1071 n2.edAddInputPort("i2", ti)
1072 n2.edAddOutputPort("o3", ti)
1073 n2.setScript("o3=i2")
1075 b1 = self.r.createBloc("Bloc1")
1079 fe1 = self.r.createForEachLoop("ForEach1", ti)
1080 fe1.getInputPort("nbBranches").edInitPy(2)
1081 fe1.getInputPort("SmplsCollection").edInitPy([1, 2, 3, 4])
1084 n3 = self.r.createScriptNode("", "PostProcessing")
1085 n3.edAddInputPort("i7", tiset)
1086 n3.edAddInputPort("i5", tiset)
1087 n3.edAddOutputPort("o4", ti)
1097 b0 = self.r.createBloc("Bloc0")
1101 fe0 = self.r.createForEachLoop("ForEach1", ti)
1102 fe0.getInputPort("nbBranches").edInitPy(2)
1103 fe0.getInputPort("SmplsCollection").edInitPy([1, 2, 3, 4])
1106 schema.edAddChild(fe0)
1108 nx = self.r.createScriptNode("", "Result")
1109 nx.edAddInputPort("i8", tiset)
1110 nx.edAddOutputPort("o6", ti)
1116 schema.edAddChild(nx)
1118 schema.edAddLink(fe1.getOutputPort("evalSamples"), n1.getInputPort("i3"))
1119 schema.edAddLink(fe0.getOutputPort("evalSamples"), n1.getInputPort("i4"))
1121 schema.edAddDFLink(n1.getOutputPort("o5"), n3.getInputPort("i7"))
1122 schema.edAddDFLink(n2.getOutputPort("o3"), n3.getInputPort("i5"))
1124 po5 = fe1.getOutputPort("Bloc1.PyScript2.o5")
1125 schema.edAddDFLink(po5, n2.getInputPort("i2"))
1127 schema.edAddDFLink(n3.getOutputPort("o4"), nx.getInputPort("i8"))
1128 # schema.saveSchema("foreach12.xml")
1130 e = pilot.ExecutorSwig()
1132 self.assertEqual(schema.getState(),pilot.DONE)
1133 resVal = schema.getChildByName("Result").getOutputPort("o6").getPyObj()
1134 self.assertEqual(resVal, 160)
1138 """ Non regression test EDF11239. ForEach into ForEach. Problem on cloning linked to DeloymentTree.appendTask method that was too strong."""
1139 p=self.r.createProc("Bug11239")
1140 ti=p.createType("int","int")
1141 ti2=p.createSequenceTc("seqint","seqint",ti)
1143 cont=p.createContainer("DefaultContainer","Salome")
1145 node0=self.r.createForEachLoop("ForEachLoop_int0",ti)
1147 node0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
1148 node0.edGetNbOfBranchesPort().edInitInt(2)
1150 node00=self.r.createBloc("Bloc0")
1151 node0.edAddChild(node00)
1152 node000_0=self.r.createForEachLoop("ForEachLoop_int1",ti)
1153 node00.edAddChild(node000_0)
1154 node000_0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
1155 node000_0.edGetNbOfBranchesPort().edInitInt(3)
1157 node0000=self.r.createBloc("Bloc1")
1158 node000_0.edAddChild(node0000)
1160 node0000_0=self.r.createScriptNode("","PyScript2")
1161 node0000.edAddChild(node0000_0)
1162 i3=node0000_0.edAddInputPort("i3",ti)
1163 i4=node0000_0.edAddInputPort("i4",ti)
1164 o5=node0000_0.edAddOutputPort("o5",ti)
1165 node0000_0.setScript("o5 = i3 + i4")
1166 node0000_0.setContainer(cont)
1167 node0000_0.setExecutionMode("remote")
1168 p.edAddLink(node0.edGetSamplePort(),i3)
1169 p.edAddLink(node000_0.edGetSamplePort(),i4)
1171 node0000_1=self.r.createScriptNode("","PyScript1")
1172 node0000.edAddChild(node0000_1)
1173 o3=node0000_1.edAddOutputPort("o3",ti)
1174 node0000_1.setScript("o3 = 7")
1175 node0000_1.setExecutionMode("local")
1176 p.edAddCFLink(node0000_0,node0000_1)
1178 node000_1=self.r.createScriptNode("","PostTraitement")
1179 node00.edAddChild(node000_1)
1180 i7=node000_1.edAddInputPort("i7",ti2)
1181 i5=node000_1.edAddInputPort("i5",ti2)
1182 node000_1.setScript("for i in i7:\n print(i)\nprint(\"separation\")\nfor i in i5:\n print(i)")
1183 node000_1.setContainer(cont)
1184 node000_1.setExecutionMode("remote")
1187 p.edAddCFLink(node000_0,node000_1)
1189 #p.saveSchema("tmpp.xml")
1190 ex = pilot.ExecutorSwig()
1191 self.assertEqual(p.getState(),pilot.READY)
1193 self.assertEqual(p.getState(),pilot.DONE)
1197 """ Non regression EDF11027. Problem after Save/Load of a foreach node with type pyobj with input "SmplsCollection" manually set before. Correction in convertToYacsObjref from XML->Neutral. Objref can hide a string !"""
1198 xmlFileName=os.path.join(self.workdir, "test14.xml")
1199 SALOMERuntime.RuntimeSALOME_setRuntime()
1200 r=pilot.getRuntime()
1201 n0=r.createProc("test23/zeRun")
1202 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1203 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tp)
1204 n0bis=r.createBloc("test23/main") ; n0.edAddChild(n0bis)
1205 n00=r.createBloc("test23/run") ; n0bis.edAddChild(n00)
1207 n000=r.createForEachLoop("test23/FE",tp) ; n00.edAddChild(n000)
1208 n0000=r.createScriptNode("Salome","test23/run_internal") ; n000.edSetNode(n0000)
1209 i0=n0000.edAddInputPort("i0",tp)
1210 i1=n0000.edAddInputPort("i1",tp) ; i1.edInitPy(3)
1211 o0=n0000.edAddOutputPort("o0",tp)
1212 n0000.setScript("o0=i0+i1")
1214 n00.edAddLink(n000.edGetSamplePort(),i0)
1216 n000.edGetSeqOfSamplesPort().edInitPy(list(range(10)))
1217 n000.edGetNbOfBranchesPort().edInitInt(2)
1219 n01=r.createScriptNode("Salome","test23/check") ; n0bis.edAddChild(n01)
1220 n0bis.edAddCFLink(n00,n01)
1221 i2=n01.edAddInputPort("i2",tp2)
1222 o1=n01.edAddOutputPort("o1",tp2)
1223 n01.setScript("o1=i2")
1224 n0bis.edAddLink(o0,i2)
1226 n0.saveSchema(xmlFileName)
1228 l=loader.YACSLoader()
1229 p=l.load(xmlFileName) # very import do not use n0 but use p instead !
1230 ex=pilot.ExecutorSwig()
1232 self.assertEqual(p.getState(),pilot.READY)
1234 self.assertEqual(p.getState(),pilot.DONE)
1235 self.assertEqual(p.getChildByName("test23/main.test23/check").getOutputPort("o1").getPyObj(),[3,4,5,6,7,8,9,10,11,12])
1239 #fname=os.path.join(self.workdir, "BugInConcurrentLaunchDftCont.xml")
1240 p=self.r.createProc("pr")
1241 ti=p.createType("int","int")
1242 cont=p.createContainer("DefaultContainer","Salome")
1243 cont.setProperty("container_name","FactoryServer")
1244 b=self.r.createBloc("Bloc") ; p.edAddChild(b)
1249 node=self.r.createScriptNode("Salome","node%d"%i)
1250 node.setExecutionMode("remote")
1251 node.setContainer(cont)
1252 outs.append(node.edAddOutputPort("i",ti))
1253 node.setScript("i=%d"%i)
1256 node=self.r.createScriptNode("Salome","nodeEnd")
1257 node.setExecutionMode("remote")
1258 node.setContainer(cont)
1259 res=node.edAddOutputPort("res",ti)
1264 inp=node.edAddInputPort(elt,ti) ; l.append(elt)
1266 p.edAddLink(outs[i],inp)
1267 node.setScript("res="+"+".join(l))
1268 p.edAddCFLink(b,node)
1272 ex = pilot.ExecutorSwig()
1273 self.assertEqual(p.getState(),pilot.READY)
1275 self.assertEqual(res.getPyObj(),6)
1276 self.assertEqual(p.getState(),pilot.DONE)
1280 """ Test to check that a list[pyobj] outputport linked to pyobj inputport is OK."""
1281 SALOMERuntime.RuntimeSALOME_setRuntime()
1282 self.r=pilot.getRuntime()
1283 n0=self.r.createProc("test16/zeRun")
1284 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1285 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tp)
1287 n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
1288 o0=n00.edAddOutputPort("o0",tp2)
1289 n00.setScript("o0=[[i+1] for i in range(8)]")
1290 n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
1291 i1=n01.edAddInputPort("i1",tp)
1292 n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
1293 n0.edAddCFLink(n00,n01)
1296 ex=pilot.ExecutorSwig()
1297 self.assertEqual(n0.getState(),pilot.READY)
1299 self.assertEqual(n0.getState(),pilot.DONE)
1303 """ Same as test16 except that tp2 is not list of tp but a list of copy of tp"""
1304 SALOMERuntime.RuntimeSALOME_setRuntime()
1305 self.r=pilot.getRuntime()
1306 n0=self.r.createProc("test17/zeRun")
1307 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1308 tpp=n0.createInterfaceTc("python:obj:1.0","pyobj",[]) # diff is here
1309 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tpp)
1311 n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
1312 o0=n00.edAddOutputPort("o0",tp2)
1313 n00.setScript("o0=[[i+1] for i in range(8)]")
1314 n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
1315 i1=n01.edAddInputPort("i1",tp)
1316 n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
1317 n0.edAddCFLink(n00,n01)
1320 ex=pilot.ExecutorSwig()
1321 self.assertEqual(n0.getState(),pilot.READY)
1323 self.assertEqual(n0.getState(),pilot.DONE)
1327 p=self.r.createProc("prTest18")
1328 n00=self.r.createScriptNode("Salome","n00")
1329 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1330 n00.setExecutionMode("remote")
1331 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1332 cont=p.createContainer("gg","Salome")
1333 n00.setContainer(cont)
1334 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1335 cont.setProperty("nb_proc_per_nod","6")
1336 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1337 cont.setProperty("nb_proc_per_node","7") # <- here
1338 self.assertEqual(n00.getMaxLevelOfParallelism(),7) # <- here
1342 """This test checks the mechanism of YACS that allow PythonNodes to know their DynParaLoop context."""
1343 fname=os.path.join(self.workdir, "test19.xml")
1344 l=loader.YACSLoader()
1346 p=self.r.createProc("PROC")
1347 ti=p.createType("int","int")
1348 tdi=p.createSequenceTc("seqint","seqint",ti)
1350 fe0=self.r.createForEachLoop("FE0",ti) ; p.edAddChild(fe0)
1351 fe0.edGetNbOfBranchesPort().edInitInt(4)
1352 fe0_end=self.r.createScriptNode("Salome","fe0_end")
1353 fe0.edSetFinalizeNode(fe0_end)
1354 fe0_end.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0"])
1355 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<4)""")
1356 n0=self.r.createScriptNode("Salome","n0") ; p.edAddChild(n0)
1357 n0.setScript("o1=range(10)")
1358 a=n0.edAddOutputPort("o1",tdi)
1359 p.edAddLink(a,fe0.edGetSeqOfSamplesPort()) ; p.edAddCFLink(n0,fe0)
1361 b0=self.r.createBloc("b0") ; fe0.edAddChild(b0)
1362 n1=self.r.createScriptNode("Salome","n1") ; b0.edAddChild(n1)
1363 n1.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0"])
1364 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<4)
1366 b=n1.edAddOutputPort("o1",tdi)
1367 fe1=self.r.createForEachLoop("FE1",ti) ; b0.edAddChild(fe1)
1368 fe1.edGetNbOfBranchesPort().edInitInt(3)
1369 fe1_end=self.r.createScriptNode("Salome","fe1_end")
1370 fe1_end.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0.b0.FE1","FE0"])
1371 assert(my_dpl_localization[1][1]>=0 and my_dpl_localization[1][1]<4)
1372 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<3)
1374 fe1.edSetFinalizeNode(fe1_end)
1375 p.edAddLink(b,fe1.edGetSeqOfSamplesPort()) ; p.edAddCFLink(n1,fe1)
1377 n2=self.r.createScriptNode("Salome","n2") ; fe1.edAddChild(n2)
1378 n2.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0.b0.FE1","FE0"])
1379 assert(my_dpl_localization[1][1]>=0 and my_dpl_localization[1][1]<4)
1380 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<3)
1384 ex=pilot.ExecutorSwig()
1386 # local run of PythonNodes n1 and n2
1389 self.assertEqual(p.getState(),pilot.READY)
1390 ex.setDPLScopeSensitive(True) # <- this line is the aim of the test
1392 self.assertEqual(p.getState(),pilot.DONE)
1396 pg=pilot.PlayGround()
1397 pg.setData([("localhost",4)])
1398 cont=p.createContainer("gg","HPSalome")
1399 cont.setProperty("nb_proc_per_node","1")
1400 n1=p.getChildByName("FE0.b0.n1") ; n1.setExecutionMode("remote") ; n1.setContainer(cont)
1401 n2=p.getChildByName("FE0.b0.FE1.n2") ; n2.setExecutionMode("remote") ; n2.setContainer(cont)
1403 self.assertEqual(p.getState(),pilot.READY)
1404 p.propagePlayGround(pg)
1406 self.assertEqual(p.getState(),pilot.DONE)
1410 """This test revealed a huge bug in ElementaryNode contained in a loop or foreach. The RECONNECT state generated invalid dependancies that only HPContainer can reveal the problem"""
1411 def assignCont(n,cont):
1412 n.setExecutionMode("remote") ; n.setContainer(cont)
1414 xmlFileName="test20.xml"
1415 p=self.r.createProc("test26")
1417 pg=pilot.PlayGround()
1418 pg.setData([("localhost",8)]) # important make this figure >= 6
1419 cont=p.createContainer("gg","HPSalome") # very important ! HP Container needed for the test !
1420 cont.setProperty("nb_proc_per_node","1")
1422 po=p.createInterfaceTc("python:obj:1.0","pyobj",[])
1423 sop=p.createSequenceTc("list[pyobj]","list[pyobj]",po)
1425 b0=self.r.createBloc("test26/main") ; p.edAddChild(b0)
1426 n0=self.r.createScriptNode("Salome","test26/n0") ; assignCont(n0,cont) # 1
1427 n0.setScript("""import os
1429 dd=n0.edAddOutputPort("dd",sop) ; b0.edAddChild(n0)
1430 fe0=self.r.createForEachLoop("test26/FE0",po) ; b0.edAddChild(fe0)
1431 fe0.edGetNbOfBranchesPort().edInitInt(1) # very important for the test : 1 !
1432 fe0i=self.r.createBloc("test26/FE0_internal") ; fe0.edSetNode(fe0i)
1433 zeArgInitNode2=self.r.createScriptNode("Salome","zeArgInitNode") ; assignCont(zeArgInitNode2,cont) # 2
1434 fe0i.edAddChild(zeArgInitNode2)
1435 c1=zeArgInitNode2.edAddInputPort("c",po)
1436 c2=zeArgInitNode2.edAddOutputPort("c",po)
1437 zeRun=self.r.createBloc("test26/zeRun") ; fe0i.edAddChild(zeRun)
1438 zeArgInitNode=self.r.createScriptNode("Salome","zeArgInitNode") ; assignCont(zeArgInitNode,cont) # 3
1439 zeRun.edAddChild(zeArgInitNode)
1440 ff1=zeArgInitNode.edAddInputPort("ff",po)
1441 ff2=zeArgInitNode.edAddOutputPort("ff",po)
1442 line01=self.r.createScriptNode("Salome","line01") ; zeRun.edAddChild(line01) ; assignCont(line01,cont) # 4
1443 line01.setScript("ee=3")
1444 ee0=line01.edAddOutputPort("ee",po)
1445 initt=self.r.createScriptNode("Salome","test26/initt") ; assignCont(initt,cont) # 5
1446 initt.setScript("pass") ; zeRun.edAddChild(initt)
1447 end=self.r.createScriptNode("Salome","test26/end") ; assignCont(end,cont) # 6
1448 end.setScript("import os") ; zeRun.edAddChild(end)
1449 retu=self.r.createScriptNode("Salome","return") ; assignCont(retu,cont) # 7
1450 retu.setScript("ee=i0") ; zeRun.edAddChild(retu)
1451 i0=retu.edAddInputPort("i0",po)
1452 ee=retu.edAddOutputPort("ee",po)
1453 zeRun.edAddCFLink(zeArgInitNode,line01)
1454 zeRun.edAddCFLink(line01,initt)
1455 zeRun.edAddCFLink(initt,end)
1456 zeRun.edAddCFLink(end,retu)
1459 returnn=self.r.createScriptNode("Salome","return") ; assignCont(returnn,cont) # 8
1460 returnn.setScript("elt=i0")
1461 i00=returnn.edAddInputPort("i0",po)
1462 elt=returnn.edAddOutputPort("elt",po)
1463 fe0i.edAddChild(returnn)
1464 fe0i.edAddCFLink(zeArgInitNode2,zeRun)
1465 fe0i.edAddCFLink(zeRun,returnn)
1469 finalize=self.r.createScriptNode("Salome","test26/finalize") ; b0.edAddChild(finalize) ; assignCont(finalize,cont) # 9
1470 finalize.setScript("pass")
1471 b0.edAddCFLink(n0,fe0)
1472 b0.edAddCFLink(fe0,finalize)
1474 p.edAddLink(dd,fe0.edGetSeqOfSamplesPort())
1475 p.edAddLink(fe0.edGetSamplePort(),c1)
1477 #p.saveSchema(xmlFileName)
1478 p.getChildByName("test26/main.test26/FE0").edGetNbOfBranchesPort().edInitInt(1) # very important 1 !
1480 ex=pilot.ExecutorSwig()
1481 p.propagePlayGround(pg)
1482 self.assertEqual(p.getState(),pilot.READY)
1484 self.assertEqual(p.getState(),pilot.DONE)
1490 "test if we restart from a saved state in a foreach loop"
1491 fname=os.path.join(self.workdir, "test21.xml")
1492 xmlStateFileName=os.path.join(self.workdir, "saveState21.xml")
1493 from datetime import datetime
1494 p=self.r.createProc("prTest21")
1495 cont=p.createContainer("gg","Salome")
1496 cont.setProperty("name","localhost")
1497 cont.setProperty("hostname","localhost")
1498 cont.setProperty("type","multi")
1499 td=p.createType("double","double")
1500 ti=p.createType("int","int")
1501 tsi=p.createSequenceTc("seqint","seqint",ti)
1502 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
1503 n0=self.r.createScriptNode("","n0")
1504 o0=n0.edAddOutputPort("o0",tsi)
1505 n0.setScript("o0=[ elt for elt in range(6) ]")
1507 n1=self.r.createForEachLoop("n1",ti)
1508 n10=self.r.createScriptNode("","n10")
1509 n10.setExecutionMode("remote")
1510 n10.setContainer(cont)
1517 i1=n10.edAddInputPort("i1",ti)
1518 o2=n10.edAddOutputPort("o2",ti)
1520 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
1521 p.edAddLink(n1.edGetSamplePort(),i1)
1522 p.edAddCFLink(n0,n1)
1523 n1.edGetNbOfBranchesPort().edInitPy(2)
1524 n2=self.r.createScriptNode("","n2")
1525 n2.setScript("o4=i3")
1526 i3=n2.edAddInputPort("i3",tsi)
1527 o4=n2.edAddOutputPort("o4",tsi)
1528 n2.setScript("o4=i3")
1530 p.edAddCFLink(n1,n2)
1534 l=loader.YACSLoader()
1536 n1=p.getChildByName("n1")
1537 ex=pilot.ExecutorSwig()
1538 ex.setKeepGoingProperty(True)
1540 startt=datetime.now()
1542 myRun=threading.Thread(None, ex.RunW, None, (p,0))
1546 SALOMERuntime.schemaSaveState(p, ex, xmlStateFileName)
1547 a,b,c=n1.getPassedResults(ex)
1549 t0=datetime.now()-startt
1551 self.assertEqual(p.getState(),pilot.DONE)
1552 self.assertEqual(n1.getState(),pilot.DONE)
1553 self.assertEqual(a,[0,1])
1554 self.assertEqual([elt.getPyObj() for elt in b],[[0,2]])
1556 p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
1557 p.getChildByName("n1").getChildByName("n10").setScript("""
1562 loader.loadState(p, xmlStateFileName)
1564 p.getChildByName("n1").assignPassedResults(a,b,c)
1569 self.assertEqual(n1.getState(),pilot.DONE)
1570 self.assertEqual(p.getState(),pilot.DONE)
1571 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
1573 # Restart from a saved state in a foreach loop without using assignPassedResults.
1574 # This test uses the files test21.xml and saveState21.xml produced by test21.
1576 ex=pilot.ExecutorSwig()
1577 l=loader.YACSLoader()
1579 q.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
1580 q.getChildByName("n1").getChildByName("n10").setScript("""
1583 print("execution n10:", i1)
1586 q.getChildByName("n2").setScript("""
1587 print("execution n2:", i3)
1590 loader.loadState(q, xmlStateFileName)
1596 self.assertEqual(q.getChildByName("n1").getState(),pilot.DONE)
1597 self.assertEqual(q.getState(),pilot.DONE)
1598 self.assertEqual(q.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
1602 """ test focused on weight attribut after a dump and reload from a xml file
1604 fname=os.path.join(self.workdir, "test23.xml")
1605 p=self.r.createProc("prTest23")
1606 cont=p.createContainer("gg","Salome")
1607 cont.setProperty("name","localhost")
1608 cont.setProperty("hostname","localhost")
1609 cont.setProperty("type","multi")
1610 td=p.createType("double","double")
1611 ti=p.createType("int","int")
1612 tsi=p.createSequenceTc("seqint","seqint",ti)
1613 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
1614 n0=self.r.createScriptNode("","n0")
1615 o0=n0.edAddOutputPort("o0",tsi)
1616 n0.setScript("o0=[ elt for elt in range(6) ]")
1618 n1=self.r.createForEachLoop("n1",ti)
1620 n10=self.r.createScriptNode("","n10")
1621 n10.setExecutionMode("remote")
1622 n10.setContainer(cont)
1630 i1=n10.edAddInputPort("i1",ti)
1631 o2=n10.edAddOutputPort("o2",ti)
1633 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
1634 p.edAddLink(n1.edGetSamplePort(),i1)
1635 p.edAddCFLink(n0,n1)
1636 n1.edGetNbOfBranchesPort().edInitPy(2)
1637 n2=self.r.createScriptNode("","n2")
1638 n2.setScript("o4=i3")
1639 i3=n2.edAddInputPort("i3",tsi)
1640 o4=n2.edAddOutputPort("o4",tsi)
1641 n2.setScript("o4=i3")
1643 p.edAddCFLink(n1,n2)
1647 l=loader.YACSLoader()
1649 self.assertEqual(p.getChildByName("n1").getWeight().getSimpleLoopWeight(),3.0)
1650 self.assertEqual(p.getChildByName("n1").getChildByName("n10").getWeight().getElementaryWeight(),4.0)
1654 """ Non regression test EDF17470"""
1655 SALOMERuntime.RuntimeSALOME.setRuntime()
1656 r=SALOMERuntime.getSALOMERuntime()
1657 p=r.createProc("prTest2")
1659 cont1=p.createContainer("cont1","Salome")
1660 cont1.setProperty("name","localhost")
1661 cont1.setProperty("hostname","localhost")
1662 cont1.setProperty("type","multi")
1663 cont1.setProperty("container_name","container1@")
1665 cont2=p.createContainer("cont2","Salome")
1666 cont2.setProperty("name","localhost")
1667 cont2.setProperty("hostname","localhost")
1668 cont2.setProperty("type","multi")
1669 cont2.setProperty("container_name","container2@")
1671 td=p.createType("double","double")
1672 ti=p.createType("int","int")
1673 ts=p.createType("string","string")
1674 n0=r.createScriptNode("","n0")
1675 n0.setScript("""import SalomeSDSClt
1684 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1686 return pickle.loads(strr)
1689 salome.salome_init()
1692 dsm=salome.naming_service.Resolve("/DataServerManager")
1693 dsm.cleanScopesInNS()
1694 if scopeName in dsm.listScopes():
1695 dsm.removeDataScope(scopeName)
1696 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1698 t0=dss.createRdExtVarTransac(varName,obj2Str({"ab":[4,5,6]}))
1699 dss.atomicApply([t0])
1701 n0_sn=n0.edAddOutputPort("scopeName",ts)
1702 n0_vn=n0.edAddOutputPort("varName",ts)
1704 n1=r.createScriptNode("","n1")
1705 n1_sn=n1.edAddInputPort("scopeName",ts)
1706 n1_vn=n1.edAddInputPort("varName",ts)
1707 n1.setScript("""import SalomeSDSClt
1717 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1719 return pickle.loads(strr)
1721 salome.salome_init()
1722 dsm=salome.naming_service.Resolve("/DataServerManager")
1723 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1724 assert(not isCreated)
1726 t1=dss.addMultiKeyValueSession(varName)
1728 wk2=dss.waitForKeyInVar(varName,obj2Str("ef"))
1730 assert(str2Obj(dss.waitForMonoThrRev(wk2))==[11,12])""")
1731 n1.setContainer(cont1)
1733 n2=r.createScriptNode("","n2")
1734 n2_sn=n2.edAddInputPort("scopeName",ts)
1735 n2_vn=n2.edAddInputPort("varName",ts)
1736 n2.setScript("""import SalomeSDSClt
1746 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1748 return pickle.loads(strr)
1750 salome.salome_init()
1751 dsm=salome.naming_service.Resolve("/DataServerManager")
1752 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1753 assert(not isCreated)
1755 t1=dss.addMultiKeyValueSession(varName)
1756 t1.addKeyValueInVarErrorIfAlreadyExistingNow(obj2Str("cd"),obj2Str([7,8,9,10]))
1757 t1.addKeyValueInVarErrorIfAlreadyExistingNow(obj2Str("ef"),obj2Str([11,12]))
1759 n2.setContainer(cont2)
1764 p.edAddCFLink(n0,n1)
1765 p.edAddCFLink(n0,n2)
1766 p.edAddLink(n0_sn,n1_sn)
1767 p.edAddLink(n0_vn,n1_vn)
1768 p.edAddLink(n0_sn,n2_sn)
1769 p.edAddLink(n0_vn,n2_vn)
1771 ex=pilot.ExecutorSwig()
1773 self.assertEqual(p.getState(),pilot.DONE)
1777 fname=os.path.join(self.workdir, "test25.xml")
1778 p=self.r.createProc("p0")
1779 tp=p.createInterfaceTc("python:obj:1.0","pyobj",[])
1780 n1_0_sc=self.r.createScriptNode("Salome","n1_0_sc")
1781 p.edAddChild(n1_0_sc)
1782 n1_0_sc.setExecutionMode("remote")
1783 n1_0_sc.setScript("""""")
1784 i1_0_sc=n1_0_sc.edAddInputPort("i1",tp)
1785 i1_0_sc.edInitPy(list(range(4)))
1787 cont=p.createContainer("gg","Salome")
1788 cont.setProperty("name","localhost")
1789 cont.setProperty("hostname","localhost")
1790 n1_0_sc.setContainer(cont)
1793 l=loader.YACSLoader()
1795 ex=pilot.ExecutorSwig()
1796 self.assertEqual(p.getState(),pilot.READY)
1798 self.assertEqual(p.getState(),pilot.DONE)
1803 This test is here to check that old (<=930) graphs are always loadable.
1804 So an xml file coming from test14 in 930 has been generated and converted into home made "base64" like format.
1805 This test puts unbased64 byte array into test_930.xml and load it to check that everything is OK.
1808 content_of_file = b'DDkShXM2PeNCndPqRfnYX5EAt.GaRgPq7dNqtfnYZgvqh=kQf7moXCE2z5lED.tCxgM2RcOqdfl29ePC9YnAx3uaGetqF5lE=.E2D0uS1eM2RcOqdfl2FjPqBYE2pdNq7fl2FjPqBYHoT3.2=.Ew9dsCdUFqVfOaj2Eaxet4BeN2=BOKRWOwF0PqfYMqdYHoT3.2=.EwxYNKHeNa=5O4heOwF4OKBeN2=7Maj2FaZXOaFDFwI.E2=1kibUua=5O4heOwF7Nq9YE2pdNq7fl2ZbMiFDFwI.E2=1nqFZNCdaM2RcOqdfl21dvqFZN2=7Maj2ECbWsKxbNQxYNKL6lo12HoT3.2=.EwneOCfeNqleM2RcOqdfl2BdPC9hcCbjN4Jfd2=APqRWuaRWuwF.uSxYNKFDFwI.E2=1kibUua=5O4heOwFAsiHdNqtYE2pdNq7fl2nWtCZbPaFDFwI.E2=1n4xbMiVdNqdYs2RcOqdfl26eNaVesq9g9qRWu4ZbOaHYFwI.E2=.E2=1kCHjMCdYsibUFqVfOaj2H4xbMiVdNqdYvupdNq7YE2PcMqfeOwFAe4BjOqdYHoT3.2=.E2=.Ew1Yvq1eNC9ds2RcOqdfl2VWsiVgMKdWPuxbPulXPqRdNqtYE2PcMqfeOwF.l2x5lE=.E2=.E2D.tCxUuaHWuS=5O4heOwFAPqRWu4ZbOaHjdqVfOaF.FiVXOidfl2McP49jNCbgeaHauaHYHoT3.2=.E2=.Ew1Yvq1eNC9ds2RcOqdfl2RcOqdYE2PcMqfeOwF1PqlcMq3jPC9YHoT3.2=.EwxAPqRWu4ZbOaHblE=.E2D2MqxgM2RcOqdfl29ePC9YnAx9O4ZbN2T3.2=.E2=.EwFXPqlUFqVfOaj2EidgsiHAnoHetqF5lE=.E2=.E2=.E2D4PqHeO4lVM2RcOqdfl29ePC9YnAx48WF.FqFYu4RgMKj2FAF.EqxjMCueOKtVMij2GoX2E29dsCdfl21dvqFZN2T3.2=.E2=.E2=.E2=.EwZbMqZbOa=5O4heOwF0uanWtAnDFCfbPuZbMidYtqVXN2T3.2=.E2=.E2=.E2=.E2=.EwngNCZUsiT1n4xWOaT1m2qg6WUWe0qjMAj7MAp7OAifdwDDH4xWOaT1nongNCZUsiT3.2=.E2=.E2=.E2=.E2=.EwZbMCxYsi=5O4heOwF7MAF.EibUuaj2ECbjN4JYHoT3.2=.E2=.E2=.E2=.E2=.EwZbMCxYsi=5O4heOwF7OAF.EibUuaj2ECbjN4JYHoT3.2=.E2=.E2=.E2=.E2=.Ewxesi1jNC9UFqVfOaj2Hq12E29dsCdfl21dvqFZN2x5lE=.E2=.E2=.E2=.E2DDGKRXOKReNwI.E2=.E2=.E2=1noNjNCdcP43blE=.E2=.E2=.E2D0O49cMqZbPK=APqRWtCxXOwF4O4BguaF5lE=.E2=.E2=.E2=.E2D4NCxfNqxWOaT0uanWtAnDFWcXnoNYvqhbPq7eNw=1laHjOq1jNC9bmaPcMqmcOq1XOanXnoNYvqhUvqHWtwI.E2=.E2=.E2=.E2=1kixbPq7eNw9ePC9YnAx48WR0uanWtAnDFCfbPuZbMidYtqVXMwx0vqRjMadbk2D0vq1jNC9bmK11no9jMCxYsiT3.2=.E2=.E2=.Ewx0O49cMqZbPKT3.2=.E2=.Ewx2MqxgNwI.E2=.E2=1mKRXOKReM2RcOqdfl29ePC9YnAxAMKdgPKF5lE=.E2=.E2=.E2DAv4HdMC9bkwljMadbkwVBf06c6eUhfqX9mKH9euT1noljMadbkwxAv4HdMC9blE=.E2=.E2=.E2D7Nq1jNC9UFqVfOaj2GKH2E29dsCdfl2BdPC9hcCbjN4Jfd2x5lE=.E2=.E2=.E2DDOi9UvqHWs2RcOqdfl2xcl2=0uS1eOwF1OKnWvO1dvqFZOuFDFwI.E2=.E2=1noZbMqZbOaT3.2=.E2=.EwljNq9YvqBbk2D4NCxfNqxWOaT0uanWtAnDFCfbMwx4NCxfNqxWOaT.Ew9jNqxWOaT0uanWtAnDH43eP4pXno9jNqxWOaT.EwxAPqRWtCxXNwI.E2=.E2=1kaVWu4BdNqpUH4xbMiHjMqj2FaVXPCdYFwI.E2=.E2=.E2=1laHjOqRjMadbkidgsiHAnoHetqR0uanWtAnDFWcbEidgsiHAnoHetqydNq9eNCRcMqDDFaHjOqRjMadbk2D4NCxfMCxYsiTDMADDFaHjOq1jNC9blE=.E2=.E2=.E2D0vqRjMadbkidgsiHAnolVOalhMwx0vqRjMadbk2D0vq1jNC9bmKH1no9jMCxYsiT3.2=.E2=.Ewx0O49cMqZbPKT3.2=.Ewx2MqxgNwI.E2=1kCVYu4heMidYtwI.E2=.E2=1kixbPq7eNw9ePC9YnAx9O4ZbNo9ePC9YnAx2uiRbEidgsiHAnoMe6wx0vqRjMadbkw9jMCxYsiT5N4EYu4RgMKdgswx0vq1jNC9blE=.E2=.E2D4u4BeuaT1mKRWtwH1noZbMiT1noPcMqfeNwI.E2=1no1cNCVfOa9eNCT3.2=.Ew1cNCVfOa9eNCT3.2=.E2=.Ew9jNqxWOaT0uanWtAnDGqVdNqR0uanWtAnDFCfbNo9ePC9YnAx48WDDEixbPq7eNwD0vq1jNC9bn8hUsqng9qBXOalWuKxbMwx0vq1jNC9blE=.E2=.E2D4u4BeuaT1m4HYu4bbkw7cMiVblED4u4BeuaT1nC9YuKRiNwAUkmI5EwxAsiHdNqtbkwx4u4BeuaT3.wPcMqfeNwDAsiHdNqtbkmX17ER1nonWtCZbPaT1noPcMqfeNwI1liVXOidbkwnWtCZbPaT17AAZ=oDDHC9YuKRiNwDDFiVXOidblED4u4BeuaT1nC9YuKRiNwAgkmI5EwxAsiHdNqtbkwx4u4BeuaT3.wPcMqfeNwDAsiHdNqtbkm917ER1nonWtCZbPaT1noPcMqfeNwI1liVXOidbkwnWtCZbPaT18gAZ=oDDHC9YuKRiNwDDFiVXOidblED4u4BeuaT1nC9YuKRiNwAakmI5EwxAsiHdNqtbkwx4u4BeuaT3.wPcMqfeNwDAsiHdNqtbkmv17ER1nonWtCZbPaT1noPcMqfeNwI1liVXOidbkwnWtCZbPaT16QAZ=oDDHC9YuKRiNwDDFiVXOidblED4u4BeuaT1nC9YuKRiNwAdkmI5EwxAsiHdNqtbkwx4u4BeuaT3.wx0O49cNwDDG4HYu4bbkwx4u4BeuaT3.2=.Ewx.u4HcOqdWuaHblE=.E2D.u4HcOqdWuaHblE=.E2=.E2D0vqRjMadbkidgsiHAnohcOKRbEidgsiHAnoHetqR0uanWtAnDFWcbEidgsiHAnoHetqydNq9eNCRcMqDDEixbPq7eNwD0vq1jNC9bmKX1no9jMCxYsiT3.2=.E2=.EwPcMqfeNwDDN4JYuaNbkwVBf06c6eUhcmn17ER9euT1noxYNKHeNaT1noPcMqfeNwI.E2=1no1cNCVfOa9eNCT3.wx.tCxgNwI3'
1810 fname=os.path.join(self.workdir, "test_930.xml")
1811 with open(fname,"wb") as f:
1812 f.write( pilot.FromBase64Swig(content_of_file) )
1814 SALOMERuntime.RuntimeSALOME_setRuntime()
1815 l=loader.YACSLoader()
1817 self.assertTrue(p.getChildByName("test23/main").getChildByName("test23/run").getChildByName("test23/FE").getChildByName("test23/run_internal").getInputPort("i1").getPyObj() == 3)
1818 self.assertTrue(p.getChildByName("test23/main").getChildByName("test23/run").getChildByName("test23/FE").edGetSeqOfSamplesPort().getPyObj()==list(range(10)))
1822 if __name__ == '__main__':
1824 U = os.getenv('USER')
1825 with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
1826 f.write(" --- TEST src/yacsloader: testSaveLoadRun.py\n")
1827 suite = unittest.makeSuite(TestSaveLoadRun)
1828 result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
1829 sys.exit(not result.wasSuccessful())