Salome HOME
updated copyright message
[modules/kernel.git] / src / ResourcesManager / SALOME_ResourcesManager.cxx
index 30a1c1b44eadfb65d220409d7d1aad8dc4a3e868..632a326b651fbe580c212c436365748ea5f9b44f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -46,6 +46,8 @@
 
 #define MAX_SIZE_FOR_HOSTNAME 256;
 
+using namespace std;
+
 const char *SALOME_ResourcesManager::_ResourcesManagerNameInNS = "/ResourcesManager";
 
 //=============================================================================
@@ -54,16 +56,24 @@ const char *SALOME_ResourcesManager::_ResourcesManagerNameInNS = "/ResourcesMana
  */ 
 //=============================================================================
 
-SALOME_ResourcesManager::
-SALOME_ResourcesManager(CORBA::ORB_ptr orb, 
-                        PortableServer::POA_var poa, 
-                        SALOME_NamingService *ns,
-                        const char *xmlFilePath) : _rm(xmlFilePath)
+SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb,
+                                                 PortableServer::POA_var poa,
+                                                 SALOME_NamingService_Abstract *ns,
+                                                 const char *xmlFilePath)
+: _rm(new ResourcesManager_cpp(xmlFilePath))
 {
   MESSAGE("SALOME_ResourcesManager constructor");
   _NS = ns;
   _orb = CORBA::ORB::_duplicate(orb) ;
-  _poa = PortableServer::POA::_duplicate(poa) ;
+  //
+  PortableServer::POAManager_var pman = poa->the_POAManager();
+  CORBA::PolicyList policies;
+  policies.length(1);
+  PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+  policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol);
+  _poa = poa->create_POA("SingleThreadPOA",pman,policies);
+  threadPol->destroy();
+  //
   PortableServer::ObjectId_var id = _poa->activate_object(this);
   CORBA::Object_var obj = _poa->id_to_reference(id);
   Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj);
@@ -84,16 +94,25 @@ SALOME_ResourcesManager(CORBA::ORB_ptr orb,
 
 SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb, 
                                                  PortableServer::POA_var poa, 
-                                                 SALOME_NamingService *ns) : _rm()
+                                                 SALOME_NamingService_Abstract *ns) : _rm(new ResourcesManager_cpp())
 {
   MESSAGE("SALOME_ResourcesManager constructor");
   _NS = ns;
   _orb = CORBA::ORB::_duplicate(orb) ;
-  _poa = PortableServer::POA::_duplicate(poa) ;
+  //
+  PortableServer::POAManager_var pman = poa->the_POAManager();
+  CORBA::PolicyList policies;
+  policies.length(1);
+  PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+  policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol);
+  _poa = poa->create_POA("SingleThreadPOA",pman,policies);
+  threadPol->destroy();
+  //
   PortableServer::ObjectId_var id = _poa->activate_object(this);
   CORBA::Object_var obj = _poa->id_to_reference(id);
   Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj);
-  _NS->Register(refContMan,_ResourcesManagerNameInNS);
+  if(_NS)
+    _NS->Register(refContMan,_ResourcesManagerNameInNS);
 
   MESSAGE("SALOME_ResourcesManager constructor end");
 }
@@ -119,11 +138,63 @@ SALOME_ResourcesManager::~SALOME_ResourcesManager()
 void SALOME_ResourcesManager::Shutdown()
 {
   MESSAGE("Shutdown");
+  if(!_NS)
+    return ;
   _NS->Destroy_Name(_ResourcesManagerNameInNS);
   PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
   _poa->deactivate_object(oid);
 }
 
