From a8808968a676c9557bed09a722e1056bb9d056d7 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 6 Jan 2023 09:55:51 +0100 Subject: [PATCH] WIP --- src/pydefx/mpmcn.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/pydefx/mpmcn.py b/src/pydefx/mpmcn.py index 1232c49..b6a9569 100644 --- a/src/pydefx/mpmcn.py +++ b/src/pydefx/mpmcn.py @@ -19,6 +19,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com import pydefx +import salome +salome.salome_init() myParams = None @@ -62,23 +64,21 @@ def _exec({}): self.myScript.loadString(pyScript) self.mySample = self.myScript.CreateEmptySample() # - #print(fArgs) - #print(iterable) - # if not hasattr(iterable[0],"__iter__"): iterable = [[elt] for elt in iterable] # - #print(pyScript) - #print({k:v for k,*v in zip(fArgs,*iterable)}) - # self.mySample.setInputValues( {k:v for k,*v in zip(fArgs,*iterable)} ) # self.myStudy.createNewJob(self.myScript, self.mySample, myParams) # self.myStudy.launch() self.myStudy.wait() + self.myStudy.getResult() # - return self.myStudy.getResult() + ret = [elt for elt in zip(*[self.myStudy.sample._output[n] for n in self.myStudy.sample.getOutputNames()])] + if len(self.myStudy.sample.getOutputNames()) == 1: + ret = [elt[0] for elt in ret] + return ret def __enter__(self): self.myStudy = pydefx.PyStudy() @@ -88,6 +88,18 @@ def _exec({}): pass pass +def getResourcesAbleToLaunchJobs(): + """ + Regarding list of Resources in the CatalogResources.xml this method returns those able to launch jobs. + Ydefx engine delegate to a job encapsulating itself an execution of YACS graph with driver application. + Consequently, the resource to evaluate in parallel the function should one of those returned by this method. + """ + import LifeCycleCORBA + params = LifeCycleCORBA.ResourceParameters(can_launch_batch_jobs=True) + # ask to resource manager to filter among all resources listed in CatalogResources those able to launch job. + return salome.rm.GetFittingResources(params) + + def init(resultDirectory = "/tmp"): """ :param resourceName: Name of the resource matching one of the ${KERNEL_ROOT_DIR}/share/salome/resources/kernel/CatalogResources.xml @@ -95,7 +107,16 @@ def init(resultDirectory = "/tmp"): """ global myParams myParams = pydefx.Parameters() + + # pour cluster avec 10 noeuds de 28 coeurs chacuns + # + + # On positionne la resource qui va lancer le job qui inclu drive + # rmyParams.nb_branches = 4 myParams.configureResource("localhost") myParams.createResultDirectory(resultDirectory) + myParams.nb_branches = 280 + myParams.salome_parameters. + # myParams.salome_parameters.work_directory = wd pass -- 2.39.2