From: Anthony Geay Date: Fri, 11 Mar 2016 17:09:50 +0000 (+0100) Subject: First use case using cluster with evalyfx OK (ze test) X-Git-Tag: V7_8_0a2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3705f7d8359df567541852b554e99d5d3f94acf8;p=modules%2Fyacs.git First use case using cluster with evalyfx OK (ze test) --- diff --git a/src/evalyfx_swig/test3.py b/src/evalyfx_swig/test3.py new file mode 100644 index 000000000..82e087de6 --- /dev/null +++ b/src/evalyfx_swig/test3.py @@ -0,0 +1,53 @@ +# first test using cluster + +import os,getpass + +CatalogResources=""" + + + +""" + +def buildScheme(fname): + import SALOMERuntime + import loader + SALOMERuntime.RuntimeSALOME.setRuntime() + r=SALOMERuntime.getSALOMERuntime() + p0=r.createProc("run") + # + p=r.createBloc("toto") + p0.edAddChild(p) + # + cont=p0.createContainer("MyWonderfulContainer","Salome") + td=p0.createType("double","double") + n0=r.createScriptNode("Salome","PyScript0") + p.edAddChild(n0) + q=n0.edAddInputPort("q",td) + ep=n0.edAddOutputPort("ep",td) + n0.setScript("ep=1./(4.-q)") # <- force division by 0 + n0.setExecutionMode("remote") + n0.setContainer(cont) + p0.saveSchema(fname) + pass + +fname="test3.xml" +import evalyfx +session=evalyfx.YACSEvalSession() +session.launch() +buildScheme(fname) +efx=evalyfx.YACSEvalYFX.BuildFromFile(fname) +efx.getParams().setStopASAPAfterErrorStatus(False) +inps=efx.getFreeInputPorts() +assert(len(inps)==1) +outps=efx.getFreeOutputPorts() +inps[0].setSequenceOfValuesToEval([-7.,2.,3.,5.,6.]) +efx.lockPortsForEvaluation(inps,outps) +# +rss=efx.giveResources() +rss[0][0].setWantedMachine("athos") +cp=rss.getAddParamsForCluster() ; cp.setRemoteWorkingDir(os.path.join("/scratch",getpass.getuser(),"TMP3")) ; cp.setLocalWorkingDir(os.path.join(os.path.expanduser("~"),"TMP52")) +cp.setWCKey("P11U50:CARBONES") ; cp.setNbProcs(5) ; cp.setMaxDuration("00:05") +assert(not rss.isInteractive()) +a,b=efx.run(session) +print("************",a,b) +print efx.getResults()