1 # Copyright (C) 2015-2016 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
20 # first test using cluster
24 CatalogResources="""<?xml version="1.0"?>
26 <machine name="localhost" hostname="dsp0698184" type="single_machine" appliPath="" batchQueue="" userCommands="" protocol="ssh" iprotocol="ssh" workingDirectory="" canLaunchBatchJobs="false" canRunContainers="true" batch="none" mpi="no mpi" userName="" OS="" memInMB="0" CPUFreqMHz="0" nbOfNodes="1" nbOfProcPerNode="4"/>
27 <machine name="athos" hostname="athos" type="cluster" appliPath="/home/H87074/ATHOS_V771/appli_V7_7_1" batchQueue="" userCommands="" protocol="ssh" iprotocol="ssh" workingDirectory="" canLaunchBatchJobs="true" canRunContainers="false" batch="slurm" mpi="no mpi" userName="" OS="" memInMB="0" CPUFreqMHz="0" nbOfNodes="250" nbOfProcPerNode="28"/>
30 def buildScheme(fname):
33 SALOMERuntime.RuntimeSALOME.setRuntime()
34 r=SALOMERuntime.getSALOMERuntime()
35 p0=r.createProc("run")
37 p=r.createBloc("toto")
40 cont=p0.createContainer("MyWonderfulContainer","Salome")
41 td=p0.createType("double","double")
42 n0=r.createScriptNode("Salome","PyScript0")
44 q=n0.edAddInputPort("q",td)
45 ep=n0.edAddOutputPort("ep",td)
46 n0.setScript("ep=1./(4.-q)") # <- force division by 0
47 n0.setExecutionMode("remote")
54 session=evalyfx.YACSEvalSession()
57 efx=evalyfx.YACSEvalYFX.BuildFromFile(fname)
58 efx.getParams().setStopASAPAfterErrorStatus(False)
59 inps=efx.getFreeInputPorts()
61 outps=efx.getFreeOutputPorts()
62 inps[0].setSequenceOfValuesToEval([-7.,2.,3.,5.,6.])
63 efx.lockPortsForEvaluation(inps,outps)
65 rss=efx.giveResources()
66 rss[0][0].setWantedMachine("athos")
67 cp=rss.getAddParamsForCluster() ; cp.setRemoteWorkingDir(os.path.join("/scratch",getpass.getuser(),"TMP3")) ; cp.setLocalWorkingDir(os.path.join(os.path.expanduser("~"),"TMP52"))
68 cp.setWCKey("P11U50:CARBONES") ; cp.setNbProcs(5) ; cp.setMaxDuration("00:05")
69 assert(not rss.isInteractive())
71 print("************",a,b)
72 print efx.getResults()