1 # Copyright (C) 2006-2019 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")
46 cont=p.createContainer("gg","HPSalome")
48 cont.setProperty("name","localhost")
49 cont.setProperty("hostname","localhost")
55 ref=datetime.datetime.now()
56 t=0. ; pas=1./float(nb)
60 t+=1.+cos(1.*(x*3.14159))
63 print("coucou from script0-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
69 ref=datetime.datetime.now()
70 o2=0. ; pas=1./float(i1)
74 o2+=1.+cos(1.*(x*3.14159))
76 print("coucou from script1-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
78 for i in range(nbOfNodes):
79 node0=self.r.createFuncNode("DistPython","node%i"%(i))
82 node0.setContainer(cont)
83 node0.setScript(script0)
84 nb=node0.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
85 dbg=node0.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
86 out0=node0.edAddOutputPort("s",td)
88 nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i))
89 p.edAddChild(nodeMiddle)
90 p.edAddCFLink(node0,nodeMiddle)
91 nodeMiddle.setFname("ff")
92 nodeMiddle.setContainer(cont)
93 nodeMiddle.setScript(script0)
94 nb=nodeMiddle.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
95 dbg=nodeMiddle.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
96 out0=nodeMiddle.edAddOutputPort("s",td)
97 nodeMiddle.setExecutionMode("remote")
99 nodeEnd=self.r.createScriptNode("Salome","node%i_2"%(i+1))
100 p.edAddChild(nodeEnd)
101 p.edAddCFLink(nodeMiddle,nodeEnd)
102 nodeEnd.setContainer(cont)
103 nodeEnd.setScript(script1)
104 i1=nodeEnd.edAddInputPort("i1",ti) ; i1.edInitInt(sqrtOfNumberOfTurn)
105 dbg=nodeEnd.edAddInputPort("dbg",ti) ; dbg.edInitInt(i)
106 o2=nodeEnd.edAddOutputPort("o2",td)
107 nodeEnd.setExecutionMode("remote")
111 ex=pilot.ExecutorSwig()
112 self.assertEqual(p.getState(),pilot.READY)
113 st=datetime.datetime.now()
116 print("Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st)))
117 self.assertEqual(p.getState(),pilot.DONE)
118 # 2nd exec using the same already launched remote python interpreters
119 st=datetime.datetime.now()
121 print("Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st)))
122 self.assertEqual(p.getState(),pilot.DONE)
123 # 3rd exec using the same already launched remote python interpreters
124 st=datetime.datetime.now()
126 print("Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st)))
127 self.assertEqual(p.getState(),pilot.DONE)
131 """ HP Container again like test0 but the initialization key of HPContainer is used here."""
132 fname=os.path.join(self.workdir, "TestSaveLoadRun1.xml")
134 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
135 l=loader.YACSLoader()
136 p=self.r.createProc("prTest1")
137 td=p.createType("double","double")
138 ti=p.createType("int","int")
139 cont=p.createContainer("gg","HPSalome")
140 cont.setSizeOfPool(4)
141 cont.setProperty("InitializeScriptKey","aa=123.456")
142 cont.setProperty("name","localhost")
143 cont.setProperty("hostname","localhost")
149 ref=datetime.datetime.now()
150 t=0. ; pas=1./float(nb)
154 t+=1.+cos(1.*(x*3.14159))
157 print("coucou from script0-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
160 # here in script1 aa is refered ! aa will exist thanks to HPCont Init Script
164 ref=datetime.datetime.now()
165 o2=0. ; pas=1./float(i1)
169 o2+=1.+cos(1.*(x*3.14159))
171 print("coucou %lf from script1-%i -> %s"%(aa,dbg,str(datetime.datetime.now()-ref)))
175 for i in range(nbOfNodes):
176 nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i)) # PyFuncNode remote
177 p.edAddChild(nodeMiddle)
178 nodeMiddle.setFname("ff")
179 nodeMiddle.setContainer(cont)
180 nodeMiddle.setScript(script0)
181 nb=nodeMiddle.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
182 dbg=nodeMiddle.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
183 out0=nodeMiddle.edAddOutputPort("s",td)
184 nodeMiddle.setExecutionMode("remote")
186 nodeEnd=self.r.createScriptNode("Salome","node%i_2"%(i+1)) # PythonNode remote
187 p.edAddChild(nodeEnd)
188 p.edAddCFLink(nodeMiddle,nodeEnd)
189 nodeEnd.setContainer(cont)
190 nodeEnd.setScript(script1)
191 i1=nodeEnd.edAddInputPort("i1",ti) ; i1.edInitInt(sqrtOfNumberOfTurn)
192 dbg=nodeEnd.edAddInputPort("dbg",ti) ; dbg.edInitInt(i)
193 o2=nodeEnd.edAddOutputPort("o2",td)
194 nodeEnd.setExecutionMode("remote")
199 self.assertEqual(p.edGetDirectDescendants()[0].getContainer().getProperty("InitializeScriptKey"),"aa=123.456")
201 ex=pilot.ExecutorSwig()
202 self.assertEqual(p.getState(),pilot.READY)
203 st=datetime.datetime.now()
205 print("Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st)))
206 self.assertEqual(p.getState(),pilot.DONE)
208 st=datetime.datetime.now()
210 print("Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st)))
211 self.assertEqual(p.getState(),pilot.DONE)
213 st=datetime.datetime.now()
215 print("Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st)))
216 self.assertEqual(p.getState(),pilot.DONE)
220 """ Test on HP Containers in foreach context."""
223 print("%%lf - %%s"%%(aa,str(my_container)))
226 script1="""from math import cos
228 ref=datetime.datetime.now()
229 o2=0. ; pas=1./float(i1)
233 o2+=1.+cos(1.*(x*3.14159))
235 print("coucou %lf from script -> %s"%(aa,str(datetime.datetime.now()-ref)))
239 script2="""o9=sum(i8)
241 fname=os.path.join(self.workdir, "TestSaveLoadRun2.xml")
243 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
244 l=loader.YACSLoader()
245 p=self.r.createProc("prTest1")
246 td=p.createType("double","double")
247 ti=p.createType("int","int")
248 tdi=p.createSequenceTc("seqint","seqint",ti)
249 tdd=p.createSequenceTc("seqdouble","seqdouble",td)
250 cont=p.createContainer("gg","HPSalome")
251 cont.setSizeOfPool(4)
252 cont.setProperty("InitializeScriptKey","aa=123.456")
253 cont.setProperty("name","localhost")
254 cont.setProperty("hostname","localhost")
256 node0=self.r.createFuncNode("Salome","PyFunction0") # PyFuncNode remote
259 node0.setContainer(cont)
260 node0.setScript(script0%(sqrtOfNumberOfTurn))
261 out0_0=node0.edAddOutputPort("o1",tdi)
262 out1_0=node0.edAddOutputPort("o2",ti)
263 node0.setExecutionMode("remote")
265 node1=self.r.createForEachLoop("node1",ti)
267 p.edAddCFLink(node0,node1)
268 p.edAddLink(out0_0,node1.edGetSeqOfSamplesPort())
269 node1.edGetNbOfBranchesPort().edInitInt(8)
271 node2=self.r.createScriptNode("Salome","PyScript3")
272 node1.edAddChild(node2)
273 node2.setContainer(cont)
274 node2.setScript(script1)
275 i1=node2.edAddInputPort("i1",ti)
276 p.edAddLink(node1.edGetSamplePort(),i1)
277 out0_2=node2.edAddOutputPort("o2",td)
278 out1_2=node2.edAddOutputPort("o3",ti)
279 node2.setExecutionMode("remote")
281 node3=self.r.createScriptNode("Salome","PyScript7")
283 node3.setScript(script2)
284 p.edAddCFLink(node1,node3)
285 i8=node3.edAddInputPort("i8",tdd)
286 o9=node3.edAddOutputPort("o9",td)
287 p.edAddLink(out0_2,i8)
291 o9=p.getChildByName("PyScript7").getOutputPort("o9")
292 self.assertTrue(len(p.edGetDirectDescendants()[1].getChildByName("PyScript3").getContainer().getProperty("InitializeScriptKey"))!=0)
294 refExpected=16016013.514623128
295 ex=pilot.ExecutorSwig()
296 self.assertEqual(p.getState(),pilot.READY)
297 st=datetime.datetime.now()
299 print("Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st)))
300 self.assertEqual(p.getState(),pilot.DONE)
301 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
303 st=datetime.datetime.now()
305 print("Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st)))
306 self.assertEqual(p.getState(),pilot.DONE)
307 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
309 st=datetime.datetime.now()
311 print("Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st)))
312 self.assertEqual(p.getState(),pilot.DONE)
313 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
317 """ Test that focuses on parallel load of containers."""
320 print("%%lf - %%s"%%(aa,str(my_container)))
323 script1="""from math import cos
325 ref=datetime.datetime.now()
326 o2=0. ; pas=1./float(i1)
330 o2+=1.+cos(1.*(x*3.14159))
332 print("coucou %lf from script -> %s"%(aa,str(datetime.datetime.now()-ref)))
336 script2="""o9=sum(i8)
338 fname=os.path.join(self.workdir, "TestSaveLoadRun3.xml")
340 sqrtOfNumberOfTurn=10
341 l=loader.YACSLoader()
342 p=self.r.createProc("prTest1")
343 td=p.createType("double","double")
344 ti=p.createType("int","int")
345 tdi=p.createSequenceTc("seqint","seqint",ti)
346 tdd=p.createSequenceTc("seqdouble","seqdouble",td)
347 cont=p.createContainer("gg","HPSalome")
348 cont.setSizeOfPool(8)
349 cont.setProperty("InitializeScriptKey","aa=123.456")
350 cont.setProperty("name","localhost")
351 cont.setProperty("hostname","localhost")
353 node0=self.r.createFuncNode("Salome","PyFunction0") # PyFuncNode remote
356 node0.setContainer(cont)
357 node0.setScript(script0%(sqrtOfNumberOfTurn))
358 out0_0=node0.edAddOutputPort("o1",tdi)
359 out1_0=node0.edAddOutputPort("o2",ti)
360 node0.setExecutionMode("remote")
362 node1=self.r.createForEachLoop("node1",ti)
364 p.edAddCFLink(node0,node1)
365 p.edAddLink(out0_0,node1.edGetSeqOfSamplesPort())
366 node1.edGetNbOfBranchesPort().edInitInt(16)
368 node2=self.r.createScriptNode("Salome","PyScript3")
369 node1.edAddChild(node2)
370 node2.setContainer(cont)
371 node2.setScript(script1)
372 i1=node2.edAddInputPort("i1",ti)
373 p.edAddLink(node1.edGetSamplePort(),i1)
374 out0_2=node2.edAddOutputPort("o2",td)
375 out1_2=node2.edAddOutputPort("o3",ti)
376 node2.setExecutionMode("remote")
378 node3=self.r.createScriptNode("Salome","PyScript7")
380 node3.setScript(script2)
381 p.edAddCFLink(node1,node3)
382 i8=node3.edAddInputPort("i8",tdd)
383 o9=node3.edAddOutputPort("o9",td)
384 p.edAddLink(out0_2,i8)
388 o9=p.getChildByName("PyScript7").getOutputPort("o9")
389 self.assertTrue(len(p.edGetDirectDescendants()[1].getChildByName("PyScript3").getContainer().getProperty("InitializeScriptKey"))!=0)
391 refExpected=11000.008377058712
392 ex=pilot.ExecutorSwig()
393 self.assertEqual(p.getState(),pilot.READY)
394 st=datetime.datetime.now()
396 print("Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st)))
397 self.assertEqual(p.getState(),pilot.DONE)
398 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
400 st=datetime.datetime.now()
402 print("Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st)))
403 self.assertEqual(p.getState(),pilot.DONE)
404 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
406 st=datetime.datetime.now()
408 print("Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st)))
409 self.assertEqual(p.getState(),pilot.DONE)
410 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
414 """Non regression test of multi pyScriptNode, pyFuncNode sharing the same HPContainer instance."""
415 fname=os.path.join(self.workdir, "TestSaveLoadRun4.xml")
421 for j in range(i+10):
428 l=loader.YACSLoader()
429 ex=pilot.ExecutorSwig()
430 p=self.r.createProc("pr")
431 cont=p.createContainer("gg","HPSalome")
432 cont.setSizeOfPool(10)
433 td=p.createType("int","int")
434 td2=p.createSequenceTc("seqint","seqint",td)
435 td3=p.createSequenceTc("seqintvec","seqintvec",td2)
436 node1=self.r.createScriptNode("","node1")
437 node1.setScript(script1)
438 o1=node1.edAddOutputPort("o1",td3)
441 node2=self.r.createForEachLoop("node2",td2)
443 p.edAddCFLink(node1,node2)
444 p.edAddLink(o1,node2.edGetSeqOfSamplesPort())
445 node2.edGetNbOfBranchesPort().edInitInt(2)
446 node20=self.r.createBloc("node20")
447 node2.edAddChild(node20)
448 node200=self.r.createForEachLoop("node200",td)
449 node20.edAddChild(node200)
450 node200.edGetNbOfBranchesPort().edInitInt(10)
451 p.edAddLink(node2.edGetSamplePort(),node200.edGetSeqOfSamplesPort())
452 node2000=self.r.createScriptNode("","node2000")
453 node2000.setContainer(cont)
454 node2000.setExecutionMode("remote")
455 node200.edAddChild(node2000)
456 i5=node2000.edAddInputPort("i5",td)
457 o6=node2000.edAddOutputPort("o6",td)
458 node2000.setScript("o6=2+i5")
459 p.edAddLink(node200.edGetSamplePort(),i5)
461 node3=self.r.createForEachLoop("node3",td2)
463 p.edAddCFLink(node2,node3)
464 p.edAddLink(o6,node3.edGetSeqOfSamplesPort())
465 node3.edGetNbOfBranchesPort().edInitInt(2)
466 node30=self.r.createBloc("node30")
467 node3.edAddChild(node30)
468 node300=self.r.createForEachLoop("node300",td)
469 node30.edAddChild(node300)
470 node300.edGetNbOfBranchesPort().edInitInt(10)
471 p.edAddLink(node3.edGetSamplePort(),node300.edGetSeqOfSamplesPort())
472 node3000=self.r.createScriptNode("","node3000")
473 node3000.setContainer(cont)
474 node3000.setExecutionMode("remote")
475 node300.edAddChild(node3000)
476 i14=node3000.edAddInputPort("i14",td)
477 o15=node3000.edAddOutputPort("o15",td)
478 node3000.setScript("o15=3+i14")
479 p.edAddLink(node300.edGetSamplePort(),i14)
481 node4=self.r.createScriptNode("","node4")
482 node4.setScript("o9=i8")
484 i8=node4.edAddInputPort("i8",td3)
485 o9=node4.edAddOutputPort("o9",td3)
486 p.edAddCFLink(node3,node4)
490 ex = pilot.ExecutorSwig()
491 self.assertEqual(p.getState(),pilot.READY)
493 self.assertEqual(p.getState(),pilot.DONE)
494 zeResu=p.getChildByName("node4").getOutputPort("o9").get()
495 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]])
499 """Non regression test 2 of multi pyNode, pyFuncNode sharing the same HPContainer instance."""
500 fname=os.path.join(self.workdir, "TestSaveLoadRun5.xml")
506 for j in range(i+10):
513 l=loader.YACSLoader()
514 ex=pilot.ExecutorSwig()
515 p=self.r.createProc("pr")
516 cont=p.createContainer("gg","HPSalome")
517 cont.setSizeOfPool(10)
518 td=p.createType("int","int")
519 td2=p.createSequenceTc("seqint","seqint",td)
520 td3=p.createSequenceTc("seqintvec","seqintvec",td2)
521 node1=self.r.createScriptNode("","node1")
522 node1.setScript(script1)
523 o1=node1.edAddOutputPort("o1",td3)
526 node2=self.r.createForEachLoop("node2",td2)
528 p.edAddCFLink(node1,node2)
529 p.edAddLink(o1,node2.edGetSeqOfSamplesPort())
530 node2.edGetNbOfBranchesPort().edInitInt(2)
531 node20=self.r.createBloc("node20")
532 node2.edAddChild(node20)
533 node200=self.r.createForEachLoop("node200",td)
534 node20.edAddChild(node200)
535 node200.edGetNbOfBranchesPort().edInitInt(10)
536 p.edAddLink(node2.edGetSamplePort(),node200.edGetSeqOfSamplesPort())
537 node2000=self.r.createFuncNode("Salome","node2000")
538 node2000.setFname("ff")
539 node2000.setContainer(cont)
540 node2000.setExecutionMode("remote")
541 node200.edAddChild(node2000)
542 i5=node2000.edAddInputPort("i5",td)
543 o6=node2000.edAddOutputPort("o6",td)
544 node2000.setScript("def ff(x):\n return 2+x")
545 p.edAddLink(node200.edGetSamplePort(),i5)
547 node3=self.r.createForEachLoop("node3",td2)
549 p.edAddCFLink(node2,node3)
550 p.edAddLink(o6,node3.edGetSeqOfSamplesPort())
551 node3.edGetNbOfBranchesPort().edInitInt(2)
552 node30=self.r.createBloc("node30")
553 node3.edAddChild(node30)
554 node300=self.r.createForEachLoop("node300",td)
555 node30.edAddChild(node300)
556 node300.edGetNbOfBranchesPort().edInitInt(10)
557 p.edAddLink(node3.edGetSamplePort(),node300.edGetSeqOfSamplesPort())
558 node3000=self.r.createFuncNode("Salome","node3000")
559 node3000.setFname("ff")
560 node3000.setContainer(cont)
561 node3000.setExecutionMode("remote")
562 node300.edAddChild(node3000)
563 i14=node3000.edAddInputPort("i14",td)
564 o15=node3000.edAddOutputPort("o15",td)
565 node3000.setScript("def ff(x):\n return 3+x")
566 p.edAddLink(node300.edGetSamplePort(),i14)
568 node4=self.r.createScriptNode("","node4")
569 node4.setScript("o9=i8")
571 i8=node4.edAddInputPort("i8",td3)
572 o9=node4.edAddOutputPort("o9",td3)
573 p.edAddCFLink(node3,node4)
577 ex = pilot.ExecutorSwig()
578 self.assertEqual(p.getState(),pilot.READY)
580 self.assertEqual(p.getState(),pilot.DONE)
581 zeResu=p.getChildByName("node4").getOutputPort("o9").get()
582 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]])
586 fname=os.path.join(self.workdir, "test6.xml")
587 p=self.r.createProc("prTest0")
588 td=p.createType("double","double")
589 ti=p.createType("int","int")
590 tsi=p.createSequenceTc("seqint","seqint",ti)
591 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
592 n0=self.r.createScriptNode("","n0")
593 o0=n0.edAddOutputPort("o0",tsi)
594 n0.setScript("o0=[3,6,8,9,-2,5]")
596 n1=self.r.createForEachLoop("n1",ti)
597 n10=self.r.createScriptNode("","n10")
599 n10.setScript("o2=2*i1")
600 i1=n10.edAddInputPort("i1",ti)
601 o2=n10.edAddOutputPort("o2",ti)
603 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
604 p.edAddLink(n1.edGetSamplePort(),i1)
606 n1.edGetNbOfBranchesPort().edInitPy(1)
607 n2=self.r.createScriptNode("","n2")
608 n2.setScript("o4=i3")
609 i3=n2.edAddInputPort("i3",tsi)
610 o4=n2.edAddOutputPort("o4",tsi)
611 n2.setScript("o4=i3")
617 l=loader.YACSLoader()
619 n1=p.getChildByName("n1")
620 ex=pilot.ExecutorSwig()
624 self.assertEqual(n1.getState(),pilot.DONE)
625 n1.edGetSeqOfSamplesPort().getPyObj()
626 a,b,c=n1.getPassedResults(ex)
627 self.assertEqual(a,list(range(6)))
628 self.assertEqual([elt.getPyObj() for elt in b],[[6, 12, 16, 18, -4, 10]])
629 self.assertEqual(c,['n10_o2_interceptor'])
633 fname=os.path.join(self.workdir, "test7.xml")
634 p=self.r.createProc("prTest1")
635 cont=p.createContainer("gg","Salome")
636 cont.setProperty("name","localhost")
637 cont.setProperty("hostname","localhost")
638 cont.setProperty("type","multi")
639 td=p.createType("double","double")
640 ti=p.createType("int","int")
641 tsi=p.createSequenceTc("seqint","seqint",ti)
642 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
643 n0=self.r.createScriptNode("","n0")
644 o0=n0.edAddOutputPort("o0",tsi)
645 n0.setScript("o0=[3,6,8,9,-2,5]")
647 n1=self.r.createForEachLoop("n1",ti)
648 n10=self.r.createScriptNode("","n10")
649 n10.setExecutionMode("remote")
650 n10.setContainer(cont)
656 raise Exception("Simulated error !")
660 i1=n10.edAddInputPort("i1",ti)
661 o2=n10.edAddOutputPort("o2",ti)
663 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
664 p.edAddLink(n1.edGetSamplePort(),i1)
666 n1.edGetNbOfBranchesPort().edInitPy(1)
667 n2=self.r.createScriptNode("","n2")
668 n2.setScript("o4=i3")
669 i3=n2.edAddInputPort("i3",tsi)
670 o4=n2.edAddOutputPort("o4",tsi)
671 n2.setScript("o4=i3")
677 l=loader.YACSLoader()
679 n1=p.getChildByName("n1")
680 ex=pilot.ExecutorSwig()
684 self.assertEqual(n1.getState(),pilot.FAILED)
685 n1.edGetSeqOfSamplesPort().getPyObj()
686 a,b,c=n1.getPassedResults(ex)
687 self.assertEqual(a,list(range(3)))
688 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16]])
689 self.assertEqual(c,['n10_o2_interceptor'])
693 from datetime import datetime
694 fname=os.path.join(self.workdir, "test8.xml")
695 p=self.r.createProc("prTest2")
696 cont=p.createContainer("gg","Salome")
697 cont.setProperty("name","localhost")
698 cont.setProperty("hostname","localhost")
699 cont.setProperty("type","multi")
700 td=p.createType("double","double")
701 ti=p.createType("int","int")
702 tsi=p.createSequenceTc("seqint","seqint",ti)
703 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
704 n0=self.r.createScriptNode("","n0")
705 o0=n0.edAddOutputPort("o0",tsi)
706 n0.setScript("o0=[3,6,8,9,-2,5]")
708 n1=self.r.createForEachLoop("n1",ti)
709 n10=self.r.createScriptNode("","n10")
710 n10.setExecutionMode("remote")
711 n10.setContainer(cont)
716 raise Exception("Simulated error !")
721 i1=n10.edAddInputPort("i1",ti)
722 o2=n10.edAddOutputPort("o2",ti)
724 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
725 p.edAddLink(n1.edGetSamplePort(),i1)
727 n1.edGetNbOfBranchesPort().edInitPy(2)
728 n2=self.r.createScriptNode("","n2")
729 n2.setScript("o4=i3")
730 i3=n2.edAddInputPort("i3",tsi)
731 o4=n2.edAddOutputPort("o4",tsi)
732 n2.setScript("o4=i3")
738 l=loader.YACSLoader()
740 n1=p.getChildByName("n1")
741 ex=pilot.ExecutorSwig()
742 ex.setKeepGoingProperty(True)
744 startt=datetime.now()
746 t0=datetime.now()-startt
748 self.assertEqual(n1.getState(),pilot.FAILED)
749 n1.edGetSeqOfSamplesPort().getPyObj()
750 a,b,c=n1.getPassedResults(ex)
751 self.assertEqual(a,[0,1,2,4,5])
752 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
753 self.assertEqual(c,['n10_o2_interceptor'])
755 p.getChildByName("n1").getChildByName("n10").setScript("""
759 raise Exception("Simulated error !")
763 ex=pilot.ExecutorSwig()
764 ex.setKeepGoingProperty(True)
766 startt=datetime.now()
768 t1=datetime.now()-startt
770 self.assertEqual(n1.getState(),pilot.FAILED)
771 n1.edGetSeqOfSamplesPort().getPyObj()
772 a,b,c=n1.getPassedResults(ex)
773 self.assertEqual(a,[1,2,3,4,5])
774 self.assertEqual([elt.getPyObj() for elt in b],[[12,16,18,-4,10]])
775 self.assertEqual(c,['n10_o2_interceptor'])
779 """ Test of assignation of already computed values for foreach node."""
780 fname=os.path.join(self.workdir, "test9.xml")
781 from datetime import datetime
782 p=self.r.createProc("prTest2")
783 cont=p.createContainer("gg","Salome")
784 cont.setProperty("name","localhost")
785 cont.setProperty("hostname","localhost")
786 cont.setProperty("type","multi")
787 td=p.createType("double","double")
788 ti=p.createType("int","int")
789 tsi=p.createSequenceTc("seqint","seqint",ti)
790 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
791 n0=self.r.createScriptNode("","n0")
792 o0=n0.edAddOutputPort("o0",tsi)
793 n0.setScript("o0=[3,6,8,9,-2,5]")
795 n1=self.r.createForEachLoop("n1",ti)
796 n10=self.r.createScriptNode("","n10")
797 n10.setExecutionMode("remote")
798 n10.setContainer(cont)
803 raise Exception("Simulated error !")
808 i1=n10.edAddInputPort("i1",ti)
809 o2=n10.edAddOutputPort("o2",ti)
811 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
812 p.edAddLink(n1.edGetSamplePort(),i1)
814 n1.edGetNbOfBranchesPort().edInitPy(2)
815 n2=self.r.createScriptNode("","n2")
816 n2.setScript("o4=i3")
817 i3=n2.edAddInputPort("i3",tsi)
818 o4=n2.edAddOutputPort("o4",tsi)
819 n2.setScript("o4=i3")
825 l=loader.YACSLoader()
827 n1=p.getChildByName("n1")
828 ex=pilot.ExecutorSwig()
829 ex.setKeepGoingProperty(True)
831 startt=datetime.now()
833 t0=datetime.now()-startt
835 self.assertEqual(p.getState(),pilot.FAILED)
836 self.assertEqual(n1.getState(),pilot.FAILED)
837 n1.edGetSeqOfSamplesPort().getPyObj()
838 a,b,c=n1.getPassedResults(ex)
839 self.assertEqual(a,[0,1,2,4,5])
840 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
841 self.assertEqual(c,['n10_o2_interceptor'])
843 p.getChildByName("n1").getChildByName("n10").setScript("""
848 ex=pilot.ExecutorSwig()
849 ex.setKeepGoingProperty(True)
850 p.getChildByName("n1").assignPassedResults(a,b,c)
852 startt=datetime.now()
854 t1=datetime.now()-startt
856 self.assertEqual(n1.getState(),pilot.DONE)
857 self.assertEqual(p.getState(),pilot.DONE)
858 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6,12,16,63,-4,10])
862 fname=os.path.join(self.workdir, "test10.xml")
863 from datetime import datetime
864 p=self.r.createProc("prTest2")
865 cont=p.createContainer("gg","Salome")
866 cont.setProperty("name","localhost")
867 cont.setProperty("hostname","localhost")
868 cont.setProperty("type","multi")
869 td=p.createType("double","double")
870 ti=p.createType("int","int")
871 tsi=p.createSequenceTc("seqint","seqint",ti)
872 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
873 n0=self.r.createScriptNode("","n0")
874 o0=n0.edAddOutputPort("o0",tsi)
875 n0.setScript("o0=[ 3*elt for elt in range(12) ]")
877 n1=self.r.createForEachLoop("n1",ti)
878 n10=self.r.createScriptNode("","n10")
879 n10.setExecutionMode("remote")
880 n10.setContainer(cont)
885 raise Exception("Simulated error !")
890 i1=n10.edAddInputPort("i1",ti)
891 o2=n10.edAddOutputPort("o2",ti)
893 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
894 p.edAddLink(n1.edGetSamplePort(),i1)
896 n1.edGetNbOfBranchesPort().edInitPy(2)
897 n2=self.r.createScriptNode("","n2")
898 n2.setScript("o4=i3")
899 i3=n2.edAddInputPort("i3",tsi)
900 o4=n2.edAddOutputPort("o4",tsi)
901 n2.setScript("o4=i3")
907 l=loader.YACSLoader()
909 n1=p.getChildByName("n1")
910 ex=pilot.ExecutorSwig()
911 ex.setKeepGoingProperty(True)
913 startt=datetime.now()
915 t0=datetime.now()-startt
917 self.assertEqual(p.getState(),pilot.FAILED)
918 self.assertEqual(n1.getState(),pilot.FAILED)
919 n1.edGetSeqOfSamplesPort().getPyObj()
920 a,b,c=n1.getPassedResults(ex)
921 self.assertEqual(a,[1,3,5,7,9,11])
922 self.assertEqual([elt.getPyObj() for elt in b],[[12,36,60,84,108,132]])
923 self.assertEqual(c,['n10_o2_interceptor'])
925 p.getChildByName("n1").getChildByName("n10").setScript("""
928 raise Exception("Simulated error !")
933 ex=pilot.ExecutorSwig()
934 ex.setKeepGoingProperty(True)
935 p.getChildByName("n1").assignPassedResults(a,b,c)
937 startt=datetime.now()
939 t1=datetime.now()-startt
940 #assert(t1.total_seconds()<6.+1.)# normally 6/2+1 s (6 remaining elts in 2 // branches + 1s to launch container)
942 self.assertEqual(n1.getState(),pilot.DONE)
943 self.assertEqual(p.getState(),pilot.DONE)
944 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,12,30,36,60,60,90,84,120,108,150,132])
951 "test if we do not restart from the begining of the schema after an error in a foreach"
952 fname=os.path.join(self.workdir, "test11.xml")
953 from datetime import datetime
954 p=self.r.createProc("prTest2")
955 cont=p.createContainer("gg","Salome")
956 cont.setProperty("name","localhost")
957 cont.setProperty("hostname","localhost")
958 cont.setProperty("type","multi")
959 td=p.createType("double","double")
960 ti=p.createType("int","int")
961 tsi=p.createSequenceTc("seqint","seqint",ti)
962 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
963 n0=self.r.createScriptNode("","n0")
964 o0=n0.edAddOutputPort("o0",tsi)
965 n0.setScript("o0=[ elt for elt in range(12) ]")
967 n1=self.r.createForEachLoop("n1",ti)
968 n10=self.r.createScriptNode("","n10")
969 n10.setExecutionMode("remote")
970 n10.setContainer(cont)
975 raise Exception("Simulated error !")
980 i1=n10.edAddInputPort("i1",ti)
981 o2=n10.edAddOutputPort("o2",ti)
983 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
984 p.edAddLink(n1.edGetSamplePort(),i1)
986 n1.edGetNbOfBranchesPort().edInitPy(2)
987 n2=self.r.createScriptNode("","n2")
988 n2.setScript("o4=i3")
989 i3=n2.edAddInputPort("i3",tsi)
990 o4=n2.edAddOutputPort("o4",tsi)
991 n2.setScript("o4=i3")
997 l=loader.YACSLoader()
999 n1=p.getChildByName("n1")
1000 ex=pilot.ExecutorSwig()
1001 ex.setKeepGoingProperty(True)
1003 startt=datetime.now()
1005 t0=datetime.now()-startt
1007 self.assertEqual(p.getState(),pilot.FAILED)
1008 self.assertEqual(n1.getState(),pilot.FAILED)
1009 n1.edGetSeqOfSamplesPort().getPyObj()
1010 a,b,c=n1.getPassedResults(ex)
1012 self.assertEqual(a,[0,2,4,6,8,10])
1013 self.assertEqual([elt.getPyObj() for elt in b],[[0,4,8,12,16,20]])
1015 p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(12) ]")
1016 p.getChildByName("n1").getChildByName("n10").setScript("""
1019 raise Exception("Simulated error !")
1027 p.getChildByName("n1").assignPassedResults(a,b,c)
1030 startt=datetime.now()
1032 t1=datetime.now()-startt
1034 self.assertEqual(n1.getState(),pilot.DONE)
1035 self.assertEqual(p.getState(),pilot.DONE)
1036 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,5,4,15,8,25,12,35,16,45,20,55])
1040 """ Test of nested ForEachLoop with a port connected inside and outside the loop."""
1041 schema = self.r.createProc("schema")
1042 ti = schema.getTypeCode("int")
1043 tiset = schema.createSequenceTc("", "seqint", ti)
1044 tisetseq = schema.createSequenceTc("", "seqintvec", tiset)
1046 n1 = self.r.createScriptNode("", "PyScript2")
1047 n1.edAddInputPort("i3", ti)
1048 n1.edAddInputPort("i4", ti)
1049 n1.edAddOutputPort("o5", ti)
1050 n1.setScript("o5=i3+i4")
1052 n2 = self.r.createScriptNode("", "PyScript1")
1053 n2.edAddInputPort("i2", ti)
1054 n2.edAddOutputPort("o3", ti)
1055 n2.setScript("o3=i2")
1057 b1 = self.r.createBloc("Bloc1")
1061 fe1 = self.r.createForEachLoop("ForEach1", ti)
1062 fe1.getInputPort("nbBranches").edInitPy(2)
1063 fe1.getInputPort("SmplsCollection").edInitPy([1, 2, 3, 4])
1066 n3 = self.r.createScriptNode("", "PostProcessing")
1067 n3.edAddInputPort("i7", tiset)
1068 n3.edAddInputPort("i5", tiset)
1069 n3.edAddOutputPort("o4", ti)
1079 b0 = self.r.createBloc("Bloc0")
1083 fe0 = self.r.createForEachLoop("ForEach1", ti)
1084 fe0.getInputPort("nbBranches").edInitPy(2)
1085 fe0.getInputPort("SmplsCollection").edInitPy([1, 2, 3, 4])
1088 schema.edAddChild(fe0)
1090 nx = self.r.createScriptNode("", "Result")
1091 nx.edAddInputPort("i8", tiset)
1092 nx.edAddOutputPort("o6", ti)
1098 schema.edAddChild(nx)
1100 schema.edAddLink(fe1.getOutputPort("evalSamples"), n1.getInputPort("i3"))
1101 schema.edAddLink(fe0.getOutputPort("evalSamples"), n1.getInputPort("i4"))
1103 schema.edAddDFLink(n1.getOutputPort("o5"), n3.getInputPort("i7"))
1104 schema.edAddDFLink(n2.getOutputPort("o3"), n3.getInputPort("i5"))
1106 po5 = fe1.getOutputPort("Bloc1.PyScript2.o5")
1107 schema.edAddDFLink(po5, n2.getInputPort("i2"))
1109 schema.edAddDFLink(n3.getOutputPort("o4"), nx.getInputPort("i8"))
1110 # schema.saveSchema("foreach12.xml")
1112 e = pilot.ExecutorSwig()
1114 self.assertEqual(schema.getState(),pilot.DONE)
1115 resVal = schema.getChildByName("Result").getOutputPort("o6").getPyObj()
1116 self.assertEqual(resVal, 160)
1120 """ Non regression test EDF11239. ForEach into ForEach. Problem on cloning linked to DeloymentTree.appendTask method that was too strong."""
1121 p=self.r.createProc("Bug11239")
1122 ti=p.createType("int","int")
1123 ti2=p.createSequenceTc("seqint","seqint",ti)
1125 cont=p.createContainer("DefaultContainer","Salome")
1127 node0=self.r.createForEachLoop("ForEachLoop_int0",ti)
1129 node0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
1130 node0.edGetNbOfBranchesPort().edInitInt(2)
1132 node00=self.r.createBloc("Bloc0")
1133 node0.edAddChild(node00)
1134 node000_0=self.r.createForEachLoop("ForEachLoop_int1",ti)
1135 node00.edAddChild(node000_0)
1136 node000_0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
1137 node000_0.edGetNbOfBranchesPort().edInitInt(3)
1139 node0000=self.r.createBloc("Bloc1")
1140 node000_0.edAddChild(node0000)
1142 node0000_0=self.r.createScriptNode("","PyScript2")
1143 node0000.edAddChild(node0000_0)
1144 i3=node0000_0.edAddInputPort("i3",ti)
1145 i4=node0000_0.edAddInputPort("i4",ti)
1146 o5=node0000_0.edAddOutputPort("o5",ti)
1147 node0000_0.setScript("o5 = i3 + i4")
1148 node0000_0.setContainer(cont)
1149 node0000_0.setExecutionMode("remote")
1150 p.edAddLink(node0.edGetSamplePort(),i3)
1151 p.edAddLink(node000_0.edGetSamplePort(),i4)
1153 node0000_1=self.r.createScriptNode("","PyScript1")
1154 node0000.edAddChild(node0000_1)
1155 o3=node0000_1.edAddOutputPort("o3",ti)
1156 node0000_1.setScript("o3 = 7")
1157 node0000_1.setExecutionMode("local")
1158 p.edAddCFLink(node0000_0,node0000_1)
1160 node000_1=self.r.createScriptNode("","PostTraitement")
1161 node00.edAddChild(node000_1)
1162 i7=node000_1.edAddInputPort("i7",ti2)
1163 i5=node000_1.edAddInputPort("i5",ti2)
1164 node000_1.setScript("for i in i7:\n print(i)\nprint(\"separation\")\nfor i in i5:\n print(i)")
1165 node000_1.setContainer(cont)
1166 node000_1.setExecutionMode("remote")
1169 p.edAddCFLink(node000_0,node000_1)
1171 #p.saveSchema("tmpp.xml")
1172 ex = pilot.ExecutorSwig()
1173 self.assertEqual(p.getState(),pilot.READY)
1175 self.assertEqual(p.getState(),pilot.DONE)
1179 """ 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 !"""
1180 xmlFileName=os.path.join(self.workdir, "test14.xml")
1181 SALOMERuntime.RuntimeSALOME_setRuntime()
1182 r=pilot.getRuntime()
1183 n0=r.createProc("test23/zeRun")
1184 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1185 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tp)
1186 n0bis=r.createBloc("test23/main") ; n0.edAddChild(n0bis)
1187 n00=r.createBloc("test23/run") ; n0bis.edAddChild(n00)
1189 n000=r.createForEachLoop("test23/FE",tp) ; n00.edAddChild(n000)
1190 n0000=r.createScriptNode("Salome","test23/run_internal") ; n000.edSetNode(n0000)
1191 i0=n0000.edAddInputPort("i0",tp)
1192 i1=n0000.edAddInputPort("i1",tp) ; i1.edInitPy(3)
1193 o0=n0000.edAddOutputPort("o0",tp)
1194 n0000.setScript("o0=i0+i1")
1196 n00.edAddLink(n000.edGetSamplePort(),i0)
1198 n000.edGetSeqOfSamplesPort().edInitPy(list(range(10)))
1199 n000.edGetNbOfBranchesPort().edInitInt(2)
1201 n01=r.createScriptNode("Salome","test23/check") ; n0bis.edAddChild(n01)
1202 n0bis.edAddCFLink(n00,n01)
1203 i2=n01.edAddInputPort("i2",tp2)
1204 o1=n01.edAddOutputPort("o1",tp2)
1205 n01.setScript("o1=i2")
1206 n0bis.edAddLink(o0,i2)
1208 n0.saveSchema(xmlFileName)
1210 l=loader.YACSLoader()
1211 p=l.load(xmlFileName) # very import do not use n0 but use p instead !
1212 ex=pilot.ExecutorSwig()
1214 self.assertEqual(p.getState(),pilot.READY)
1216 self.assertEqual(p.getState(),pilot.DONE)
1217 self.assertEqual(p.getChildByName("test23/main.test23/check").getOutputPort("o1").getPyObj(),[3,4,5,6,7,8,9,10,11,12])
1221 #fname=os.path.join(self.workdir, "BugInConcurrentLaunchDftCont.xml")
1222 p=self.r.createProc("pr")
1223 ti=p.createType("int","int")
1224 cont=p.createContainer("DefaultContainer","Salome")
1225 cont.setProperty("container_name","FactoryServer")
1226 b=self.r.createBloc("Bloc") ; p.edAddChild(b)
1231 node=self.r.createScriptNode("Salome","node%d"%i)
1232 node.setExecutionMode("remote")
1233 node.setContainer(cont)
1234 outs.append(node.edAddOutputPort("i",ti))
1235 node.setScript("i=%d"%i)
1238 node=self.r.createScriptNode("Salome","nodeEnd")
1239 node.setExecutionMode("remote")
1240 node.setContainer(cont)
1241 res=node.edAddOutputPort("res",ti)
1246 inp=node.edAddInputPort(elt,ti) ; l.append(elt)
1248 p.edAddLink(outs[i],inp)
1249 node.setScript("res="+"+".join(l))
1250 p.edAddCFLink(b,node)
1254 ex = pilot.ExecutorSwig()
1255 self.assertEqual(p.getState(),pilot.READY)
1257 self.assertEqual(res.getPyObj(),6)
1258 self.assertEqual(p.getState(),pilot.DONE)
1262 """ Test to check that a list[pyobj] outputport linked to pyobj inputport is OK."""
1263 SALOMERuntime.RuntimeSALOME_setRuntime()
1264 self.r=pilot.getRuntime()
1265 n0=self.r.createProc("test16/zeRun")
1266 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1267 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tp)
1269 n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
1270 o0=n00.edAddOutputPort("o0",tp2)
1271 n00.setScript("o0=[[i+1] for i in range(8)]")
1272 n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
1273 i1=n01.edAddInputPort("i1",tp)
1274 n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
1275 n0.edAddCFLink(n00,n01)
1278 ex=pilot.ExecutorSwig()
1279 self.assertEqual(n0.getState(),pilot.READY)
1281 self.assertEqual(n0.getState(),pilot.DONE)
1285 """ Same as test16 except that tp2 is not list of tp but a list of copy of tp"""
1286 SALOMERuntime.RuntimeSALOME_setRuntime()
1287 self.r=pilot.getRuntime()
1288 n0=self.r.createProc("test17/zeRun")
1289 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1290 tpp=n0.createInterfaceTc("python:obj:1.0","pyobj",[]) # diff is here
1291 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tpp)
1293 n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
1294 o0=n00.edAddOutputPort("o0",tp2)
1295 n00.setScript("o0=[[i+1] for i in range(8)]")
1296 n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
1297 i1=n01.edAddInputPort("i1",tp)
1298 n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
1299 n0.edAddCFLink(n00,n01)
1302 ex=pilot.ExecutorSwig()
1303 self.assertEqual(n0.getState(),pilot.READY)
1305 self.assertEqual(n0.getState(),pilot.DONE)
1309 p=self.r.createProc("prTest18")
1310 n00=self.r.createScriptNode("Salome","n00")
1311 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1312 n00.setExecutionMode("remote")
1313 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1314 cont=p.createContainer("gg","Salome")
1315 n00.setContainer(cont)
1316 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1317 cont.setProperty("nb_proc_per_nod","6")
1318 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1319 cont.setProperty("nb_proc_per_node","7") # <- here
1320 self.assertEqual(n00.getMaxLevelOfParallelism(),7) # <- here
1324 """This test checks the mechanism of YACS that allow PythonNodes to know their DynParaLoop context."""
1325 fname=os.path.join(self.workdir, "test19.xml")
1326 l=loader.YACSLoader()
1328 p=self.r.createProc("PROC")
1329 ti=p.createType("int","int")
1330 tdi=p.createSequenceTc("seqint","seqint",ti)
1332 fe0=self.r.createForEachLoop("FE0",ti) ; p.edAddChild(fe0)
1333 fe0.edGetNbOfBranchesPort().edInitInt(4)
1334 fe0_end=self.r.createScriptNode("Salome","fe0_end")
1335 fe0.edSetFinalizeNode(fe0_end)
1336 fe0_end.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0"])
1337 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<4)""")
1338 n0=self.r.createScriptNode("Salome","n0") ; p.edAddChild(n0)
1339 n0.setScript("o1=range(10)")
1340 a=n0.edAddOutputPort("o1",tdi)
1341 p.edAddLink(a,fe0.edGetSeqOfSamplesPort()) ; p.edAddCFLink(n0,fe0)
1343 b0=self.r.createBloc("b0") ; fe0.edAddChild(b0)
1344 n1=self.r.createScriptNode("Salome","n1") ; b0.edAddChild(n1)
1345 n1.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0"])
1346 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<4)
1348 b=n1.edAddOutputPort("o1",tdi)
1349 fe1=self.r.createForEachLoop("FE1",ti) ; b0.edAddChild(fe1)
1350 fe1.edGetNbOfBranchesPort().edInitInt(3)
1351 fe1_end=self.r.createScriptNode("Salome","fe1_end")
1352 fe1_end.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0.b0.FE1","FE0"])
1353 assert(my_dpl_localization[1][1]>=0 and my_dpl_localization[1][1]<4)
1354 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<3)
1356 fe1.edSetFinalizeNode(fe1_end)
1357 p.edAddLink(b,fe1.edGetSeqOfSamplesPort()) ; p.edAddCFLink(n1,fe1)
1359 n2=self.r.createScriptNode("Salome","n2") ; fe1.edAddChild(n2)
1360 n2.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0.b0.FE1","FE0"])
1361 assert(my_dpl_localization[1][1]>=0 and my_dpl_localization[1][1]<4)
1362 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<3)
1366 ex=pilot.ExecutorSwig()
1368 # local run of PythonNodes n1 and n2
1371 self.assertEqual(p.getState(),pilot.READY)
1372 ex.setDPLScopeSensitive(True) # <- this line is the aim of the test
1374 self.assertEqual(p.getState(),pilot.DONE)
1378 cont=p.createContainer("gg","HPSalome")
1379 cont.setSizeOfPool(2)
1380 n1=p.getChildByName("FE0.b0.n1") ; n1.setExecutionMode("remote") ; n1.setContainer(cont)
1381 n2=p.getChildByName("FE0.b0.FE1.n2") ; n2.setExecutionMode("remote") ; n2.setContainer(cont)
1384 self.assertEqual(p.getState(),pilot.READY)
1386 self.assertEqual(p.getState(),pilot.DONE)
1390 """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"""
1391 def assignCont(n,cont):
1392 n.setExecutionMode("remote") ; n.setContainer(cont)
1394 xmlFileName="test20.xml"
1395 p=self.r.createProc("test26")
1397 cont=p.createContainer("gg","HPSalome") # very important ! HP Container needed for the test !
1398 cont.setSizeOfPool(8) # important make this figure >= 6
1400 po=p.createInterfaceTc("python:obj:1.0","pyobj",[])
1401 sop=p.createSequenceTc("list[pyobj]","list[pyobj]",po)
1403 b0=self.r.createBloc("test26/main") ; p.edAddChild(b0)
1404 n0=self.r.createScriptNode("Salome","test26/n0") ; assignCont(n0,cont) # 1
1405 n0.setScript("""import os
1407 dd=n0.edAddOutputPort("dd",sop) ; b0.edAddChild(n0)
1408 fe0=self.r.createForEachLoop("test26/FE0",po) ; b0.edAddChild(fe0)
1409 fe0.edGetNbOfBranchesPort().edInitInt(1) # very important for the test : 1 !
1410 fe0i=self.r.createBloc("test26/FE0_internal") ; fe0.edSetNode(fe0i)
1411 zeArgInitNode2=self.r.createScriptNode("Salome","zeArgInitNode") ; assignCont(zeArgInitNode2,cont) # 2
1412 fe0i.edAddChild(zeArgInitNode2)
1413 c1=zeArgInitNode2.edAddInputPort("c",po)
1414 c2=zeArgInitNode2.edAddOutputPort("c",po)
1415 zeRun=self.r.createBloc("test26/zeRun") ; fe0i.edAddChild(zeRun)
1416 zeArgInitNode=self.r.createScriptNode("Salome","zeArgInitNode") ; assignCont(zeArgInitNode,cont) # 3
1417 zeRun.edAddChild(zeArgInitNode)
1418 ff1=zeArgInitNode.edAddInputPort("ff",po)
1419 ff2=zeArgInitNode.edAddOutputPort("ff",po)
1420 line01=self.r.createScriptNode("Salome","line01") ; zeRun.edAddChild(line01) ; assignCont(line01,cont) # 4
1421 line01.setScript("ee=3")
1422 ee0=line01.edAddOutputPort("ee",po)
1423 initt=self.r.createScriptNode("Salome","test26/initt") ; assignCont(initt,cont) # 5
1424 initt.setScript("pass") ; zeRun.edAddChild(initt)
1425 end=self.r.createScriptNode("Salome","test26/end") ; assignCont(end,cont) # 6
1426 end.setScript("import os") ; zeRun.edAddChild(end)
1427 retu=self.r.createScriptNode("Salome","return") ; assignCont(retu,cont) # 7
1428 retu.setScript("ee=i0") ; zeRun.edAddChild(retu)
1429 i0=retu.edAddInputPort("i0",po)
1430 ee=retu.edAddOutputPort("ee",po)
1431 zeRun.edAddCFLink(zeArgInitNode,line01)
1432 zeRun.edAddCFLink(line01,initt)
1433 zeRun.edAddCFLink(initt,end)
1434 zeRun.edAddCFLink(end,retu)
1437 returnn=self.r.createScriptNode("Salome","return") ; assignCont(returnn,cont) # 8
1438 returnn.setScript("elt=i0")
1439 i00=returnn.edAddInputPort("i0",po)
1440 elt=returnn.edAddOutputPort("elt",po)
1441 fe0i.edAddChild(returnn)
1442 fe0i.edAddCFLink(zeArgInitNode2,zeRun)
1443 fe0i.edAddCFLink(zeRun,returnn)
1447 finalize=self.r.createScriptNode("Salome","test26/finalize") ; b0.edAddChild(finalize) ; assignCont(finalize,cont) # 9
1448 finalize.setScript("pass")
1449 b0.edAddCFLink(n0,fe0)
1450 b0.edAddCFLink(fe0,finalize)
1452 p.edAddLink(dd,fe0.edGetSeqOfSamplesPort())
1453 p.edAddLink(fe0.edGetSamplePort(),c1)
1455 #p.saveSchema(xmlFileName)
1456 p.getChildByName("test26/main.test26/FE0").edGetNbOfBranchesPort().edInitInt(1) # very important 1 !
1458 ex=pilot.ExecutorSwig()
1459 self.assertEqual(p.getState(),pilot.READY)
1461 self.assertEqual(p.getState(),pilot.DONE)
1467 "test if we restart from a saved state in a foreach loop"
1468 fname=os.path.join(self.workdir, "test21.xml")
1469 xmlStateFileName=os.path.join(self.workdir, "saveState21.xml")
1470 from datetime import datetime
1471 p=self.r.createProc("prTest21")
1472 cont=p.createContainer("gg","Salome")
1473 cont.setProperty("name","localhost")
1474 cont.setProperty("hostname","localhost")
1475 cont.setProperty("type","multi")
1476 td=p.createType("double","double")
1477 ti=p.createType("int","int")
1478 tsi=p.createSequenceTc("seqint","seqint",ti)
1479 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
1480 n0=self.r.createScriptNode("","n0")
1481 o0=n0.edAddOutputPort("o0",tsi)
1482 n0.setScript("o0=[ elt for elt in range(6) ]")
1484 n1=self.r.createForEachLoop("n1",ti)
1485 n10=self.r.createScriptNode("","n10")
1486 n10.setExecutionMode("remote")
1487 n10.setContainer(cont)
1494 i1=n10.edAddInputPort("i1",ti)
1495 o2=n10.edAddOutputPort("o2",ti)
1497 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
1498 p.edAddLink(n1.edGetSamplePort(),i1)
1499 p.edAddCFLink(n0,n1)
1500 n1.edGetNbOfBranchesPort().edInitPy(2)
1501 n2=self.r.createScriptNode("","n2")
1502 n2.setScript("o4=i3")
1503 i3=n2.edAddInputPort("i3",tsi)
1504 o4=n2.edAddOutputPort("o4",tsi)
1505 n2.setScript("o4=i3")
1507 p.edAddCFLink(n1,n2)
1511 l=loader.YACSLoader()
1513 n1=p.getChildByName("n1")
1514 ex=pilot.ExecutorSwig()
1515 ex.setKeepGoingProperty(True)
1517 startt=datetime.now()
1519 myRun=threading.Thread(None, ex.RunW, None, (p,0))
1523 SALOMERuntime.schemaSaveState(p, ex, xmlStateFileName)
1524 a,b,c=n1.getPassedResults(ex)
1526 t0=datetime.now()-startt
1528 self.assertEqual(p.getState(),pilot.DONE)
1529 self.assertEqual(n1.getState(),pilot.DONE)
1530 self.assertEqual(a,[0,1])
1531 self.assertEqual([elt.getPyObj() for elt in b],[[0,2]])
1533 p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
1534 p.getChildByName("n1").getChildByName("n10").setScript("""
1539 loader.loadState(p, xmlStateFileName)
1541 p.getChildByName("n1").assignPassedResults(a,b,c)
1546 self.assertEqual(n1.getState(),pilot.DONE)
1547 self.assertEqual(p.getState(),pilot.DONE)
1548 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
1550 # Restart from a saved state in a foreach loop without using assignPassedResults.
1551 # This test uses the files test21.xml and saveState21.xml produced by test21.
1553 ex=pilot.ExecutorSwig()
1554 l=loader.YACSLoader()
1556 q.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
1557 q.getChildByName("n1").getChildByName("n10").setScript("""
1560 print("execution n10:", i1)
1563 q.getChildByName("n2").setScript("""
1564 print("execution n2:", i3)
1567 loader.loadState(q, xmlStateFileName)
1573 self.assertEqual(q.getChildByName("n1").getState(),pilot.DONE)
1574 self.assertEqual(q.getState(),pilot.DONE)
1575 self.assertEqual(q.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
1579 """ test focused on weight attribut after a dump and reload from a xml file
1581 fname=os.path.join(self.workdir, "test23.xml")
1582 p=self.r.createProc("prTest23")
1583 cont=p.createContainer("gg","Salome")
1584 cont.setProperty("name","localhost")
1585 cont.setProperty("hostname","localhost")
1586 cont.setProperty("type","multi")
1587 td=p.createType("double","double")
1588 ti=p.createType("int","int")
1589 tsi=p.createSequenceTc("seqint","seqint",ti)
1590 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
1591 n0=self.r.createScriptNode("","n0")
1592 o0=n0.edAddOutputPort("o0",tsi)
1593 n0.setScript("o0=[ elt for elt in range(6) ]")
1595 n1=self.r.createForEachLoop("n1",ti)
1597 n10=self.r.createScriptNode("","n10")
1598 n10.setExecutionMode("remote")
1599 n10.setContainer(cont)
1607 i1=n10.edAddInputPort("i1",ti)
1608 o2=n10.edAddOutputPort("o2",ti)
1610 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
1611 p.edAddLink(n1.edGetSamplePort(),i1)
1612 p.edAddCFLink(n0,n1)
1613 n1.edGetNbOfBranchesPort().edInitPy(2)
1614 n2=self.r.createScriptNode("","n2")
1615 n2.setScript("o4=i3")
1616 i3=n2.edAddInputPort("i3",tsi)
1617 o4=n2.edAddOutputPort("o4",tsi)
1618 n2.setScript("o4=i3")
1620 p.edAddCFLink(n1,n2)
1624 l=loader.YACSLoader()
1626 self.assertEqual(p.getChildByName("n1").getWeight().getSimpleLoopWeight(),3.0)
1627 self.assertEqual(p.getChildByName("n1").getChildByName("n10").getWeight().getElementaryWeight(),4.0)
1631 """ Non regression test EDF17470"""
1632 SALOMERuntime.RuntimeSALOME.setRuntime()
1633 r=SALOMERuntime.getSALOMERuntime()
1634 p=r.createProc("prTest2")
1636 cont1=p.createContainer("cont1","Salome")
1637 cont1.setProperty("name","localhost")
1638 cont1.setProperty("hostname","localhost")
1639 cont1.setProperty("type","multi")
1640 cont1.setProperty("container_name","container1@")
1642 cont2=p.createContainer("cont2","Salome")
1643 cont2.setProperty("name","localhost")
1644 cont2.setProperty("hostname","localhost")
1645 cont2.setProperty("type","multi")
1646 cont2.setProperty("container_name","container2@")
1648 td=p.createType("double","double")
1649 ti=p.createType("int","int")
1650 ts=p.createType("string","string")
1651 n0=r.createScriptNode("","n0")
1652 n0.setScript("""import SalomeSDSClt
1661 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1663 return pickle.loads(strr)
1666 salome.salome_init()
1669 dsm=salome.naming_service.Resolve("/DataServerManager")
1670 dsm.cleanScopesInNS()
1671 if scopeName in dsm.listScopes():
1672 dsm.removeDataScope(scopeName)
1673 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1675 t0=dss.createRdExtVarTransac(varName,obj2Str({"ab":[4,5,6]}))
1676 dss.atomicApply([t0])
1678 n0_sn=n0.edAddOutputPort("scopeName",ts)
1679 n0_vn=n0.edAddOutputPort("varName",ts)
1681 n1=r.createScriptNode("","n1")
1682 n1_sn=n1.edAddInputPort("scopeName",ts)
1683 n1_vn=n1.edAddInputPort("varName",ts)
1684 n1.setScript("""import SalomeSDSClt
1694 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1696 return pickle.loads(strr)
1698 salome.salome_init()
1699 dsm=salome.naming_service.Resolve("/DataServerManager")
1700 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1701 assert(not isCreated)
1703 t1=dss.addMultiKeyValueSession(varName)
1705 wk2=dss.waitForKeyInVar(varName,obj2Str("ef"))
1707 assert(str2Obj(dss.waitForMonoThrRev(wk2))==[11,12])""")
1708 n1.setContainer(cont1)
1710 n2=r.createScriptNode("","n2")
1711 n2_sn=n2.edAddInputPort("scopeName",ts)
1712 n2_vn=n2.edAddInputPort("varName",ts)
1713 n2.setScript("""import SalomeSDSClt
1723 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1725 return pickle.loads(strr)
1727 salome.salome_init()
1728 dsm=salome.naming_service.Resolve("/DataServerManager")
1729 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1730 assert(not isCreated)
1732 t1=dss.addMultiKeyValueSession(varName)
1733 t1.addKeyValueInVarErrorIfAlreadyExistingNow(obj2Str("cd"),obj2Str([7,8,9,10]))
1734 t1.addKeyValueInVarErrorIfAlreadyExistingNow(obj2Str("ef"),obj2Str([11,12]))
1736 n2.setContainer(cont2)
1741 p.edAddCFLink(n0,n1)
1742 p.edAddCFLink(n0,n2)
1743 p.edAddLink(n0_sn,n1_sn)
1744 p.edAddLink(n0_vn,n1_vn)
1745 p.edAddLink(n0_sn,n2_sn)
1746 p.edAddLink(n0_vn,n2_vn)
1748 ex=pilot.ExecutorSwig()
1750 self.assertEqual(p.getState(),pilot.DONE)
1754 fname=os.path.join(self.workdir, "test25.xml")
1755 p=self.r.createProc("p0")
1756 tp=p.createInterfaceTc("python:obj:1.0","pyobj",[])
1757 n1_0_sc=self.r.createScriptNode("Salome","n1_0_sc")
1758 p.edAddChild(n1_0_sc)
1759 n1_0_sc.setExecutionMode("remote")
1760 n1_0_sc.setScript("""""")
1761 i1_0_sc=n1_0_sc.edAddInputPort("i1",tp)
1762 i1_0_sc.edInitPy(list(range(4)))
1764 cont=p.createContainer("gg","Salome")
1765 cont.setProperty("name","localhost")
1766 cont.setProperty("hostname","localhost")
1767 n1_0_sc.setContainer(cont)
1770 l=loader.YACSLoader()
1772 ex=pilot.ExecutorSwig()
1773 self.assertEqual(p.getState(),pilot.READY)
1775 self.assertEqual(p.getState(),pilot.DONE)
1780 This test is here to check that old (<=930) graphs are always loadable.
1781 So an xml file coming from test14 in 930 has been generated and converted into home made "base64" like format.
1782 This test puts unbased64 byte array into test_930.xml and load it to check that everything is OK.
1785 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'
1787 fname=os.path.join(self.workdir, "test_930.xml")
1788 with open(fname,"wb") as f:
1789 f.write( pilot.FromBase64Swig(content_of_file) )
1791 SALOMERuntime.RuntimeSALOME_setRuntime()
1792 l=loader.YACSLoader()
1794 self.assertTrue(p.getChildByName("test23/main").getChildByName("test23/run").getChildByName("test23/FE").getChildByName("test23/run_internal").getInputPort("i1").getPyObj() == 3)
1795 self.assertTrue(p.getChildByName("test23/main").getChildByName("test23/run").getChildByName("test23/FE").edGetSeqOfSamplesPort().getPyObj()==list(range(10)))
1799 if __name__ == '__main__':
1801 U = os.getenv('USER')
1802 with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
1803 f.write(" --- TEST src/yacsloader: testSaveLoadRun.py\n")
1804 suite = unittest.makeSuite(TestSaveLoadRun)
1805 result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
1806 sys.exit(not result.wasSuccessful())