+/*!
+ * Return list of resources available (regarding content of CatalogResources.xml) but select only those with canRunContainers attribute set to true.
+ * And for each resource the number of proc available of it.
+ * 
+ * \sa SALOME_ResourcesManager::ListAllResourcesInCatalog
+ */
+void SALOME_ResourcesManager::ListAllAvailableResources(Engines::ResourceList_out machines, Engines::IntegerList_out nbProcsOfMachines)
+{
+  const MapOfParserResourcesType& zeList(_rm->GetList());
+  std::vector<std::string> ret0;
+  std::vector<int> ret1;
+  for(MapOfParserResourcesType::const_iterator it=zeList.begin();it!=zeList.end();it++)
+  {
+    const ParserResourcesType& elt((*it).second);
+    if(elt.can_run_containers)
+    {
+      ret0.push_back(elt.HostName);
+      ret1.push_back(elt.DataForSort._nbOfNodes*elt.DataForSort._nbOfProcPerNode);
+    }
+  }
+  machines=new Engines::ResourceList;
+  nbProcsOfMachines=new Engines::IntegerList;
+  std::size_t sz(ret0.size());
+  machines->length((CORBA::ULong)sz); nbProcsOfMachines->length((CORBA::ULong)sz);
+  for(std::size_t j=0;j<sz;j++)
+    {
+      (*machines)[(CORBA::ULong)j]=CORBA::string_dup(ret0[j].c_str());
+      (*nbProcsOfMachines)[(CORBA::ULong)j]=ret1[j];
+    }
+}
+
+/*!
+ * Return list of resources available (regarding content of CatalogResources.xml) whatever canRunContainers attribute value.
+ * 
+ * \sa SALOME_ResourcesManager::ListAllAvailableResources
+ */
+Engines::ResourceList *SALOME_ResourcesManager::ListAllResourcesInCatalog()
+{
+  const MapOfParserResourcesType& zeList(_rm->GetList());
+  auto sz = zeList.size();
+  Engines::ResourceList *ret(new Engines::ResourceList);
+  ret->length( sz );
+  CORBA::ULong i(0);
+  for(auto it : zeList)
+  {
+    (*ret)[i++] = CORBA::string_dup( it.second.HostName.c_str() );
+  }
+  return ret;
+}
+
 //=============================================================================
 //! get the name of resources fitting the specified constraints (params)
 /*!
@@ -141,33 +212,19 @@ void SALOME_ResourcesManager::Shutdown()
 Engines::ResourceList *
 SALOME_ResourcesManager::GetFittingResources(const Engines::ResourceParameters& params)
 {
-  MESSAGE("ResourcesManager::GetFittingResources");
-  Engines::ResourceList * ret = new Engines::ResourceList;
+  //MESSAGE("ResourcesManager::GetFittingResources");
+  Engines::ResourceList_var ret;
 
   // CORBA -> C++
-  resourceParams p;
-  p.name = params.name;
-  p.hostname = params.hostname;
-  p.OS = params.OS;
-  p.nb_proc = params.nb_proc;
-  p.nb_node = params.nb_node;
-  p.nb_proc_per_node = params.nb_proc_per_node;
-  p.cpu_clock = params.cpu_clock;
-  p.mem_mb = params.mem_mb;
-  for(unsigned int i=0; i<params.componentList.length(); i++)
-    p.componentList.push_back(std::string(params.componentList[i]));
-  for(unsigned int i=0; i<params.resList.length(); i++)
-    p.resourceList.push_back(std::string(params.resList[i]));
-  
+  resourceParams p = resourceParameters_CORBAtoCPP(params);
+
   try
   {
     // Call C++ ResourceManager
-    std::vector <std::string> vec = _rm.GetFittingResources(p);
+    std::vector <std::string> vec = _rm->GetFittingResources(p);
 
     // C++ -> CORBA
-    ret->length(vec.size());
-    for(unsigned int i=0;i<vec.size();i++)
-      (*ret)[i] = (vec[i]).c_str();
+    ret = resourceList_CPPtoCORBA(vec);
   }
   catch(const ResourcesException &ex)
   {
@@ -175,7 +232,7 @@ SALOME_ResourcesManager::GetFittingResources(const Engines::ResourceParameters&
     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }  
 
-  return ret;
+  return ret._retn();
 }
 
 //=============================================================================
@@ -188,80 +245,33 @@ char *
 SALOME_ResourcesManager::FindFirst(const Engines::ResourceList& listOfResources)
 {
   // CORBA -> C++
-  std::vector<std::string> rl;
-  for(unsigned int i=0; i<listOfResources.length(); i++)
-    rl.push_back(std::string(listOfResources[i]));
+  std::vector<std::string> rl = resourceList_CORBAtoCPP(listOfResources);
 
-  return CORBA::string_dup(_rm.Find("first", rl).c_str());
+  return CORBA::string_dup(_rm->Find("first", rl).c_str());
 }
 
 char *
 SALOME_ResourcesManager::Find(const char* policy, const Engines::ResourceList& listOfResources)
 {
   // CORBA -> C++
-  std::vector<std::string> rl;
-  for(unsigned int i=0; i<listOfResources.length(); i++)
-    rl.push_back(std::string(listOfResources[i]));
+  std::vector<std::string> rl = resourceList_CORBAtoCPP(listOfResources);
 
-  return CORBA::string_dup(_rm.Find(policy, rl).c_str());
+  return CORBA::string_dup(_rm->Find(policy, rl).c_str());
 }
 
-Engines::ResourceDefinition* 
+Engines::ResourceDefinition*
 SALOME_ResourcesManager::GetResourceDefinition(const char * name)
 {
-  ParserResourcesType resource = _rm.GetResourcesDescr(name);
-  Engines::ResourceDefinition *p_ptr = new Engines::ResourceDefinition;
-
-  p_ptr->name = CORBA::string_dup(resource.Name.c_str());
-  p_ptr->hostname = CORBA::string_dup(resource.HostName.c_str());
-  p_ptr->protocol = ParserResourcesType::protocolToString(resource.Protocol).c_str();
-  p_ptr->iprotocol = ParserResourcesType::protocolToString(resource.ClusterInternalProtocol).c_str();
-  p_ptr->username = CORBA::string_dup(resource.UserName.c_str());
-  p_ptr->applipath = CORBA::string_dup(resource.AppliPath.c_str());
-  p_ptr->componentList.length(resource.ComponentsList.size());
-  for(unsigned int i=0;i<resource.ComponentsList.size();i++)
-    p_ptr->componentList[i] = CORBA::string_dup(resource.ComponentsList[i].c_str());
-  p_ptr->OS = CORBA::string_dup(resource.OS.c_str());
-  p_ptr->mem_mb = resource.DataForSort._memInMB;
-  p_ptr->cpu_clock = resource.DataForSort._CPUFreqMHz;
-  p_ptr->nb_proc_per_node = resource.DataForSort._nbOfProcPerNode;
-  p_ptr->nb_node = resource.DataForSort._nbOfNodes;
-  p_ptr->is_cluster_head = resource.is_cluster_head;
-  p_ptr->working_directory = CORBA::string_dup(resource.working_directory.c_str());
-
-  if( resource.mpi == lam )
-    p_ptr->mpiImpl = "lam";
-  else if( resource.mpi == mpich1 )
-    p_ptr->mpiImpl = "mpich1";
-  else if( resource.mpi == mpich2 )
-    p_ptr->mpiImpl = "mpich2";
-  else if( resource.mpi == openmpi )
-    p_ptr->mpiImpl = "openmpi";
-  else if( resource.mpi == ompi )
-    p_ptr->mpiImpl = "ompi";
-  else if( resource.mpi == slurmmpi )
-    p_ptr->mpiImpl = "slurmmpi";
-  else if( resource.mpi == prun )
-    p_ptr->mpiImpl = "prun";
-
-  if( resource.Batch == pbs )
-    p_ptr->batch = "pbs";
-  else if( resource.Batch == lsf )
-    p_ptr->batch = "lsf";
-  else if( resource.Batch == sge )
-    p_ptr->batch = "sge";
-  else if( resource.Batch == ccc )
-    p_ptr->batch = "ccc";
-  else if( resource.Batch == slurm )
-    p_ptr->batch = "slurm";
-  else if( resource.Batch == ssh_batch )
-    p_ptr->batch = "ssh";
-  else if( resource.Batch == ll )
-    p_ptr->batch = "ll";
-  else if( resource.Batch == vishnu )
-    p_ptr->batch = "vishnu";
-
-  return p_ptr;
+  Engines::ResourceDefinition_var resDef;
+  try {
+    ParserResourcesType resource = _rm->GetResourcesDescr(name);
+    resDef = resourceDefinition_CPPtoCORBA(resource);
+  } catch (const exception & ex) {
+    INFOS("Caught exception in GetResourceDefinition: " << ex.what());
+    THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::BAD_PARAM);
+  }
+
+  return resDef._retn();
 }
 
 void 
@@ -269,118 +279,26 @@ SALOME_ResourcesManager::AddResource(const Engines::ResourceDefinition& new_reso
                                      CORBA::Boolean write,
                                      const char * xml_file)
 {
-  ParserResourcesType resource;
-  resource.Name = new_resource.name.in();
-  resource.HostName = new_resource.hostname.in();
-  resource.OS = new_resource.OS.in();
-  resource.AppliPath = new_resource.applipath.in();
-  resource.DataForSort._memInMB = new_resource.mem_mb;
-  resource.DataForSort._CPUFreqMHz = new_resource.cpu_clock;
-  resource.DataForSort._nbOfNodes = new_resource.nb_node;
-  resource.DataForSort._nbOfProcPerNode = new_resource.nb_proc_per_node;
-  resource.UserName = new_resource.username.in();
-  resource.is_cluster_head = new_resource.is_cluster_head;
-  resource.working_directory = new_resource.working_directory.in();
-
-  std::string aBatch = new_resource.batch.in();
-  if (aBatch == "pbs")
-    resource.Batch = pbs;
-  else if  (aBatch == "lsf")
-    resource.Batch = lsf;
-  else if  (aBatch == "sge")
-    resource.Batch = sge;
-  else if  (aBatch == "slurm")
-    resource.Batch = slurm;
-  else if  (aBatch == "ccc")
-    resource.Batch = ccc;
-  else if  (aBatch == "ssh_batch")
-    resource.Batch = ssh_batch;
-  else if  (aBatch == "ll")
-    resource.Batch = ll;
-  else if  (aBatch == "vishnu")
-    resource.Batch = vishnu;
-  else if (aBatch == "")
-    resource.Batch = none;
-  else {
-    INFOS("Bad Batch definition in AddResource: " << aBatch);
-    std::string message("Bad Batch definition in AddResource: ");
-    message += aBatch;
-    THROW_SALOME_CORBA_EXCEPTION(message.c_str(),SALOME::BAD_PARAM);
-  }
-
-  std::string anMpi = new_resource.mpiImpl.in();
-  if (anMpi == "lam")
-    resource.mpi = lam;
-  else if (anMpi == "mpich1")
-    resource.mpi = mpich1;
-  else if (anMpi == "mpich2")
-    resource.mpi = mpich2;
-  else if (anMpi == "openmpi")
-    resource.mpi = openmpi;
-  else if (anMpi == "ompi")
-    resource.mpi = ompi;
-  else if  (anMpi == "slurmmpi")
-    resource.mpi = slurmmpi;
-  else if  (anMpi == "prun")
-    resource.mpi = prun;
-  else if (anMpi == "")
-    resource.mpi = nompi;
-  else {
-    INFOS("Bad MPI definition in AddResource: " << anMpi);
-    std::string message("Bad MPI definition in AddResource: ");
-    message += anMpi;
-    THROW_SALOME_CORBA_EXCEPTION(message.c_str(),SALOME::BAD_PARAM);
-  }
-
-  std::string mode_str = new_resource.mode.in();
-  if (mode_str == "interactive")
-    resource.Mode = interactive;
-  else if (mode_str == "batch")
-    resource.Mode = batch;
-  else if (mode_str == "")
-    resource.Mode = interactive;
-  else {
-    INFOS("Bad mode definition in AddResource: " << mode_str);
-    std::string message("Bad mode definition in AddResource: ");
-    message += mode_str;
-    THROW_SALOME_CORBA_EXCEPTION(message.c_str(),SALOME::BAD_PARAM);
-  }
-  
-  std::string protocol = new_resource.protocol.in();
   try
   {
-    resource.Protocol = ParserResourcesType::stringToProtocol(protocol);
-  }
-  catch (SALOME_Exception e)
-  {
-    INFOS("Bad protocol definition in AddResource: " << protocol);
-    std::string message("Bad protocol definition in AddResource: ");
-    message += protocol;
-    THROW_SALOME_CORBA_EXCEPTION(message.c_str(),SALOME::BAD_PARAM);
-  }
+    ParserResourcesType resource = resourceDefinition_CORBAtoCPP(new_resource);
+    _rm->AddResourceInCatalog(resource);
 
-  std::string iprotocol = new_resource.iprotocol.in();
-  try
-  {
-    resource.ClusterInternalProtocol = ParserResourcesType::stringToProtocol(iprotocol);
+    if (write)
+    {
+      _rm->WriteInXmlFile(std::string(xml_file));
+      _rm->ParseXmlFiles();
+    }
   }
-  catch (SALOME_Exception e)
+  catch (const SALOME_Exception & e)
   {
-    INFOS("Bad iprotocol definition in AddResource: " << iprotocol);
-    std::string message("Bad iprotocol definition in AddResource: ");
-    message += iprotocol;
-    THROW_SALOME_CORBA_EXCEPTION(message.c_str(),SALOME::BAD_PARAM);
+    INFOS("Error in AddResourceInCatalog: " << e);
+    THROW_SALOME_CORBA_EXCEPTION(e.what(), SALOME::BAD_PARAM);
   }
-
-  for (CORBA::ULong i = 0; i < new_resource.componentList.length(); i++)
-    resource.ComponentsList.push_back(new_resource.componentList[i].in());
-
-  _rm.AddResourceInCatalog(resource);
-
-  if (write)
+  catch (const ResourcesException & e)
   {
-    _rm.WriteInXmlFile(std::string(xml_file));
-    _rm.ParseXmlFiles();
+    INFOS("Error in AddResourceInCatalog: " << e.msg);
+    THROW_SALOME_CORBA_EXCEPTION(e.msg.c_str(), SALOME::BAD_PARAM);
   }
 }
 
@@ -389,34 +307,43 @@ SALOME_ResourcesManager::RemoveResource(const char * resource_name,
                                         CORBA::Boolean write,
                                         const char * xml_file)
 {
-  _rm.DeleteResourceInCatalog(resource_name);
+  try
+  {
+    _rm->DeleteResourceInCatalog(resource_name);
+  }
+  catch (const SALOME_Exception & e)
+  {
+    INFOS("Error in DeleteResourceInCatalog: " << e);
+    THROW_SALOME_CORBA_EXCEPTION(e.what(), SALOME::BAD_PARAM);
+  }
+
   if (write)
   {
-    _rm.WriteInXmlFile(std::string(xml_file));
-    _rm.ParseXmlFiles();
+    _rm->WriteInXmlFile(std::string(xml_file));
+    _rm->ParseXmlFiles();
   }
 }
 
-std::string 
-SALOME_ResourcesManager::getMachineFile(std::string resource_name, 
+char *
+SALOME_ResourcesManager::getMachineFile(const char * resource_name,
                                         CORBA::Long nb_procs, 
-                                        std::string parallelLib)
+                                        const char * parallelLib)
 {
   std::string machine_file_name("");
 
-  if (parallelLib == "Dummy")
+  if (std::string(parallelLib) == "Dummy")
   {
     MESSAGE("[getMachineFile] parallelLib is Dummy");
-    MapOfParserResourcesType resourcesList = _rm.GetList();
-    if (resourcesList.find(resource_name) != resourcesList.end())
+    MapOfParserResourcesType resourcesList = _rm->GetList();
+    if (resourcesList.find(std::string(resource_name)) != resourcesList.end())
     {
-      ParserResourcesType resource = resourcesList[resource_name];
+      ParserResourcesType resource = resourcesList[std::string(resource_name)];
 
       // Check if resource is cluster or not
       if (resource.ClusterMembersList.empty())
       {
         //It is not a cluster so we create a cluster with one machine
-        ParserResourcesClusterMembersType fake_node;
+        ParserResourcesType fake_node;
         fake_node.HostName = resource.HostName;
         fake_node.Protocol = resource.Protocol;
         fake_node.ClusterInternalProtocol = resource.ClusterInternalProtocol;
@@ -429,7 +356,7 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name,
 
       // Creating list of machines for creating the machine file
       std::list<std::string> list_of_machines;
-      std::list<ParserResourcesClusterMembersType>::iterator cluster_it = 
+      std::list<ParserResourcesType>::iterator cluster_it =
         resource.ClusterMembersList.begin();
       while (cluster_it != resource.ClusterMembersList.end())
       {
@@ -462,19 +389,19 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name,
     else
       INFOS("[getMachineFile] Error resource_name not found in resourcesList -> " << resource_name);
   }
-  else if (parallelLib == "Mpi")
+  else if (std::string(parallelLib) == "Mpi")
   {
     MESSAGE("[getMachineFile] parallelLib is Mpi");
 
-    MapOfParserResourcesType resourcesList = _rm.GetList();
-    if (resourcesList.find(resource_name) != resourcesList.end())
+    MapOfParserResourcesType resourcesList = _rm->GetList();
+    if (resourcesList.find(std::string(resource_name)) != resourcesList.end())
     {
-      ParserResourcesType resource = resourcesList[resource_name];
+      ParserResourcesType resource = resourcesList[std::string(resource_name)];
       // Check if resource is cluster or not
       if (resource.ClusterMembersList.empty())
       {
         //It is not a cluster so we create a cluster with one machine
-        ParserResourcesClusterMembersType fake_node;
+        ParserResourcesType fake_node;
         fake_node.HostName = resource.HostName;
         fake_node.Protocol = resource.Protocol;
         fake_node.ClusterInternalProtocol = resource.ClusterInternalProtocol;
@@ -493,7 +420,7 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name,
         std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
 
         // We add all cluster machines to the file
-        std::list<ParserResourcesClusterMembersType>::iterator cluster_it = 
+        std::list<ParserResourcesType>::iterator cluster_it =
           resource.ClusterMembersList.begin();
         while (cluster_it != resource.ClusterMembersList.end())
         {
@@ -510,7 +437,7 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name,
         std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
 
         // We add all cluster machines to the file
-        std::list<ParserResourcesClusterMembersType>::iterator cluster_it =
+        std::list<ParserResourcesType>::iterator cluster_it =
           resource.ClusterMembersList.begin();
         while (cluster_it != resource.ClusterMembersList.end())
         {
@@ -525,7 +452,7 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name,
         INFOS("[getMachineFile] Error resource_name MPI implementation was defined for " << resource_name);
       }
       else
-        INFOS("[getMachineFile] Error resource_name MPI implementation not currenly handled for " << resource_name);
+        INFOS("[getMachineFile] Error resource_name MPI implementation not currently handled for " << resource_name);
     }
     else
       INFOS("[getMachineFile] Error resource_name not found in resourcesList -> " << resource_name);
@@ -533,5 +460,5 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name,
   else
     INFOS("[getMachineFile] Error parallelLib is not handled -> " << parallelLib);
 
-  return machine_file_name;
+  return CORBA::string_dup(machine_file_name.c_str());
 }