Salome HOME
[EDF12520] : Access of all resources in resource manager
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Mar 2017 12:09:32 +0000 (13:09 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Mar 2017 12:09:32 +0000 (13:09 +0100)
idl/SALOME_ResourcesManager.idl
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx

index c0acc59600fcc67f88a69a35e521f6d9baa74b4a..4884233bd0c5aa71abe28f49d96eeb585b4d2699 100644 (file)
@@ -35,7 +35,8 @@ module Engines
 typedef sequence<string> ResourceList;
 //! components list
 typedef sequence<string> CompoList;
-
+typedef sequence<long> 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);
 };
 
 };
index 2b81a3477291a2c4434b3dc883fc6ff36e97c5b9..8b09d8bddb515e489e9d9f2044d59e0bf5fbd969 100644 (file)
@@ -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<std::string> ret0(sz);
+  std::vector<int> 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<sz;j++)
+    {
+      (*machines)[j]=CORBA::string_dup(ret0[j].c_str());
+      (*nbProcsOfMachines)[j]=ret1[j];
+    }
+}
+
 //=============================================================================
 //! get the name of resources fitting the specified constraints (params)
 /*!
index 9cc2cee08949f7b1d6a07bdce788ef7e48384bbe..d01ff4a8a146d3f0ff6636bb3dc6d9ede603311f 100644 (file)
@@ -72,7 +72,7 @@ class SALOMERESOURCESMANAGER_EXPORT SALOME_ResourcesManager:
     char* getMachineFile(const char * resource_name,
                          CORBA::Long nb_procs,
                          const char * parallelLib);
-
+    void ListAllAvailableResources(Engines::ResourceList_out machines, Engines::IntegerList_out nbProcsOfMachines);
     // Cpp Methods
     void Shutdown();
     ResourcesManager_cpp *GetImpl() { return &_rm; }