]> SALOME platform Git repositories - tools/ydefx.git/commitdiff
Salome HOME
[bos #35138][EDF] (2023-T1) Specialization of resources in KERNEL. Now using separate...
authorKonstantin Leontev <Konstantin.LEONTEV@opencascade.com>
Fri, 28 Jul 2023 14:16:43 +0000 (15:16 +0100)
committerKonstantin Leontev <Konstantin.LEONTEV@opencascade.com>
Fri, 28 Jul 2023 14:16:43 +0000 (15:16 +0100)
src/pydefx/configuration.py
src/pydefx/parameters.py
src/pydefx/salome_proxy.py

index 864fec4a9e2f8fa53391d01a5135e9c30665ef9a..48c5f5740953093232279c8115bbbe5644b776b4 100644 (file)
@@ -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.
index 724f5eb08f2339995d3ca2218589879a48b26c23..e2734bc4dbec36b187d79844ca4ce2901244e582 100644 (file)
@@ -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"]
index a117bbb496b960e94df5dfcda2a394070841fe04..dca0e4185a5a94536f3aa60ce21f385abb3f7956 100644 (file)
@@ -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