2 # Copyright (C) 2021-2022 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
32 class TestBasicFirstSSL(unittest.TestCase):
35 First SSL test with YACS. This test launches SALOME_Container_No_NS_Serv servers to perform it's job.
36 These extra SALOME_Container_No_NS_Serv servers are shut down at the end
39 NamingService.NamingService.SetLogContainersFile()
40 SALOMERuntime.RuntimeSALOME.setRuntime()
41 rrr=SALOMERuntime.getSALOMERuntime()
42 """First test of HP Container no loop here only the 3 sorts of python nodes (the Distributed is it still used and useful ?) """
43 fname= "TestSaveLoadRun0.xml"
45 sqrtOfNumberOfTurn=1000 # 3000 -> 3.2s/Node, 1000 -> 0.1s/Node
47 p=rrr.createProc("prTest0")
48 td=p.createType("double","double")
49 ti=p.createType("int","int")
51 pg.setData([("localhost",4)])
58 ref=datetime.datetime.now()
59 t=0. ; pas=1./float(nb)
63 t+=1.+cos(1.*(x*3.14159))
66 print("coucou from script0-%i -> %s"%(dbg,str(datetime.datetime.now()-ref)))
69 for i in range(nbOfNodes):
70 cont=p.createContainer("gg{}".format(i),"Salome")
71 cont.setProperty("name","localhost")
72 cont.setProperty("hostname","localhost")
73 cont.setProperty("nb_proc_per_node","1")
74 node0=rrr.createFuncNode("DistPython","node%i"%(i))
77 node0.setContainer(cont)
78 node0.setScript(script0)
79 nb=node0.edAddInputPort("nb",ti) ; nb.edInitInt(sqrtOfNumberOfTurn)
80 dbg=node0.edAddInputPort("dbg",ti) ; dbg.edInitInt(i+1)
81 out0=node0.edAddOutputPort("s",td)
85 ex=pilot.ExecutorSwig()
86 self.assertEqual(p.getState(),pilot.READY)
87 st=datetime.datetime.now()
88 p.propagePlayGround(pg)
92 print("Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st)))
93 self.assertEqual(p.getState(),pilot.DONE)
94 # 2nd exec using the same already launched remote python interpreters
95 st=datetime.datetime.now()
97 print("Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st)))
98 self.assertEqual(p.getState(),pilot.DONE)
99 # 3rd exec using the same already launched remote python interpreters
100 st=datetime.datetime.now()
102 print("Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st)))
103 self.assertEqual(p.getState(),pilot.DONE)
104 print( "file containing list of IORS of containers : \"{}\"".format( NamingService.NamingService.GetLogContainersFile() ) )
105 print(NamingService.NamingService.IOROfNS())
106 print(NamingService.NamingService.RefOfNS())
107 print("Killing all containers")
108 NamingService.NamingService.KillContainersInFile( NamingService.NamingService.GetLogContainersFile() )
111 if __name__ == '__main__':