+std::vector< std::pair<std::string,int> > RuntimeSALOME::getCatalogOfComputeNodes() const
+{
+ CORBA::ORB_ptr orb(getOrb());
+ SALOME_NamingService namingService;
+ try
+ {
+ namingService.init_orb(orb);
+ }
+ catch(SALOME_Exception& e)
+ {
+ throw Exception("RuntimeSALOME::getCatalogOfComputeNodes : Unable to contact the SALOME Naming Service");
+ }
+ CORBA::Object_var obj(namingService.Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS));
+ if(CORBA::is_nil(obj))
+ throw Exception("RuntimeSALOME::getCatalogOfComputeNodes : Unable to access to the resource manager !");
+ Engines::ResourcesManager_var resManager(Engines::ResourcesManager::_narrow(obj));
+ if(CORBA::is_nil(resManager))
+ throw Exception("RuntimeSALOME::getCatalogOfComputeNodes : Internal error ! The entry attached to the res manager in NS does not have right type !");
+ std::vector< std::pair<std::string,int> > ret;
+ Engines::ResourceParameters params;
+ params.name = "";
+ params.hostname = "";
+ params.OS = "";
+ params.nb_proc = 0;
+ params.mem_mb = 0;
+ params.cpu_clock = 0;
+ params.nb_node = 0;
+ params.nb_proc_per_node = 0;
+ params.policy = "";
+ params.can_launch_batch_jobs = false;
+ params.can_run_containers = true;
+ params.componentList.length(0);
+ try
+ {
+ Engines::ResourceList_var resourceList;
+ resourceList = resManager->GetFittingResources(params);
+ ret.reserve(resourceList->length());
+ for(int i = 0; i<resourceList->length(); i++)
+ {
+ const char* resource_name = resourceList[i];
+ std::string std_resource_name = resource_name;
+ Engines::ResourceDefinition_var resource_definition
+ = resManager->GetResourceDefinition(resource_name);
+ int nb_cores = resource_definition->nb_node *
+ resource_definition->nb_proc_per_node;
+ ret.push_back(std::pair<std::string,int>(resource_name, nb_cores));
+ }
+ }
+ catch(SALOME::SALOME_Exception& e)
+ {
+ std::string message;
+ message=e.details.text.in();
+ throw Exception(message);
+ }
+
+ return ret;
+}
+