From: Konstantin Leontev Date: Fri, 28 Jul 2023 14:16:43 +0000 (+0100) Subject: [bos #35138][EDF] (2023-T1) Specialization of resources in KERNEL. Now using separate... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=59d18a768b1065e00eac61f38d67f6dc12108fd6;p=tools%2Fydefx.git [bos #35138][EDF] (2023-T1) Specialization of resources in KERNEL. Now using separated job and container resource types. --- diff --git a/src/pydefx/configuration.py b/src/pydefx/configuration.py index 864fec4..48c5f57 100644 --- a/src/pydefx/configuration.py +++ b/src/pydefx/configuration.py @@ -25,7 +25,7 @@ import json def defaultWorkingDir(resource): resManager = salome_proxy.getResourcesManager() - resource_definition = resManager.GetResourceDefinition(resource) + resource_definition = resManager.GetResourceDefinitionJob(resource) return resource_definition.working_directory def defaultNbBranches(resource): @@ -33,7 +33,7 @@ def defaultNbBranches(resource): Return the number of cores available on a resource. """ resManager = salome_proxy.getResourcesManager() - resource_definition = resManager.GetResourceDefinition(resource) + resource_definition = resManager.GetResourceDefinitionContainer(resource) ret = resource_definition.nb_node * resource_definition.nb_proc_per_node if ret < 1: ret = 1 @@ -45,9 +45,7 @@ def allCoresAvailable(): ( "canRunContainers" attribute set to true in CatalogResources.xml ) """ resManager = salome_proxy.getResourcesManager() - params = salome_proxy.createSalomeParameters() - params.resource_required.can_run_containers = True - resources = resManager.GetFittingResources(params.resource_required) + resources = resManager.ListAllResourcesInCatalogContainer() return sum([defaultNbBranches(res) for res in resources ]) def defaultBaseDirectory(): @@ -73,11 +71,7 @@ def availableResources(): Ydefx can launch the evaluations in a job on one of these resources. """ resManager = salome_proxy.getResourcesManager() - params = salome_proxy.createSalomeParameters() - params.resource_required.can_launch_batch_jobs = True - # GetFittingResources returns a tuple if in no salome session mode. - # Force to list for uniformity between the two modes. - return list(resManager.GetFittingResources(params.resource_required)) + return resManager.ListAllResourcesInCatalogJob() def exportConfig(dicconfig, directory = None): """ Save the configuration to a directory. diff --git a/src/pydefx/parameters.py b/src/pydefx/parameters.py index 724f5eb..e2734bc 100644 --- a/src/pydefx/parameters.py +++ b/src/pydefx/parameters.py @@ -86,8 +86,6 @@ class Parameters: #newobj.salome_parameters.specific_parameters = self.salome_parameters.specific_parameters newobj.salome_parameters.resource_required.name = self.salome_parameters.resource_required.name newobj.salome_parameters.resource_required.hostname = self.salome_parameters.resource_required.hostname - newobj.salome_parameters.resource_required.can_launch_batch_jobs = self.salome_parameters.resource_required.can_launch_batch_jobs - newobj.salome_parameters.resource_required.can_run_containers = self.salome_parameters.resource_required.can_run_containers newobj.salome_parameters.resource_required.OS = self.salome_parameters.resource_required.OS newobj.salome_parameters.resource_required.nb_proc = self.salome_parameters.resource_required.nb_proc newobj.salome_parameters.resource_required.mem_mb = self.salome_parameters.resource_required.mem_mb @@ -124,8 +122,6 @@ class Parameters: "resource_required" : { "name" : self.salome_parameters.resource_required.name, "hostname" : self.salome_parameters.resource_required.hostname, - "can_launch_batch_jobs" : self.salome_parameters.resource_required.can_launch_batch_jobs, - "can_run_containers" : self.salome_parameters.resource_required.can_run_containers, "OS" : self.salome_parameters.resource_required.OS, "nb_proc" : self.salome_parameters.resource_required.nb_proc, "mem_mb" : self.salome_parameters.resource_required.mem_mb, @@ -159,8 +155,6 @@ class Parameters: self.salome_parameters.extra_params = dico["salome_parameters"]["extra_params"] self.salome_parameters.resource_required.name = dico["salome_parameters"]["resource_required"]["name"] self.salome_parameters.resource_required.hostname = dico["salome_parameters"]["resource_required"]["hostname"] - self.salome_parameters.resource_required.can_launch_batch_jobs = dico["salome_parameters"]["resource_required"]["can_launch_batch_jobs"] - self.salome_parameters.resource_required.can_run_containers = dico["salome_parameters"]["resource_required"]["can_run_containers"] self.salome_parameters.resource_required.OS = dico["salome_parameters"]["resource_required"]["OS"] self.salome_parameters.resource_required.nb_proc = dico["salome_parameters"]["resource_required"]["nb_proc"] self.salome_parameters.resource_required.mem_mb = dico["salome_parameters"]["resource_required"]["mem_mb"] diff --git a/src/pydefx/salome_proxy.py b/src/pydefx/salome_proxy.py index a117bbb..dca0e41 100644 --- a/src/pydefx/salome_proxy.py +++ b/src/pydefx/salome_proxy.py @@ -27,7 +27,7 @@ def createSalomeParameters(): _default() if _use_salome_servers: result = salome.JobParameters() - result.resource_required = salome.ResourceParameters() + result.resource_required = salome.ResourceParametersContainer() else: result = pylauncher.JobParameters_cpp() return result