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
27 class TestSaveLoadRun(unittest.TestCase):
29 SALOMERuntime.RuntimeSALOME.setRuntime()
30 self.r=SALOMERuntime.getSALOMERuntime()
34 """First test of HP Container no loop here only the 3 sorts of python nodes (the Distributed is it still used and useful ?) """
35 fname="TestSaveLoadRun0.xml"
37 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
39 p=self.r.createProc("prTest0")
40 td=p.createType("double","double")
41 ti=p.createType("int","int")
42 cont=p.createContainer("gg","HPSalome")
44 cont.setProperty("name","localhost")
45 cont.setProperty("hostname","localhost")
51 ref=datetime.datetime.now()
52 t=0. ; pas=1./float(nb)
56 t+=1.+cos(1.*(x*3.14159))
59 print("coucou from script0-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
65 ref=datetime.datetime.now()
66 o2=0. ; pas=1./float(i1)
70 o2+=1.+cos(1.*(x*3.14159))
72 print("coucou from script1-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
74 for i in range(nbOfNodes):
75 node0=self.r.createFuncNode("DistPython","node%i"%(i))
78 node0.setContainer(cont)
79 node0.setScript(script0)
80 nb=node0.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
81 dbg=node0.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
82 out0=node0.edAddOutputPort("s",td)
84 nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i))
85 p.edAddChild(nodeMiddle)
86 p.edAddCFLink(node0,nodeMiddle)
87 nodeMiddle.setFname("ff")
88 nodeMiddle.setContainer(cont)
89 nodeMiddle.setScript(script0)
90 nb=nodeMiddle.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
91 dbg=nodeMiddle.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
92 out0=nodeMiddle.edAddOutputPort("s",td)
93 nodeMiddle.setExecutionMode("remote")
95 nodeEnd=self.r.createScriptNode("Salome","node%i_2"%(i+1))
97 p.edAddCFLink(nodeMiddle,nodeEnd)
98 nodeEnd.setContainer(cont)
99 nodeEnd.setScript(script1)
100 i1=nodeEnd.edAddInputPort("i1",ti) ; i1.edInitInt(sqrtOfNumberOfTurn)
101 dbg=nodeEnd.edAddInputPort("dbg",ti) ; dbg.edInitInt(i)
102 o2=nodeEnd.edAddOutputPort("o2",td)
103 nodeEnd.setExecutionMode("remote")
107 ex=pilot.ExecutorSwig()
108 self.assertEqual(p.getState(),pilot.READY)
109 st=datetime.datetime.now()
112 print("Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st)))
113 self.assertEqual(p.getState(),pilot.DONE)
114 # 2nd exec using the same already launched remote python interpreters
115 st=datetime.datetime.now()
117 print("Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st)))
118 self.assertEqual(p.getState(),pilot.DONE)
119 # 3rd exec using the same already launched remote python interpreters
120 st=datetime.datetime.now()
122 print("Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st)))
123 self.assertEqual(p.getState(),pilot.DONE)
127 """ HP Container again like test0 but the initialization key of HPContainer is used here."""
128 fname="TestSaveLoadRun1.xml"
130 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
131 l=loader.YACSLoader()
132 p=self.r.createProc("prTest1")
133 td=p.createType("double","double")
134 ti=p.createType("int","int")
135 cont=p.createContainer("gg","HPSalome")
136 cont.setSizeOfPool(4)
137 cont.setProperty("InitializeScriptKey","aa=123.456")
138 cont.setProperty("name","localhost")
139 cont.setProperty("hostname","localhost")
145 ref=datetime.datetime.now()
146 t=0. ; pas=1./float(nb)
150 t+=1.+cos(1.*(x*3.14159))
153 print("coucou from script0-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
156 # here in script1 aa is refered ! aa will exist thanks to HPCont Init Script
160 ref=datetime.datetime.now()
161 o2=0. ; pas=1./float(i1)
165 o2+=1.+cos(1.*(x*3.14159))
167 print("coucou %lf from script1-%i -> %s"%(aa,dbg,str(datetime.datetime.now()-ref)))
171 for i in range(nbOfNodes):
172 nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i)) # PyFuncNode remote
173 p.edAddChild(nodeMiddle)
174 nodeMiddle.setFname("ff")
175 nodeMiddle.setContainer(cont)
176 nodeMiddle.setScript(script0)
177 nb=nodeMiddle.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
178 dbg=nodeMiddle.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
179 out0=nodeMiddle.edAddOutputPort("s",td)
180 nodeMiddle.setExecutionMode("remote")
182 nodeEnd=self.r.createScriptNode("Salome","node%i_2"%(i+1)) # PythonNode remote
183 p.edAddChild(nodeEnd)
184 p.edAddCFLink(nodeMiddle,nodeEnd)
185 nodeEnd.setContainer(cont)
186 nodeEnd.setScript(script1)
187 i1=nodeEnd.edAddInputPort("i1",ti) ; i1.edInitInt(sqrtOfNumberOfTurn)
188 dbg=nodeEnd.edAddInputPort("dbg",ti) ; dbg.edInitInt(i)
189 o2=nodeEnd.edAddOutputPort("o2",td)
190 nodeEnd.setExecutionMode("remote")
195 self.assertEqual(p.edGetDirectDescendants()[0].getContainer().getProperty("InitializeScriptKey"),"aa=123.456")
197 ex=pilot.ExecutorSwig()
198 self.assertEqual(p.getState(),pilot.READY)
199 st=datetime.datetime.now()
201 print("Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st)))
202 self.assertEqual(p.getState(),pilot.DONE)
204 st=datetime.datetime.now()
206 print("Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st)))
207 self.assertEqual(p.getState(),pilot.DONE)
209 st=datetime.datetime.now()
211 print("Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st)))
212 self.assertEqual(p.getState(),pilot.DONE)
216 """ Test on HP Containers in foreach context."""
219 print("%%lf - %%s"%%(aa,str(my_container)))
222 script1="""from math import cos
224 ref=datetime.datetime.now()
225 o2=0. ; pas=1./float(i1)
229 o2+=1.+cos(1.*(x*3.14159))
231 print("coucou %lf from script -> %s"%(aa,str(datetime.datetime.now()-ref)))
235 script2="""o9=sum(i8)
237 fname="TestSaveLoadRun2.xml"
239 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
240 l=loader.YACSLoader()
241 p=self.r.createProc("prTest1")
242 td=p.createType("double","double")
243 ti=p.createType("int","int")
244 tdi=p.createSequenceTc("seqint","seqint",ti)
245 tdd=p.createSequenceTc("seqdouble","seqdouble",td)
246 cont=p.createContainer("gg","HPSalome")
247 cont.setSizeOfPool(4)
248 cont.setProperty("InitializeScriptKey","aa=123.456")
249 cont.setProperty("name","localhost")
250 cont.setProperty("hostname","localhost")
252 node0=self.r.createFuncNode("Salome","PyFunction0") # PyFuncNode remote
255 node0.setContainer(cont)
256 node0.setScript(script0%(sqrtOfNumberOfTurn))
257 out0_0=node0.edAddOutputPort("o1",tdi)
258 out1_0=node0.edAddOutputPort("o2",ti)
259 node0.setExecutionMode("remote")
261 node1=self.r.createForEachLoop("node1",ti)
263 p.edAddCFLink(node0,node1)
264 p.edAddLink(out0_0,node1.edGetSeqOfSamplesPort())
265 node1.edGetNbOfBranchesPort().edInitInt(8)
267 node2=self.r.createScriptNode("Salome","PyScript3")
268 node1.edAddChild(node2)
269 node2.setContainer(cont)
270 node2.setScript(script1)
271 i1=node2.edAddInputPort("i1",ti)
272 p.edAddLink(node1.edGetSamplePort(),i1)
273 out0_2=node2.edAddOutputPort("o2",td)
274 out1_2=node2.edAddOutputPort("o3",ti)
275 node2.setExecutionMode("remote")
277 node3=self.r.createScriptNode("Salome","PyScript7")
279 node3.setScript(script2)
280 p.edAddCFLink(node1,node3)
281 i8=node3.edAddInputPort("i8",tdd)
282 o9=node3.edAddOutputPort("o9",td)
283 p.edAddLink(out0_2,i8)
287 o9=p.getChildByName("PyScript7").getOutputPort("o9")
288 self.assertTrue(len(p.edGetDirectDescendants()[1].getChildByName("PyScript3").getContainer().getProperty("InitializeScriptKey"))!=0)
290 refExpected=16016013.514623128
291 ex=pilot.ExecutorSwig()
292 self.assertEqual(p.getState(),pilot.READY)
293 st=datetime.datetime.now()
295 print("Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st)))
296 self.assertEqual(p.getState(),pilot.DONE)
297 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
299 st=datetime.datetime.now()
301 print("Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st)))
302 self.assertEqual(p.getState(),pilot.DONE)
303 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
305 st=datetime.datetime.now()
307 print("Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st)))
308 self.assertEqual(p.getState(),pilot.DONE)
309 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
313 """ Test that focuses on parallel load of containers."""
316 print("%%lf - %%s"%%(aa,str(my_container)))
319 script1="""from math import cos
321 ref=datetime.datetime.now()
322 o2=0. ; pas=1./float(i1)
326 o2+=1.+cos(1.*(x*3.14159))
328 print("coucou %lf from script -> %s"%(aa,str(datetime.datetime.now()-ref)))
332 script2="""o9=sum(i8)
334 fname="TestSaveLoadRun3.xml"
336 sqrtOfNumberOfTurn=10
337 l=loader.YACSLoader()
338 p=self.r.createProc("prTest1")
339 td=p.createType("double","double")
340 ti=p.createType("int","int")
341 tdi=p.createSequenceTc("seqint","seqint",ti)
342 tdd=p.createSequenceTc("seqdouble","seqdouble",td)
343 cont=p.createContainer("gg","HPSalome")
344 cont.setSizeOfPool(8)
345 cont.setProperty("InitializeScriptKey","aa=123.456")
346 cont.setProperty("name","localhost")
347 cont.setProperty("hostname","localhost")
349 node0=self.r.createFuncNode("Salome","PyFunction0") # PyFuncNode remote
352 node0.setContainer(cont)
353 node0.setScript(script0%(sqrtOfNumberOfTurn))
354 out0_0=node0.edAddOutputPort("o1",tdi)
355 out1_0=node0.edAddOutputPort("o2",ti)
356 node0.setExecutionMode("remote")
358 node1=self.r.createForEachLoop("node1",ti)
360 p.edAddCFLink(node0,node1)
361 p.edAddLink(out0_0,node1.edGetSeqOfSamplesPort())
362 node1.edGetNbOfBranchesPort().edInitInt(16)
364 node2=self.r.createScriptNode("Salome","PyScript3")
365 node1.edAddChild(node2)
366 node2.setContainer(cont)
367 node2.setScript(script1)
368 i1=node2.edAddInputPort("i1",ti)
369 p.edAddLink(node1.edGetSamplePort(),i1)
370 out0_2=node2.edAddOutputPort("o2",td)
371 out1_2=node2.edAddOutputPort("o3",ti)
372 node2.setExecutionMode("remote")
374 node3=self.r.createScriptNode("Salome","PyScript7")
376 node3.setScript(script2)
377 p.edAddCFLink(node1,node3)
378 i8=node3.edAddInputPort("i8",tdd)
379 o9=node3.edAddOutputPort("o9",td)
380 p.edAddLink(out0_2,i8)
384 o9=p.getChildByName("PyScript7").getOutputPort("o9")
385 self.assertTrue(len(p.edGetDirectDescendants()[1].getChildByName("PyScript3").getContainer().getProperty("InitializeScriptKey"))!=0)
387 refExpected=11000.008377058712
388 ex=pilot.ExecutorSwig()
389 self.assertEqual(p.getState(),pilot.READY)
390 st=datetime.datetime.now()
392 print("Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st)))
393 self.assertEqual(p.getState(),pilot.DONE)
394 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
396 st=datetime.datetime.now()
398 print("Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st)))
399 self.assertEqual(p.getState(),pilot.DONE)
400 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
402 st=datetime.datetime.now()
404 print("Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st)))
405 self.assertEqual(p.getState(),pilot.DONE)
406 self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
410 """Non regression test of multi pyScriptNode, pyFuncNode sharing the same HPContainer instance."""
411 fname="TestSaveLoadRun4.xml"
417 for j in range(i+10):
424 l=loader.YACSLoader()
425 ex=pilot.ExecutorSwig()
426 p=self.r.createProc("pr")
427 cont=p.createContainer("gg","HPSalome")
428 cont.setSizeOfPool(10)
429 td=p.createType("int","int")
430 td2=p.createSequenceTc("seqint","seqint",td)
431 td3=p.createSequenceTc("seqintvec","seqintvec",td2)
432 node1=self.r.createScriptNode("","node1")
433 node1.setScript(script1)
434 o1=node1.edAddOutputPort("o1",td3)
437 node2=self.r.createForEachLoop("node2",td2)
439 p.edAddCFLink(node1,node2)
440 p.edAddLink(o1,node2.edGetSeqOfSamplesPort())
441 node2.edGetNbOfBranchesPort().edInitInt(2)
442 node20=self.r.createBloc("node20")
443 node2.edAddChild(node20)
444 node200=self.r.createForEachLoop("node200",td)
445 node20.edAddChild(node200)
446 node200.edGetNbOfBranchesPort().edInitInt(10)
447 p.edAddLink(node2.edGetSamplePort(),node200.edGetSeqOfSamplesPort())
448 node2000=self.r.createScriptNode("","node2000")
449 node2000.setContainer(cont)
450 node2000.setExecutionMode("remote")
451 node200.edAddChild(node2000)
452 i5=node2000.edAddInputPort("i5",td)
453 o6=node2000.edAddOutputPort("o6",td)
454 node2000.setScript("o6=2+i5")
455 p.edAddLink(node200.edGetSamplePort(),i5)
457 node3=self.r.createForEachLoop("node3",td2)
459 p.edAddCFLink(node2,node3)
460 p.edAddLink(o6,node3.edGetSeqOfSamplesPort())
461 node3.edGetNbOfBranchesPort().edInitInt(2)
462 node30=self.r.createBloc("node30")
463 node3.edAddChild(node30)
464 node300=self.r.createForEachLoop("node300",td)
465 node30.edAddChild(node300)
466 node300.edGetNbOfBranchesPort().edInitInt(10)
467 p.edAddLink(node3.edGetSamplePort(),node300.edGetSeqOfSamplesPort())
468 node3000=self.r.createScriptNode("","node3000")
469 node3000.setContainer(cont)
470 node3000.setExecutionMode("remote")
471 node300.edAddChild(node3000)
472 i14=node3000.edAddInputPort("i14",td)
473 o15=node3000.edAddOutputPort("o15",td)
474 node3000.setScript("o15=3+i14")
475 p.edAddLink(node300.edGetSamplePort(),i14)
477 node4=self.r.createScriptNode("","node4")
478 node4.setScript("o9=i8")
480 i8=node4.edAddInputPort("i8",td3)
481 o9=node4.edAddOutputPort("o9",td3)
482 p.edAddCFLink(node3,node4)
486 ex = pilot.ExecutorSwig()
487 self.assertEqual(p.getState(),pilot.READY)
489 self.assertEqual(p.getState(),pilot.DONE)
490 zeResu=p.getChildByName("node4").getOutputPort("o9").get()
491 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]])
495 """Non regression test 2 of multi pyNode, pyFuncNode sharing the same HPContainer instance."""
496 fname="TestSaveLoadRun5.xml"
502 for j in range(i+10):
509 l=loader.YACSLoader()
510 ex=pilot.ExecutorSwig()
511 p=self.r.createProc("pr")
512 cont=p.createContainer("gg","HPSalome")
513 cont.setSizeOfPool(10)
514 td=p.createType("int","int")
515 td2=p.createSequenceTc("seqint","seqint",td)
516 td3=p.createSequenceTc("seqintvec","seqintvec",td2)
517 node1=self.r.createScriptNode("","node1")
518 node1.setScript(script1)
519 o1=node1.edAddOutputPort("o1",td3)
522 node2=self.r.createForEachLoop("node2",td2)
524 p.edAddCFLink(node1,node2)
525 p.edAddLink(o1,node2.edGetSeqOfSamplesPort())
526 node2.edGetNbOfBranchesPort().edInitInt(2)
527 node20=self.r.createBloc("node20")
528 node2.edAddChild(node20)
529 node200=self.r.createForEachLoop("node200",td)
530 node20.edAddChild(node200)
531 node200.edGetNbOfBranchesPort().edInitInt(10)
532 p.edAddLink(node2.edGetSamplePort(),node200.edGetSeqOfSamplesPort())
533 node2000=self.r.createFuncNode("Salome","node2000")
534 node2000.setFname("ff")
535 node2000.setContainer(cont)
536 node2000.setExecutionMode("remote")
537 node200.edAddChild(node2000)
538 i5=node2000.edAddInputPort("i5",td)
539 o6=node2000.edAddOutputPort("o6",td)
540 node2000.setScript("def ff(x):\n return 2+x")
541 p.edAddLink(node200.edGetSamplePort(),i5)
543 node3=self.r.createForEachLoop("node3",td2)
545 p.edAddCFLink(node2,node3)
546 p.edAddLink(o6,node3.edGetSeqOfSamplesPort())
547 node3.edGetNbOfBranchesPort().edInitInt(2)
548 node30=self.r.createBloc("node30")
549 node3.edAddChild(node30)
550 node300=self.r.createForEachLoop("node300",td)
551 node30.edAddChild(node300)
552 node300.edGetNbOfBranchesPort().edInitInt(10)
553 p.edAddLink(node3.edGetSamplePort(),node300.edGetSeqOfSamplesPort())
554 node3000=self.r.createFuncNode("Salome","node3000")
555 node3000.setFname("ff")
556 node3000.setContainer(cont)
557 node3000.setExecutionMode("remote")
558 node300.edAddChild(node3000)
559 i14=node3000.edAddInputPort("i14",td)
560 o15=node3000.edAddOutputPort("o15",td)
561 node3000.setScript("def ff(x):\n return 3+x")
562 p.edAddLink(node300.edGetSamplePort(),i14)
564 node4=self.r.createScriptNode("","node4")
565 node4.setScript("o9=i8")
567 i8=node4.edAddInputPort("i8",td3)
568 o9=node4.edAddOutputPort("o9",td3)
569 p.edAddCFLink(node3,node4)
573 ex = pilot.ExecutorSwig()
574 self.assertEqual(p.getState(),pilot.READY)
576 self.assertEqual(p.getState(),pilot.DONE)
577 zeResu=p.getChildByName("node4").getOutputPort("o9").get()
578 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]])
583 p=self.r.createProc("prTest0")
584 td=p.createType("double","double")
585 ti=p.createType("int","int")
586 tsi=p.createSequenceTc("seqint","seqint",ti)
587 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
588 n0=self.r.createScriptNode("","n0")
589 o0=n0.edAddOutputPort("o0",tsi)
590 n0.setScript("o0=[3,6,8,9,-2,5]")
592 n1=self.r.createForEachLoop("n1",ti)
593 n10=self.r.createScriptNode("","n10")
595 n10.setScript("o2=2*i1")
596 i1=n10.edAddInputPort("i1",ti)
597 o2=n10.edAddOutputPort("o2",ti)
599 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
600 p.edAddLink(n1.edGetSamplePort(),i1)
602 n1.edGetNbOfBranchesPort().edInitPy(1)
603 n2=self.r.createScriptNode("","n2")
604 n2.setScript("o4=i3")
605 i3=n2.edAddInputPort("i3",tsi)
606 o4=n2.edAddOutputPort("o4",tsi)
607 n2.setScript("o4=i3")
613 l=loader.YACSLoader()
615 n1=p.getChildByName("n1")
616 ex=pilot.ExecutorSwig()
620 self.assertEqual(n1.getState(),pilot.DONE)
621 n1.edGetSeqOfSamplesPort().getPyObj()
622 a,b,c=n1.getPassedResults(ex)
623 self.assertEqual(a,list(range(6)))
624 self.assertEqual([elt.getPyObj() for elt in b],[[6, 12, 16, 18, -4, 10]])
625 self.assertEqual(c,['n10_o2_interceptor'])
630 p=self.r.createProc("prTest1")
631 cont=p.createContainer("gg","Salome")
632 cont.setProperty("name","localhost")
633 cont.setProperty("hostname","localhost")
634 cont.setProperty("type","multi")
635 td=p.createType("double","double")
636 ti=p.createType("int","int")
637 tsi=p.createSequenceTc("seqint","seqint",ti)
638 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
639 n0=self.r.createScriptNode("","n0")
640 o0=n0.edAddOutputPort("o0",tsi)
641 n0.setScript("o0=[3,6,8,9,-2,5]")
643 n1=self.r.createForEachLoop("n1",ti)
644 n10=self.r.createScriptNode("","n10")
645 n10.setExecutionMode("remote")
646 n10.setContainer(cont)
652 raise Exception("Simulated error !")
656 i1=n10.edAddInputPort("i1",ti)
657 o2=n10.edAddOutputPort("o2",ti)
659 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
660 p.edAddLink(n1.edGetSamplePort(),i1)
662 n1.edGetNbOfBranchesPort().edInitPy(1)
663 n2=self.r.createScriptNode("","n2")
664 n2.setScript("o4=i3")
665 i3=n2.edAddInputPort("i3",tsi)
666 o4=n2.edAddOutputPort("o4",tsi)
667 n2.setScript("o4=i3")
673 l=loader.YACSLoader()
675 n1=p.getChildByName("n1")
676 ex=pilot.ExecutorSwig()
680 self.assertEqual(n1.getState(),pilot.FAILED)
681 n1.edGetSeqOfSamplesPort().getPyObj()
682 a,b,c=n1.getPassedResults(ex)
683 self.assertEqual(a,list(range(3)))
684 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16]])
685 self.assertEqual(c,['n10_o2_interceptor'])
689 from datetime import datetime
691 p=self.r.createProc("prTest2")
692 cont=p.createContainer("gg","Salome")
693 cont.setProperty("name","localhost")
694 cont.setProperty("hostname","localhost")
695 cont.setProperty("type","multi")
696 td=p.createType("double","double")
697 ti=p.createType("int","int")
698 tsi=p.createSequenceTc("seqint","seqint",ti)
699 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
700 n0=self.r.createScriptNode("","n0")
701 o0=n0.edAddOutputPort("o0",tsi)
702 n0.setScript("o0=[3,6,8,9,-2,5]")
704 n1=self.r.createForEachLoop("n1",ti)
705 n10=self.r.createScriptNode("","n10")
706 n10.setExecutionMode("remote")
707 n10.setContainer(cont)
712 raise Exception("Simulated error !")
717 i1=n10.edAddInputPort("i1",ti)
718 o2=n10.edAddOutputPort("o2",ti)
720 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
721 p.edAddLink(n1.edGetSamplePort(),i1)
723 n1.edGetNbOfBranchesPort().edInitPy(2)
724 n2=self.r.createScriptNode("","n2")
725 n2.setScript("o4=i3")
726 i3=n2.edAddInputPort("i3",tsi)
727 o4=n2.edAddOutputPort("o4",tsi)
728 n2.setScript("o4=i3")
734 l=loader.YACSLoader()
736 n1=p.getChildByName("n1")
737 ex=pilot.ExecutorSwig()
738 ex.setKeepGoingProperty(True)
740 startt=datetime.now()
742 t0=datetime.now()-startt
744 self.assertEqual(n1.getState(),pilot.FAILED)
745 n1.edGetSeqOfSamplesPort().getPyObj()
746 a,b,c=n1.getPassedResults(ex)
747 self.assertEqual(a,[0,1,2,4,5])
748 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
749 self.assertEqual(c,['n10_o2_interceptor'])
751 p.getChildByName("n1").getChildByName("n10").setScript("""
755 raise Exception("Simulated error !")
759 ex=pilot.ExecutorSwig()
760 ex.setKeepGoingProperty(True)
762 startt=datetime.now()
764 t1=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,[1,2,3,4,5])
770 self.assertEqual([elt.getPyObj() for elt in b],[[12,16,18,-4,10]])
771 self.assertEqual(c,['n10_o2_interceptor'])
775 """ Test of assignation of already computed values for foreach node."""
777 from datetime import datetime
778 p=self.r.createProc("prTest2")
779 cont=p.createContainer("gg","Salome")
780 cont.setProperty("name","localhost")
781 cont.setProperty("hostname","localhost")
782 cont.setProperty("type","multi")
783 td=p.createType("double","double")
784 ti=p.createType("int","int")
785 tsi=p.createSequenceTc("seqint","seqint",ti)
786 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
787 n0=self.r.createScriptNode("","n0")
788 o0=n0.edAddOutputPort("o0",tsi)
789 n0.setScript("o0=[3,6,8,9,-2,5]")
791 n1=self.r.createForEachLoop("n1",ti)
792 n10=self.r.createScriptNode("","n10")
793 n10.setExecutionMode("remote")
794 n10.setContainer(cont)
799 raise Exception("Simulated error !")
804 i1=n10.edAddInputPort("i1",ti)
805 o2=n10.edAddOutputPort("o2",ti)
807 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
808 p.edAddLink(n1.edGetSamplePort(),i1)
810 n1.edGetNbOfBranchesPort().edInitPy(2)
811 n2=self.r.createScriptNode("","n2")
812 n2.setScript("o4=i3")
813 i3=n2.edAddInputPort("i3",tsi)
814 o4=n2.edAddOutputPort("o4",tsi)
815 n2.setScript("o4=i3")
821 l=loader.YACSLoader()
823 n1=p.getChildByName("n1")
824 ex=pilot.ExecutorSwig()
825 ex.setKeepGoingProperty(True)
827 startt=datetime.now()
829 t0=datetime.now()-startt
831 self.assertEqual(p.getState(),pilot.FAILED)
832 self.assertEqual(n1.getState(),pilot.FAILED)
833 n1.edGetSeqOfSamplesPort().getPyObj()
834 a,b,c=n1.getPassedResults(ex)
835 self.assertEqual(a,[0,1,2,4,5])
836 self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
837 self.assertEqual(c,['n10_o2_interceptor'])
839 p.getChildByName("n1").getChildByName("n10").setScript("""
844 ex=pilot.ExecutorSwig()
845 ex.setKeepGoingProperty(True)
846 p.getChildByName("n1").assignPassedResults(a,b,c)
848 startt=datetime.now()
850 t1=datetime.now()-startt
852 self.assertEqual(n1.getState(),pilot.DONE)
853 self.assertEqual(p.getState(),pilot.DONE)
854 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6,12,16,63,-4,10])
859 from datetime import datetime
860 p=self.r.createProc("prTest2")
861 cont=p.createContainer("gg","Salome")
862 cont.setProperty("name","localhost")
863 cont.setProperty("hostname","localhost")
864 cont.setProperty("type","multi")
865 td=p.createType("double","double")
866 ti=p.createType("int","int")
867 tsi=p.createSequenceTc("seqint","seqint",ti)
868 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
869 n0=self.r.createScriptNode("","n0")
870 o0=n0.edAddOutputPort("o0",tsi)
871 n0.setScript("o0=[ 3*elt for elt in range(12) ]")
873 n1=self.r.createForEachLoop("n1",ti)
874 n10=self.r.createScriptNode("","n10")
875 n10.setExecutionMode("remote")
876 n10.setContainer(cont)
881 raise Exception("Simulated error !")
886 i1=n10.edAddInputPort("i1",ti)
887 o2=n10.edAddOutputPort("o2",ti)
889 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
890 p.edAddLink(n1.edGetSamplePort(),i1)
892 n1.edGetNbOfBranchesPort().edInitPy(2)
893 n2=self.r.createScriptNode("","n2")
894 n2.setScript("o4=i3")
895 i3=n2.edAddInputPort("i3",tsi)
896 o4=n2.edAddOutputPort("o4",tsi)
897 n2.setScript("o4=i3")
903 l=loader.YACSLoader()
905 n1=p.getChildByName("n1")
906 ex=pilot.ExecutorSwig()
907 ex.setKeepGoingProperty(True)
909 startt=datetime.now()
911 t0=datetime.now()-startt
913 self.assertEqual(p.getState(),pilot.FAILED)
914 self.assertEqual(n1.getState(),pilot.FAILED)
915 n1.edGetSeqOfSamplesPort().getPyObj()
916 a,b,c=n1.getPassedResults(ex)
917 self.assertEqual(a,[1,3,5,7,9,11])
918 self.assertEqual([elt.getPyObj() for elt in b],[[12,36,60,84,108,132]])
919 self.assertEqual(c,['n10_o2_interceptor'])
921 p.getChildByName("n1").getChildByName("n10").setScript("""
924 raise Exception("Simulated error !")
929 ex=pilot.ExecutorSwig()
930 ex.setKeepGoingProperty(True)
931 p.getChildByName("n1").assignPassedResults(a,b,c)
933 startt=datetime.now()
935 t1=datetime.now()-startt
936 #assert(t1.total_seconds()<6.+1.)# normally 6/2+1 s (6 remaining elts in 2 // branches + 1s to launch container)
938 self.assertEqual(n1.getState(),pilot.DONE)
939 self.assertEqual(p.getState(),pilot.DONE)
940 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,12,30,36,60,60,90,84,120,108,150,132])
947 "test if we do not restart from the begining of the schema after an error in a foreach"
949 from datetime import datetime
950 p=self.r.createProc("prTest2")
951 cont=p.createContainer("gg","Salome")
952 cont.setProperty("name","localhost")
953 cont.setProperty("hostname","localhost")
954 cont.setProperty("type","multi")
955 td=p.createType("double","double")
956 ti=p.createType("int","int")
957 tsi=p.createSequenceTc("seqint","seqint",ti)
958 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
959 n0=self.r.createScriptNode("","n0")
960 o0=n0.edAddOutputPort("o0",tsi)
961 n0.setScript("o0=[ elt for elt in range(12) ]")
963 n1=self.r.createForEachLoop("n1",ti)
964 n10=self.r.createScriptNode("","n10")
965 n10.setExecutionMode("remote")
966 n10.setContainer(cont)
971 raise Exception("Simulated error !")
976 i1=n10.edAddInputPort("i1",ti)
977 o2=n10.edAddOutputPort("o2",ti)
979 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
980 p.edAddLink(n1.edGetSamplePort(),i1)
982 n1.edGetNbOfBranchesPort().edInitPy(2)
983 n2=self.r.createScriptNode("","n2")
984 n2.setScript("o4=i3")
985 i3=n2.edAddInputPort("i3",tsi)
986 o4=n2.edAddOutputPort("o4",tsi)
987 n2.setScript("o4=i3")
993 l=loader.YACSLoader()
995 n1=p.getChildByName("n1")
996 ex=pilot.ExecutorSwig()
997 ex.setKeepGoingProperty(True)
999 startt=datetime.now()
1001 t0=datetime.now()-startt
1003 self.assertEqual(p.getState(),pilot.FAILED)
1004 self.assertEqual(n1.getState(),pilot.FAILED)
1005 n1.edGetSeqOfSamplesPort().getPyObj()
1006 a,b,c=n1.getPassedResults(ex)
1008 self.assertEqual(a,[0,2,4,6,8,10])
1009 self.assertEqual([elt.getPyObj() for elt in b],[[0,4,8,12,16,20]])
1011 p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(12) ]")
1012 p.getChildByName("n1").getChildByName("n10").setScript("""
1015 raise Exception("Simulated error !")
1023 p.getChildByName("n1").assignPassedResults(a,b,c)
1026 startt=datetime.now()
1028 t1=datetime.now()-startt
1030 self.assertEqual(n1.getState(),pilot.DONE)
1031 self.assertEqual(p.getState(),pilot.DONE)
1032 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,5,4,15,8,25,12,35,16,45,20,55])
1036 """ Test of nested ForEachLoop with a port connected inside and outside the loop."""
1037 schema = self.r.createProc("schema")
1038 ti = schema.getTypeCode("int")
1039 tiset = schema.createSequenceTc("", "seqint", ti)
1040 tisetseq = schema.createSequenceTc("", "seqintvec", tiset)
1042 n1 = self.r.createScriptNode("", "PyScript2")
1043 n1.edAddInputPort("i3", ti)
1044 n1.edAddInputPort("i4", ti)
1045 n1.edAddOutputPort("o5", ti)
1046 n1.setScript("o5=i3+i4")
1048 n2 = self.r.createScriptNode("", "PyScript1")
1049 n2.edAddInputPort("i2", ti)
1050 n2.edAddOutputPort("o3", ti)
1051 n2.setScript("o3=i2")
1053 b1 = self.r.createBloc("Bloc1")
1057 fe1 = self.r.createForEachLoop("ForEach1", ti)
1058 fe1.getInputPort("nbBranches").edInitPy(2)
1059 fe1.getInputPort("SmplsCollection").edInitPy([1, 2, 3, 4])
1062 n3 = self.r.createScriptNode("", "PostProcessing")
1063 n3.edAddInputPort("i7", tiset)
1064 n3.edAddInputPort("i5", tiset)
1065 n3.edAddOutputPort("o4", ti)
1075 b0 = self.r.createBloc("Bloc0")
1079 fe0 = self.r.createForEachLoop("ForEach1", ti)
1080 fe0.getInputPort("nbBranches").edInitPy(2)
1081 fe0.getInputPort("SmplsCollection").edInitPy([1, 2, 3, 4])
1084 schema.edAddChild(fe0)
1086 nx = self.r.createScriptNode("", "Result")
1087 nx.edAddInputPort("i8", tiset)
1088 nx.edAddOutputPort("o6", ti)
1094 schema.edAddChild(nx)
1096 schema.edAddLink(fe1.getOutputPort("evalSamples"), n1.getInputPort("i3"))
1097 schema.edAddLink(fe0.getOutputPort("evalSamples"), n1.getInputPort("i4"))
1099 schema.edAddDFLink(n1.getOutputPort("o5"), n3.getInputPort("i7"))
1100 schema.edAddDFLink(n2.getOutputPort("o3"), n3.getInputPort("i5"))
1102 po5 = fe1.getOutputPort("Bloc1.PyScript2.o5")
1103 schema.edAddDFLink(po5, n2.getInputPort("i2"))
1105 schema.edAddDFLink(n3.getOutputPort("o4"), nx.getInputPort("i8"))
1106 # schema.saveSchema("foreach12.xml")
1108 e = pilot.ExecutorSwig()
1110 self.assertEqual(schema.getState(),pilot.DONE)
1111 resVal = schema.getChildByName("Result").getOutputPort("o6").getPyObj()
1112 self.assertEqual(resVal, 160)
1116 """ Non regression test EDF11239. ForEach into ForEach. Problem on cloning linked to DeloymentTree.appendTask method that was too strong."""
1117 p=self.r.createProc("Bug11239")
1118 ti=p.createType("int","int")
1119 ti2=p.createSequenceTc("seqint","seqint",ti)
1121 cont=p.createContainer("DefaultContainer","Salome")
1123 node0=self.r.createForEachLoop("ForEachLoop_int0",ti)
1125 node0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
1126 node0.edGetNbOfBranchesPort().edInitInt(2)
1128 node00=self.r.createBloc("Bloc0")
1129 node0.edAddChild(node00)
1130 node000_0=self.r.createForEachLoop("ForEachLoop_int1",ti)
1131 node00.edAddChild(node000_0)
1132 node000_0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
1133 node000_0.edGetNbOfBranchesPort().edInitInt(3)
1135 node0000=self.r.createBloc("Bloc1")
1136 node000_0.edAddChild(node0000)
1138 node0000_0=self.r.createScriptNode("","PyScript2")
1139 node0000.edAddChild(node0000_0)
1140 i3=node0000_0.edAddInputPort("i3",ti)
1141 i4=node0000_0.edAddInputPort("i4",ti)
1142 o5=node0000_0.edAddOutputPort("o5",ti)
1143 node0000_0.setScript("o5 = i3 + i4")
1144 node0000_0.setContainer(cont)
1145 node0000_0.setExecutionMode("remote")
1146 p.edAddLink(node0.edGetSamplePort(),i3)
1147 p.edAddLink(node000_0.edGetSamplePort(),i4)
1149 node0000_1=self.r.createScriptNode("","PyScript1")
1150 node0000.edAddChild(node0000_1)
1151 o3=node0000_1.edAddOutputPort("o3",ti)
1152 node0000_1.setScript("o3 = 7")
1153 node0000_1.setExecutionMode("local")
1154 p.edAddCFLink(node0000_0,node0000_1)
1156 node000_1=self.r.createScriptNode("","PostTraitement")
1157 node00.edAddChild(node000_1)
1158 i7=node000_1.edAddInputPort("i7",ti2)
1159 i5=node000_1.edAddInputPort("i5",ti2)
1160 node000_1.setScript("for i in i7:\n print(i)\nprint(\"separation\")\nfor i in i5:\n print(i)")
1161 node000_1.setContainer(cont)
1162 node000_1.setExecutionMode("remote")
1165 p.edAddCFLink(node000_0,node000_1)
1167 #p.saveSchema("tmpp.xml")
1168 ex = pilot.ExecutorSwig()
1169 self.assertEqual(p.getState(),pilot.READY)
1171 self.assertEqual(p.getState(),pilot.DONE)
1175 """ 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 !"""
1176 xmlFileName="test14.xml"
1177 SALOMERuntime.RuntimeSALOME_setRuntime()
1178 r=pilot.getRuntime()
1179 n0=r.createProc("test23/zeRun")
1180 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1181 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tp)
1182 n0bis=r.createBloc("test23/main") ; n0.edAddChild(n0bis)
1183 n00=r.createBloc("test23/run") ; n0bis.edAddChild(n00)
1185 n000=r.createForEachLoop("test23/FE",tp) ; n00.edAddChild(n000)
1186 n0000=r.createScriptNode("Salome","test23/run_internal") ; n000.edSetNode(n0000)
1187 i0=n0000.edAddInputPort("i0",tp)
1188 i1=n0000.edAddInputPort("i1",tp) ; i1.edInitPy(3)
1189 o0=n0000.edAddOutputPort("o0",tp)
1190 n0000.setScript("o0=i0+i1")
1192 n00.edAddLink(n000.edGetSamplePort(),i0)
1194 n000.edGetSeqOfSamplesPort().edInitPy(list(range(10)))
1195 n000.edGetNbOfBranchesPort().edInitInt(2)
1197 n01=r.createScriptNode("Salome","test23/check") ; n0bis.edAddChild(n01)
1198 n0bis.edAddCFLink(n00,n01)
1199 i2=n01.edAddInputPort("i2",tp2)
1200 o1=n01.edAddOutputPort("o1",tp2)
1201 n01.setScript("o1=i2")
1202 n0bis.edAddLink(o0,i2)
1204 n0.saveSchema(xmlFileName)
1206 l=loader.YACSLoader()
1207 p=l.load(xmlFileName) # very import do not use n0 but use p instead !
1208 ex=pilot.ExecutorSwig()
1210 self.assertEqual(p.getState(),pilot.READY)
1212 self.assertEqual(p.getState(),pilot.DONE)
1213 self.assertEqual(p.getChildByName("test23/main.test23/check").getOutputPort("o1").getPyObj(),[3,4,5,6,7,8,9,10,11,12])
1217 fname="BugInConcurrentLaunchDftCont.xml"
1218 p=self.r.createProc("pr")
1219 ti=p.createType("int","int")
1220 cont=p.createContainer("DefaultContainer","Salome")
1221 cont.setProperty("container_name","FactoryServer")
1222 b=self.r.createBloc("Bloc") ; p.edAddChild(b)
1227 node=self.r.createScriptNode("Salome","node%d"%i)
1228 node.setExecutionMode("remote")
1229 node.setContainer(cont)
1230 outs.append(node.edAddOutputPort("i",ti))
1231 node.setScript("i=%d"%i)
1234 node=self.r.createScriptNode("Salome","nodeEnd")
1235 node.setExecutionMode("remote")
1236 node.setContainer(cont)
1237 res=node.edAddOutputPort("res",ti)
1242 inp=node.edAddInputPort(elt,ti) ; l.append(elt)
1244 p.edAddLink(outs[i],inp)
1245 node.setScript("res="+"+".join(l))
1246 p.edAddCFLink(b,node)
1250 ex = pilot.ExecutorSwig()
1251 self.assertEqual(p.getState(),pilot.READY)
1253 self.assertEqual(res.getPyObj(),6)
1254 self.assertEqual(p.getState(),pilot.DONE)
1258 """ Test to check that a list[pyobj] outputport linked to pyobj inputport is OK."""
1259 SALOMERuntime.RuntimeSALOME_setRuntime()
1260 self.r=pilot.getRuntime()
1261 n0=self.r.createProc("test16/zeRun")
1262 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1263 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tp)
1265 n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
1266 o0=n00.edAddOutputPort("o0",tp2)
1267 n00.setScript("o0=[[i+1] for i in range(8)]")
1268 n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
1269 i1=n01.edAddInputPort("i1",tp)
1270 n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
1271 n0.edAddCFLink(n00,n01)
1274 ex=pilot.ExecutorSwig()
1275 self.assertEqual(n0.getState(),pilot.READY)
1277 self.assertEqual(n0.getState(),pilot.DONE)
1281 """ Same as test16 except that tp2 is not list of tp but a list of copy of tp"""
1282 SALOMERuntime.RuntimeSALOME_setRuntime()
1283 self.r=pilot.getRuntime()
1284 n0=self.r.createProc("test17/zeRun")
1285 tp=n0.createInterfaceTc("python:obj:1.0","pyobj",[])
1286 tpp=n0.createInterfaceTc("python:obj:1.0","pyobj",[]) # diff is here
1287 tp2=n0.createSequenceTc("list[pyobj]","list[pyobj]",tpp)
1289 n00=self.r.createScriptNode("Salome","n00") ; n0.edAddChild(n00)
1290 o0=n00.edAddOutputPort("o0",tp2)
1291 n00.setScript("o0=[[i+1] for i in range(8)]")
1292 n01=self.r.createScriptNode("Salome","n01") ; n0.edAddChild(n01)
1293 i1=n01.edAddInputPort("i1",tp)
1294 n01.setScript("assert(i1==[[1], [2], [3], [4], [5], [6], [7], [8]])")
1295 n0.edAddCFLink(n00,n01)
1298 ex=pilot.ExecutorSwig()
1299 self.assertEqual(n0.getState(),pilot.READY)
1301 self.assertEqual(n0.getState(),pilot.DONE)
1305 p=self.r.createProc("prTest18")
1306 n00=self.r.createScriptNode("Salome","n00")
1307 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1308 n00.setExecutionMode("remote")
1309 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1310 cont=p.createContainer("gg","Salome")
1311 n00.setContainer(cont)
1312 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1313 cont.setProperty("nb_proc_per_nod","6")
1314 self.assertEqual(n00.getMaxLevelOfParallelism(),1)
1315 cont.setProperty("nb_proc_per_node","7") # <- here
1316 self.assertEqual(n00.getMaxLevelOfParallelism(),7) # <- here
1320 """This test checks the mechanism of YACS that allow PythonNodes to know their DynParaLoop context."""
1322 l=loader.YACSLoader()
1324 p=self.r.createProc("PROC")
1325 ti=p.createType("int","int")
1326 tdi=p.createSequenceTc("seqint","seqint",ti)
1328 fe0=self.r.createForEachLoop("FE0",ti) ; p.edAddChild(fe0)
1329 fe0.edGetNbOfBranchesPort().edInitInt(4)
1330 fe0_end=self.r.createScriptNode("Salome","fe0_end")
1331 fe0.edSetFinalizeNode(fe0_end)
1332 fe0_end.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0"])
1333 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<4)""")
1334 n0=self.r.createScriptNode("Salome","n0") ; p.edAddChild(n0)
1335 n0.setScript("o1=range(10)")
1336 a=n0.edAddOutputPort("o1",tdi)
1337 p.edAddLink(a,fe0.edGetSeqOfSamplesPort()) ; p.edAddCFLink(n0,fe0)
1339 b0=self.r.createBloc("b0") ; fe0.edAddChild(b0)
1340 n1=self.r.createScriptNode("Salome","n1") ; b0.edAddChild(n1)
1341 n1.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0"])
1342 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<4)
1344 b=n1.edAddOutputPort("o1",tdi)
1345 fe1=self.r.createForEachLoop("FE1",ti) ; b0.edAddChild(fe1)
1346 fe1.edGetNbOfBranchesPort().edInitInt(3)
1347 fe1_end=self.r.createScriptNode("Salome","fe1_end")
1348 fe1_end.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0.b0.FE1","FE0"])
1349 assert(my_dpl_localization[1][1]>=0 and my_dpl_localization[1][1]<4)
1350 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<3)
1352 fe1.edSetFinalizeNode(fe1_end)
1353 p.edAddLink(b,fe1.edGetSeqOfSamplesPort()) ; p.edAddCFLink(n1,fe1)
1355 n2=self.r.createScriptNode("Salome","n2") ; fe1.edAddChild(n2)
1356 n2.setScript("""assert([elt[0] for elt in my_dpl_localization]==["FE0.b0.FE1","FE0"])
1357 assert(my_dpl_localization[1][1]>=0 and my_dpl_localization[1][1]<4)
1358 assert(my_dpl_localization[0][1]>=0 and my_dpl_localization[0][1]<3)
1362 ex=pilot.ExecutorSwig()
1364 # local run of PythonNodes n1 and n2
1367 self.assertEqual(p.getState(),pilot.READY)
1368 ex.setDPLScopeSensitive(True) # <- this line is the aim of the test
1370 self.assertEqual(p.getState(),pilot.DONE)
1374 cont=p.createContainer("gg","HPSalome")
1375 cont.setSizeOfPool(2)
1376 n1=p.getChildByName("FE0.b0.n1") ; n1.setExecutionMode("remote") ; n1.setContainer(cont)
1377 n2=p.getChildByName("FE0.b0.FE1.n2") ; n2.setExecutionMode("remote") ; n2.setContainer(cont)
1380 self.assertEqual(p.getState(),pilot.READY)
1382 self.assertEqual(p.getState(),pilot.DONE)
1386 """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"""
1387 def assignCont(n,cont):
1388 n.setExecutionMode("remote") ; n.setContainer(cont)
1390 xmlFileName="test20.xml"
1391 p=self.r.createProc("test26")
1393 cont=p.createContainer("gg","HPSalome") # very important ! HP Container needed for the test !
1394 cont.setSizeOfPool(8) # important make this figure >= 6
1396 po=p.createInterfaceTc("python:obj:1.0","pyobj",[])
1397 sop=p.createSequenceTc("list[pyobj]","list[pyobj]",po)
1399 b0=self.r.createBloc("test26/main") ; p.edAddChild(b0)
1400 n0=self.r.createScriptNode("Salome","test26/n0") ; assignCont(n0,cont) # 1
1401 n0.setScript("""import os
1403 dd=n0.edAddOutputPort("dd",sop) ; b0.edAddChild(n0)
1404 fe0=self.r.createForEachLoop("test26/FE0",po) ; b0.edAddChild(fe0)
1405 fe0.edGetNbOfBranchesPort().edInitInt(1) # very important for the test : 1 !
1406 fe0i=self.r.createBloc("test26/FE0_internal") ; fe0.edSetNode(fe0i)
1407 zeArgInitNode2=self.r.createScriptNode("Salome","zeArgInitNode") ; assignCont(zeArgInitNode2,cont) # 2
1408 fe0i.edAddChild(zeArgInitNode2)
1409 c1=zeArgInitNode2.edAddInputPort("c",po)
1410 c2=zeArgInitNode2.edAddOutputPort("c",po)
1411 zeRun=self.r.createBloc("test26/zeRun") ; fe0i.edAddChild(zeRun)
1412 zeArgInitNode=self.r.createScriptNode("Salome","zeArgInitNode") ; assignCont(zeArgInitNode,cont) # 3
1413 zeRun.edAddChild(zeArgInitNode)
1414 ff1=zeArgInitNode.edAddInputPort("ff",po)
1415 ff2=zeArgInitNode.edAddOutputPort("ff",po)
1416 line01=self.r.createScriptNode("Salome","line01") ; zeRun.edAddChild(line01) ; assignCont(line01,cont) # 4
1417 line01.setScript("ee=3")
1418 ee0=line01.edAddOutputPort("ee",po)
1419 initt=self.r.createScriptNode("Salome","test26/initt") ; assignCont(initt,cont) # 5
1420 initt.setScript("pass") ; zeRun.edAddChild(initt)
1421 end=self.r.createScriptNode("Salome","test26/end") ; assignCont(end,cont) # 6
1422 end.setScript("import os") ; zeRun.edAddChild(end)
1423 retu=self.r.createScriptNode("Salome","return") ; assignCont(retu,cont) # 7
1424 retu.setScript("ee=i0") ; zeRun.edAddChild(retu)
1425 i0=retu.edAddInputPort("i0",po)
1426 ee=retu.edAddOutputPort("ee",po)
1427 zeRun.edAddCFLink(zeArgInitNode,line01)
1428 zeRun.edAddCFLink(line01,initt)
1429 zeRun.edAddCFLink(initt,end)
1430 zeRun.edAddCFLink(end,retu)
1433 returnn=self.r.createScriptNode("Salome","return") ; assignCont(returnn,cont) # 8
1434 returnn.setScript("elt=i0")
1435 i00=returnn.edAddInputPort("i0",po)
1436 elt=returnn.edAddOutputPort("elt",po)
1437 fe0i.edAddChild(returnn)
1438 fe0i.edAddCFLink(zeArgInitNode2,zeRun)
1439 fe0i.edAddCFLink(zeRun,returnn)
1443 finalize=self.r.createScriptNode("Salome","test26/finalize") ; b0.edAddChild(finalize) ; assignCont(finalize,cont) # 9
1444 finalize.setScript("pass")
1445 b0.edAddCFLink(n0,fe0)
1446 b0.edAddCFLink(fe0,finalize)
1448 p.edAddLink(dd,fe0.edGetSeqOfSamplesPort())
1449 p.edAddLink(fe0.edGetSamplePort(),c1)
1451 #p.saveSchema(xmlFileName)
1452 p.getChildByName("test26/main.test26/FE0").edGetNbOfBranchesPort().edInitInt(1) # very important 1 !
1454 ex=pilot.ExecutorSwig()
1455 self.assertEqual(p.getState(),pilot.READY)
1457 self.assertEqual(p.getState(),pilot.DONE)
1463 "test if we restart from a saved state in a foreach loop"
1465 xmlStateFileName="saveState21.xml"
1466 from datetime import datetime
1467 p=self.r.createProc("prTest21")
1468 cont=p.createContainer("gg","Salome")
1469 cont.setProperty("name","localhost")
1470 cont.setProperty("hostname","localhost")
1471 cont.setProperty("type","multi")
1472 td=p.createType("double","double")
1473 ti=p.createType("int","int")
1474 tsi=p.createSequenceTc("seqint","seqint",ti)
1475 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
1476 n0=self.r.createScriptNode("","n0")
1477 o0=n0.edAddOutputPort("o0",tsi)
1478 n0.setScript("o0=[ elt for elt in range(6) ]")
1480 n1=self.r.createForEachLoop("n1",ti)
1481 n10=self.r.createScriptNode("","n10")
1482 n10.setExecutionMode("remote")
1483 n10.setContainer(cont)
1490 i1=n10.edAddInputPort("i1",ti)
1491 o2=n10.edAddOutputPort("o2",ti)
1493 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
1494 p.edAddLink(n1.edGetSamplePort(),i1)
1495 p.edAddCFLink(n0,n1)
1496 n1.edGetNbOfBranchesPort().edInitPy(2)
1497 n2=self.r.createScriptNode("","n2")
1498 n2.setScript("o4=i3")
1499 i3=n2.edAddInputPort("i3",tsi)
1500 o4=n2.edAddOutputPort("o4",tsi)
1501 n2.setScript("o4=i3")
1503 p.edAddCFLink(n1,n2)
1507 l=loader.YACSLoader()
1509 n1=p.getChildByName("n1")
1510 ex=pilot.ExecutorSwig()
1511 ex.setKeepGoingProperty(True)
1513 startt=datetime.now()
1515 myRun=threading.Thread(None, ex.RunW, None, (p,0))
1519 SALOMERuntime.schemaSaveState(p, ex, xmlStateFileName)
1520 a,b,c=n1.getPassedResults(ex)
1522 t0=datetime.now()-startt
1524 self.assertEqual(p.getState(),pilot.DONE)
1525 self.assertEqual(n1.getState(),pilot.DONE)
1526 self.assertEqual(a,[0,1])
1527 self.assertEqual([elt.getPyObj() for elt in b],[[0,2]])
1529 p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
1530 p.getChildByName("n1").getChildByName("n10").setScript("""
1535 loader.loadState(p, xmlStateFileName)
1537 p.getChildByName("n1").assignPassedResults(a,b,c)
1540 startt=datetime.now()
1542 t1=datetime.now()-startt
1544 self.assertEqual(n1.getState(),pilot.DONE)
1545 self.assertEqual(p.getState(),pilot.DONE)
1546 self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
1551 """Restart from a saved state in a foreach loop without using assignPassedResults.
1552 This test uses the files test21.xml and saveState21.xml produced by test21.
1555 xmlStateFileName="saveState21.xml"
1557 ex=pilot.ExecutorSwig()
1558 l=loader.YACSLoader()
1560 q.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
1561 q.getChildByName("n1").getChildByName("n10").setScript("""
1564 print("execution n10:", i1)
1567 q.getChildByName("n2").setScript("""
1568 print("execution n2:", i3)
1571 loader.loadState(q, xmlStateFileName)
1577 self.assertEqual(q.getChildByName("n1").getState(),pilot.DONE)
1578 self.assertEqual(q.getState(),pilot.DONE)
1579 self.assertEqual(q.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
1583 """ test focused on weight attribut after a dump and reload from a xml file
1586 xmlStateFileName="saveState23.xml"
1587 from datetime import datetime
1588 p=self.r.createProc("prTest23")
1589 cont=p.createContainer("gg","Salome")
1590 cont.setProperty("name","localhost")
1591 cont.setProperty("hostname","localhost")
1592 cont.setProperty("type","multi")
1593 td=p.createType("double","double")
1594 ti=p.createType("int","int")
1595 tsi=p.createSequenceTc("seqint","seqint",ti)
1596 tsd=p.createSequenceTc("seqdbl","seqdbl",td)
1597 n0=self.r.createScriptNode("","n0")
1598 o0=n0.edAddOutputPort("o0",tsi)
1599 n0.setScript("o0=[ elt for elt in range(6) ]")
1601 n1=self.r.createForEachLoop("n1",ti)
1603 n10=self.r.createScriptNode("","n10")
1604 n10.setExecutionMode("remote")
1605 n10.setContainer(cont)
1613 i1=n10.edAddInputPort("i1",ti)
1614 o2=n10.edAddOutputPort("o2",ti)
1616 p.edAddLink(o0,n1.edGetSeqOfSamplesPort())
1617 p.edAddLink(n1.edGetSamplePort(),i1)
1618 p.edAddCFLink(n0,n1)
1619 n1.edGetNbOfBranchesPort().edInitPy(2)
1620 n2=self.r.createScriptNode("","n2")
1621 n2.setScript("o4=i3")
1622 i3=n2.edAddInputPort("i3",tsi)
1623 o4=n2.edAddOutputPort("o4",tsi)
1624 n2.setScript("o4=i3")
1626 p.edAddCFLink(n1,n2)
1630 l=loader.YACSLoader()
1632 self.assertEqual(p.getChildByName("n1").getWeight().getSimpleLoopWeight(),3.0)
1633 self.assertEqual(p.getChildByName("n1").getChildByName("n10").getWeight().getElementaryWeight(),4.0)
1637 """ Non regression test EDF17470"""
1638 SALOMERuntime.RuntimeSALOME.setRuntime()
1639 r=SALOMERuntime.getSALOMERuntime()
1640 p=r.createProc("prTest2")
1642 cont1=p.createContainer("cont1","Salome")
1643 cont1.setProperty("name","localhost")
1644 cont1.setProperty("hostname","localhost")
1645 cont1.setProperty("type","multi")
1646 cont1.setProperty("container_name","container1@")
1648 cont2=p.createContainer("cont2","Salome")
1649 cont2.setProperty("name","localhost")
1650 cont2.setProperty("hostname","localhost")
1651 cont2.setProperty("type","multi")
1652 cont2.setProperty("container_name","container2@")
1654 td=p.createType("double","double")
1655 ti=p.createType("int","int")
1656 ts=p.createType("string","string")
1657 n0=r.createScriptNode("","n0")
1658 n0.setScript("""import SalomeSDSClt
1667 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1669 return pickle.loads(strr)
1672 salome.salome_init()
1675 dsm=salome.naming_service.Resolve("/DataServerManager")
1676 dsm.cleanScopesInNS()
1677 if scopeName in dsm.listScopes():
1678 dsm.removeDataScope(scopeName)
1679 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1681 t0=dss.createRdExtVarTransac(varName,obj2Str({"ab":[4,5,6]}))
1682 dss.atomicApply([t0])
1684 n0_sn=n0.edAddOutputPort("scopeName",ts)
1685 n0_vn=n0.edAddOutputPort("varName",ts)
1687 n1=r.createScriptNode("","n1")
1688 n1_sn=n1.edAddInputPort("scopeName",ts)
1689 n1_vn=n1.edAddInputPort("varName",ts)
1690 n1.setScript("""import SalomeSDSClt
1700 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1702 return pickle.loads(strr)
1704 salome.salome_init()
1705 dsm=salome.naming_service.Resolve("/DataServerManager")
1706 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1707 assert(not isCreated)
1709 t1=dss.addMultiKeyValueSession(varName)
1711 wk2=dss.waitForKeyInVar(varName,obj2Str("ef"))
1713 assert(str2Obj(dss.waitForMonoThrRev(wk2))==[11,12])""")
1714 n1.setContainer(cont1)
1716 n2=r.createScriptNode("","n2")
1717 n2_sn=n2.edAddInputPort("scopeName",ts)
1718 n2_vn=n2.edAddInputPort("varName",ts)
1719 n2.setScript("""import SalomeSDSClt
1729 return pickle.dumps(obj,pickle.HIGHEST_PROTOCOL)
1731 return pickle.loads(strr)
1733 salome.salome_init()
1734 dsm=salome.naming_service.Resolve("/DataServerManager")
1735 dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
1736 assert(not isCreated)
1738 t1=dss.addMultiKeyValueSession(varName)
1739 t1.addKeyValueInVarErrorIfAlreadyExistingNow(obj2Str("cd"),obj2Str([7,8,9,10]))
1740 t1.addKeyValueInVarErrorIfAlreadyExistingNow(obj2Str("ef"),obj2Str([11,12]))
1742 n2.setContainer(cont2)
1747 p.edAddCFLink(n0,n1)
1748 p.edAddCFLink(n0,n2)
1749 p.edAddLink(n0_sn,n1_sn)
1750 p.edAddLink(n0_vn,n1_vn)
1751 p.edAddLink(n0_sn,n2_sn)
1752 p.edAddLink(n0_vn,n2_vn)
1754 ex=pilot.ExecutorSwig()
1756 self.assertEqual(p.getState(),pilot.DONE)
1761 p=self.r.createProc("p0")
1762 tp=p.createInterfaceTc("python:obj:1.0","pyobj",[])
1763 n1_0_sc=self.r.createScriptNode("Salome","n1_0_sc")
1764 p.edAddChild(n1_0_sc)
1765 n1_0_sc.setExecutionMode("remote")
1766 n1_0_sc.setScript("""""")
1767 i1_0_sc=n1_0_sc.edAddInputPort("i1",tp)
1768 i1_0_sc.edInitPy(list(range(4)))
1770 cont=p.createContainer("gg","Salome")
1771 cont.setProperty("name","localhost")
1772 cont.setProperty("hostname","localhost")
1773 n1_0_sc.setContainer(cont)
1776 l=loader.YACSLoader()
1778 ex=pilot.ExecutorSwig()
1779 self.assertEqual(p.getState(),pilot.READY)
1781 self.assertEqual(p.getState(),pilot.DONE)
1786 This test is here to check that old (<=930) graphs are always loadable.
1787 So an xml file coming from test14 in 930 has been generated and converted into home made "base64" like format.
1788 This test puts unbased64 byte array into test_930.xml and load it to check that everything is OK.
1791 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'
1793 fname="test_930.xml"
1794 with open(fname,"wb") as f:
1795 f.write( pilot.FromBase64Swig(content_of_file) )
1797 SALOMERuntime.RuntimeSALOME_setRuntime()
1798 l=loader.YACSLoader()
1800 self.assertTrue(p.getChildByName("test23/main").getChildByName("test23/run").getChildByName("test23/FE").getChildByName("test23/run_internal").getInputPort("i1").getPyObj() == 3)
1801 self.assertTrue(p.getChildByName("test23/main").getChildByName("test23/run").getChildByName("test23/FE").edGetSeqOfSamplesPort().getPyObj()==list(range(10)))
1805 if __name__ == '__main__':
1807 U = os.getenv('USER')
1808 with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
1809 f.write(" --- TEST src/yacsloader: testSaveLoadRun.py\n")
1810 suite = unittest.makeSuite(TestSaveLoadRun)
1811 result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
1812 sys.exit(not result.wasSuccessful())