this->_delta_time_ns_lookup_in_ms = timeInMS;
}
-/*!
- * Launch a this->_orb->run() in order to respond to CORBA requests from the outside.
- */
-void SALOME_ContainerManager::MakeThisProcessAServer()
-{
- if(_server_thread_launched)
- {
- THROW_SALOME_CORBA_EXCEPTION("orb.run() thread has already been launched. You are not supposed to launch it more than once",SALOME::BAD_PARAM);
- }
- _server_thread_launched = true;
- auto ORBRunLauncher = [](CORBA::ORB_var orb) { MESSAGE("[SALOME_ContainerManager::MakeThisProcessAServer] ORB is running in a thread ...."); orb->run(); };
- std::thread t(ORBRunLauncher,this->_orb);
- t.detach();
-}
-
//=============================================================================
//! Loop on all the containers listed in naming service, ask shutdown on each
/*! CORBA Method:
void SetDeltaTimeBetweenNSLookupAtLaunchTimeInMilliSecond(CORBA::Long timeInMS) override;
- void MakeThisProcessAServer();
-
static const char *_ContainerManagerNameInNS;
protected:
std::vector< std::pair<std::string, std::string> > _override_env;
int _time_out_in_second;
int _delta_time_ns_lookup_in_ms;
- bool _server_thread_launched = false;
};
#endif
ResourcesManager_cpp(const char *xmlFilePath);
std::vector<std::string> GetFittingResources(const resourceParams& params);
void WriteInXmlFile(std::string xml_file);
-
+ void DeleteAllResourcesInCatalog();
%extend
{
ResourceDefinition_cpp GetResourceDefinition(const std::string& name)
def ResourcesManager_cpp_GetList(self):
return {name:self.GetResourceDefinition(name) for name in self.GetListOfEntries()}
+def ResourcesManager_cpp___getitem__(self,name):
+ return self.GetResourceDefinition(name)
+
+def ResourcesManager_cpp___repr__(self):
+ return str( self.GetList() )
+
+def RetrieveRMCppSingleton():
+ import KernelLauncher
+ return HandleToLocalInstance( KernelLauncher.RetrieveInternalInstanceOfLocalCppResourcesManager() )
+
+def GetPlayGroundInsideASlurmJob():
+ import subprocess as sp
+ cont = sp.check_output(["srun","hostname"])
+ nodesMul = [elt for elt in cont.decode().split("\n") if elt != ""]
+ from collections import defaultdict
+ d = defaultdict(int)
+ for elt in nodesMul:
+ d[elt]+=1
+ return d
+
+def BuildCatalogFromScratch(protocol):
+ import os
+ d = GetPlayGroundInsideASlurmJob()
+ rmcpp = RetrieveRMCppSingleton()
+ rmcpp.DeleteAllResourcesInCatalog()
+ for k,v in d.items():
+ contRes = CreateContainerResource(hostname=k,applipath=os.environ["APPLI"],protocol=protocol,nbOfNodes=v)
+ rmcpp.AddResourceInCatalog(contRes)
ResourceDefinition_cpp.repr = ResourceDefinition_cpp_repr
ResourceDefinition_cpp.__repr__ = ResourceDefinition_cpp_repr
ResourcesManager_cpp.GetList = ResourcesManager_cpp_GetList
-
+ResourcesManager_cpp.__getitem__ = ResourcesManager_cpp___getitem__
+ResourcesManager_cpp.__repr__ = ResourcesManager_cpp___repr__
%}