//! modules list
typedef sequence<string> ModulesList;
-//! Type to describe properties of a resource.
+//! Type to describe required properties of a container.
struct MachineParameters
{
+ //! container name if given else automatic
string container_name;
+ //! host name if given else automatic
string hostname;
+ //! if given alias name to use ??
string alias;
+ //! protocol to use to start a remote container (ssh or rsh)
string protocol;
+ //! login name to use to start a remote container
string username;
+ //! salome application to use to start a remote container
string applipath;
ModulesList modList;
string OS;
+ //! required memory size
long mem_mb;
+ //! required frequency
long cpu_clock;
+ //! required number of proc per node
long nb_proc_per_node;
+ //! required number of node
long nb_node;
+ //! if true start a MPI container ??
boolean isMPI;
+ //! required MPI implementation to use
string mpiImpl;
+ //! required batch system to use
string batch;
+ //! container working directory
string workingdir;
// PaCO specific informations
long nb_component_nodes;
};
+//! Type to describe properties of a resource.
+struct MachineDefinition
+{
+ //! host name
+ string hostname;
+ string alias;
+ //! protocol to use to start a remote container (ssh or rsh)
+ string protocol;
+ //! login name to use to start a remote container
+ string username;
+ //! salome application to use to start a remote container
+ string applipath;
+ //! list of available components
+ CompoList componentList;
+ //! operating system
+ string OS;
+ //! memory size
+ long mem_mb;
+ //! frequency
+ long cpu_clock;
+ //! number of proc per node
+ long nb_proc_per_node;
+ //! number of node
+ long nb_node;
+ //! MPI implementation
+ string mpiImpl;
+ //! batch system
+ string batch;
+ long nb_component_nodes;
+};
//! exception thrown if a computer is not found in the catalog
exception NotFound {};
raises (SALOME::SALOME_Exception);
//! Get the current machine parameters of a computer
- MachineParameters GetMachineParameters( in string hostname );
+ MachineDefinition GetMachineParameters( in string hostname );
} ;
};
#ifdef WIN32
# include <io.h>
#endif
-BatchTest::BatchTest(const Engines::MachineParameters& batch_descr)
+BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr)
{
_batch_descr = batch_descr;
class SALOMELAUNCHER_EXPORT BatchTest
{
public:
- BatchTest(const Engines::MachineParameters& batch_descr);
+ BatchTest(const Engines::MachineDefinition& batch_descr);
virtual ~BatchTest();
bool test();
std::string get_home(std::string * home);
private:
- Engines::MachineParameters _batch_descr;
+ Engines::MachineDefinition _batch_descr;
std::string _test_filename;
std::string _base_filename;
std::string _date;
_ResManager->Shutdown();
PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
_poa->deactivate_object(oid);
- //_remove_ref();
if(!CORBA::is_nil(_orb))
_orb->shutdown(0);
}
if (aMachineList->length() == 0)
throw SALOME_Exception("No resources have been found with your parameters");
- const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
+ const Engines::MachineDefinition* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
string clustername(p->alias);
INFOS("Choose cluster" << clustername);
int nbpmax;
for(std::map<std::string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
if(strcmp((*iter).first.c_str(),"localhost")!=0){
- Engines::MachineParameters *p = _ResManager->GetMachineParameters((*iter).first.c_str());
+ Engines::MachineDefinition *p = _ResManager->GetMachineParameters((*iter).first.c_str());
int nbproc = p->nb_node * p->nb_proc_per_node;
if(cycle[(*iter).first]/nbproc<cmin) cmin=cycle[(*iter).first]/nbproc;
if(cycle[(*iter).first]/nbproc>cmax) cmax=cycle[(*iter).first]/nbproc;
//=============================================================================
/*!
- * get the list of name of ressources fitting for the specified module.
+ * get the list of name of ressources fitting for the specified component.
* If hostname specified, check it is local or known in resources catalog.
*
* Else
* - select first machines with corresponding OS (all machines if
* parameter OS empty),
- * - then select the sublist of machines on witch the module is known
+ * - then select the sublist of machines on witch the component is known
* (if the result is empty, that probably means that the inventory of
- * modules is probably not done, so give complete list from previous step)
+ * components is probably not done, so give complete list from previous step)
*/
//=============================================================================
// --- Search for available resources sorted by priority
SelectOnlyResourcesWithOS(vec, params.OS.c_str());
- KeepOnlyResourcesWithModule(vec, componentList);
+ KeepOnlyResourcesWithComponent(vec, componentList);
if (vec.size() == 0)
SelectOnlyResourcesWithOS(vec, params.OS.c_str());
//=============================================================================
/*!
* add an entry in the ressources catalog xml file.
- * Return 0 if OK (KERNEL found in new resources modules) else throw exception
+ * Return 0 if OK (KERNEL found in new resources components) else throw exception
*/
//=============================================================================
int
ResourcesManager_cpp::
AddResourceInCatalog(const machineParams& paramsOfNewResources,
- const vector<string>& modulesOnNewResources,
+ const vector<string>& componentsOnNewResources,
const char *alias,
const char *userName,
AccessModeType mode,
AccessProtocolType prot)
throw(ResourcesException)
{
- vector<string>::const_iterator iter = find(modulesOnNewResources.begin(),
- modulesOnNewResources.end(),
+ vector<string>::const_iterator iter = find(componentsOnNewResources.begin(),
+ componentsOnNewResources.end(),
"KERNEL");
- if (iter != modulesOnNewResources.end())
+ if (iter != componentsOnNewResources.end())
{
ParserResourcesType newElt;
newElt.DataForSort._hostName = paramsOfNewResources.hostname;
newElt.Protocol = prot;
newElt.Mode = mode;
newElt.UserName = userName;
- newElt.ModulesList = modulesOnNewResources;
+ newElt.ComponentsList = componentsOnNewResources;
newElt.OS = paramsOfNewResources.OS;
newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb;
newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock;
//=============================================================================
const MapOfParserResourcesType& ResourcesManager_cpp::GetList() const
- {
- return _resourcesList;
- }
+{
+ return _resourcesList;
+}
//=============================================================================
//=============================================================================
/*!
- * Gives a sublist of machines on which the module is known.
+ * Gives a sublist of machines on which the component is known.
*/
//=============================================================================
//Warning need an updated parsed list : _resourcesList
-void ResourcesManager_cpp::KeepOnlyResourcesWithModule( vector<string>& hosts, const vector<string>& componentList) const
+void ResourcesManager_cpp::KeepOnlyResourcesWithComponent( vector<string>& hosts, const vector<string>& componentList) const
throw(ResourcesException)
{
for (vector<string>::iterator iter = hosts.begin(); iter != hosts.end();)
{
MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
- const vector<string>& mapOfModulesOfCurrentHost = (((*it).second).ModulesList);
+ const vector<string>& mapOfComponentsOfCurrentHost = (((*it).second).ComponentsList);
bool erasedHost = false;
- if( mapOfModulesOfCurrentHost.size() > 0 ){
+ if( mapOfComponentsOfCurrentHost.size() > 0 ){
for(unsigned int i=0;i<componentList.size();i++){
const char* compoi = componentList[i].c_str();
- vector<string>::const_iterator itt = find(mapOfModulesOfCurrentHost.begin(),
- mapOfModulesOfCurrentHost.end(),
+ vector<string>::const_iterator itt = find(mapOfComponentsOfCurrentHost.begin(),
+ mapOfComponentsOfCurrentHost.end(),
compoi);
// componentList[i]);
- if (itt == mapOfModulesOfCurrentHost.end()){
+ if (itt == mapOfComponentsOfCurrentHost.end()){
erasedHost = true;
break;
}
int AddResourceInCatalog
(const machineParams& paramsOfNewResources,
- const std::vector<std::string>& modulesOnNewResources,
+ const std::vector<std::string>& componentsOnNewResources,
const char *alias,
const char *userName,
AccessModeType mode,
const char *OS) const
throw(ResourcesException);
- void KeepOnlyResourcesWithModule(std::vector<std::string>& hosts,
+ void KeepOnlyResourcesWithComponent(std::vector<std::string>& hosts,
const std::vector<std::string>& componentList) const
throw(ResourcesException);
test_appli_path = "appliPath";
test_modules = "modules";
test_module_name = "moduleName";
+ test_components = "component";
+ test_component_name = "name";
test_os = "OS";
test_mem_in_mb = "memInMB";
test_cpu_freq_mhz = "CPUFreqMHz";
xmlFree(nb_of_proc_per_node);
}
- // Process modules
+ // Process components
xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode;
while(aCurSubNode != NULL)
{
- if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
+ if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
{
+ //If a component is given, it is in a module with the same name
+ //except if the module name is given
+ if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
+ {
+ xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
+ std::string aComponentName = (const char*)component_name;
+ _resource.ComponentsList.push_back(aComponentName);
+ if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
+ {
+ xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
+ std::string aModuleName = (const char*)module_name;
+ _resource.ModulesList.push_back(aModuleName);
+ xmlFree(module_name);
+ }
+ else
+ _resource.ModulesList.push_back(aComponentName);
+ xmlFree(component_name);
+ }
+ }
+ else if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
+ {
+ // If a module is given, we create an entry in componentsList and modulesList
+ // with the same name (module == component)
if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
{
- xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
- std::string aModuleName = (const char*)module_name;
- _resource.ModulesList.push_back(aModuleName);
- xmlFree(module_name);
+ xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
+ std::string aComponentName = (const char*)component_name;
+ _resource.ComponentsList.push_back(aComponentName);
+ _resource.ModulesList.push_back(aComponentName);
+ xmlFree(component_name);
}
}
aCurSubNode = aCurSubNode->next;
}
else
{
- _resources_list[_resource.HostName] = _resource;
if(_resource.HostName == "localhost")
{
_resource.HostName = Kernel_Utils::GetHostname();
_resource.DataForSort._hostName = Kernel_Utils::GetHostname();
_resources_list[Kernel_Utils::GetHostname()] = _resource;
}
+ else
+ _resources_list[_resource.HostName] = _resource;
}
}
else
xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
for (vector<string>::const_iterator iter2 =
- (*iter).second.ModulesList.begin();
- iter2 != (*iter).second.ModulesList.end();
+ (*iter).second.ComponentsList.begin();
+ iter2 != (*iter).second.ComponentsList.end();
iter2++)
{
- node1 = xmlNewChild(node, NULL, BAD_CAST test_modules, NULL);
- xmlNewProp(node1, BAD_CAST test_module_name, BAD_CAST (*iter2).c_str());
+ node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
+ xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
}
xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
for (vector<string>::const_iterator iter2 =
- (*iter).second.ModulesList.begin();
- iter2 != (*iter).second.ModulesList.end();
+ (*iter).second.ComponentsList.begin();
+ iter2 != (*iter).second.ComponentsList.end();
iter2++)
{
- node1 = xmlNewChild(node, NULL, BAD_CAST test_modules, NULL);
- xmlNewProp(node1, BAD_CAST test_module_name, BAD_CAST (*iter2).c_str());
+ node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
+ xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
}
xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
void PrepareDocToXmlFile(xmlDocPtr theDoc);
private :
- std::string previous_module_name;
+ std::string previous_component_name;
ParserResourcesType _resource;
MapOfParserResourcesType& _resources_list;
const char *test_mpi;
const char *test_user_name;
const char *test_appli_path;
+ // for compatibility
const char *test_modules;
const char *test_module_name;
+ const char *test_components;
+ const char *test_component_name;
const char *test_os;
const char *test_mem_in_mb;
const char *test_cpu_freq_mhz;
"OS : " << OS << endl <<
"batchQueue : " << batchQueue << endl <<
"userCommands : " << userCommands << endl <<
- "Modules : " << endl;
+ "Components : " << endl;
- for(int i=0;i<ModulesList.size();i++)
- oss << "Module " << i+1 << " called : " << ModulesList[i] << endl;
+ for(int i=0;i<ComponentsList.size();i++)
+ oss << "Component " << i+1 << " called : " << ComponentsList[i] << endl;
cout << oss.str() << endl;
AppliPath = "";
batchQueue = "";
userCommands = "";
- ModulesList.clear();
+ ComponentsList.clear();
OS = "";
}
MpiImplType mpi;
std::string UserName;
std::string AppliPath;
+ std::vector<std::string> ComponentsList;
std::vector<std::string> ModulesList;
std::string OS;
std::string batchQueue;
_poa = PortableServer::POA::_duplicate(poa) ;
PortableServer::ObjectId_var id = _poa->activate_object(this);
CORBA::Object_var obj = _poa->id_to_reference(id);
- Engines::SalomeLauncher_var refContMan =
- Engines::SalomeLauncher::_narrow(obj);
-
+ Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj);
_NS->Register(refContMan,_ResourcesManagerNameInNS);
MESSAGE("SALOME_ResourcesManager constructor end");
}
_NS->Destroy_Name(_ResourcesManagerNameInNS);
PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
_poa->deactivate_object(oid);
- //_remove_ref();
}
//=============================================================================
/*!
- * get the list of name of ressources fitting for the specified module.
+ * get the list of name of ressources fitting for the specified component.
* If hostname specified, check it is local or known in resources catalog.
*
* Else
* - select first machines with corresponding OS (all machines if
* parameter OS empty),
- * - then select the sublist of machines on witch the module is known
+ * - then select the sublist of machines on witch the component is known
* (if the result is empty, that probably means that the inventory of
- * modules is probably not done, so give complete list from previous step)
+ * components is probably not done, so give complete list from previous step)
*/
//=============================================================================
return CORBA::string_dup(_rm.FindFirst(ml).c_str());
}
-Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const char *hostname)
+Engines::MachineDefinition* SALOME_ResourcesManager::GetMachineParameters(const char *hostname)
{
ParserResourcesType resource = _rm.GetResourcesList(string(hostname));
- Engines::MachineParameters *p_ptr = new Engines::MachineParameters;
- p_ptr->container_name = CORBA::string_dup("");
+ Engines::MachineDefinition *p_ptr = new Engines::MachineDefinition;
p_ptr->hostname = CORBA::string_dup(resource.HostName.c_str());
p_ptr->alias = CORBA::string_dup(resource.Alias.c_str());
if( resource.Protocol == rsh )
p_ptr->protocol = "ssh";
p_ptr->username = CORBA::string_dup(resource.UserName.c_str());
p_ptr->applipath = CORBA::string_dup(resource.AppliPath.c_str());
- p_ptr->modList.length(resource.ModulesList.size());
- for(unsigned int i=0;i<resource.ModulesList.size();i++)
- p_ptr->modList[i] = CORBA::string_dup(resource.ModulesList[i].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;
char* FindFirst(const Engines::MachineList& listOfMachines);
- Engines::MachineParameters* GetMachineParameters(const char *hostname);
+ Engines::MachineDefinition* GetMachineParameters(const char *hostname);
void Shutdown();