From 369d63b2674391c5d8ff6773e7a07d61b40e56ad Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 13 Mar 2017 13:09:32 +0100 Subject: [PATCH] [EDF12520] : Access of all resources in resource manager --- idl/SALOME_ResourcesManager.idl | 6 +++- .../SALOME_ResourcesManager.cxx | 29 +++++++++++++++++++ .../SALOME_ResourcesManager.hxx | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/idl/SALOME_ResourcesManager.idl b/idl/SALOME_ResourcesManager.idl index c0acc5960..4884233bd 100644 --- a/idl/SALOME_ResourcesManager.idl +++ b/idl/SALOME_ResourcesManager.idl @@ -35,7 +35,8 @@ module Engines typedef sequence ResourceList; //! components list typedef sequence CompoList; - +typedef sequence IntegerList; + //! Type to describe required properties of a resource struct ResourceParameters { @@ -189,6 +190,9 @@ interface ResourcesManager //! Create a machine file for PaCO container string getMachineFile(in string resource_name, in long nb_procs, in string parallelLib) raises (SALOME::SALOME_Exception); + + //! Return list of resources available (regarding containt of CatalogResources.xml). And for each resource the number of proc available of it. + void ListAllAvailableResources(out ResourceList machines, out IntegerList nbProcsOfMachines) raises (SALOME::SALOME_Exception); }; }; diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 2b81a3477..8b09d8bdd 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -138,6 +138,35 @@ void SALOME_ResourcesManager::Shutdown() _poa->deactivate_object(oid); } +/*! + * Return list of resources available (regarding containt of CatalogResources.xml). And for each resource the number of proc available of it. + */ +void SALOME_ResourcesManager::ListAllAvailableResources(Engines::ResourceList_out machines, Engines::IntegerList_out nbProcsOfMachines) +{ + const MapOfParserResourcesType& zeList(_rm.GetList()); + std::size_t sz(zeList.size()); + std::vector ret0(sz); + std::vector ret1(sz); + { + std::size_t i(0); + for(MapOfParserResourcesType::const_iterator it=zeList.begin();it!=zeList.end();it++,i++) + { + const ParserResourcesType& elt((*it).second); + ret0[i]=elt.HostName; + //ret1[i]=elt.nbOfProc; + ret1[i]=elt.DataForSort._nbOfNodes*elt.DataForSort._nbOfProcPerNode; + } + } + machines=new Engines::ResourceList; + nbProcsOfMachines=new Engines::IntegerList; + machines->length(sz); nbProcsOfMachines->length(sz); + for(std::size_t j=0;j