#include <ResourcesManager.hxx>
Public Member Functions | |
ResourcesManager_cpp (const char *xmlFilePath) | |
just for test More... | |
ResourcesManager_cpp () throw (ResourcesException) | |
Standard constructor, parse resource file. More... | |
~ResourcesManager_cpp () | |
Standard Destructor. More... | |
std::vector< std::string > | GetFittingResources (const resourceParams ¶ms) throw (ResourcesException) |
get the list of resource names fitting constraints given by params More... | |
std::string | Find (const std::string &policy, const std::vector< std::string > &listOfResources) const |
threadsafe More... | |
void | AddResourceInCatalog (const ParserResourcesType &new_resource) |
add an entry in the ressources catalog xml file. More... | |
void | DeleteResourceInCatalog (const char *name) |
Deletes a resource from the catalog. More... | |
void | WriteInXmlFile (std::string xml_file) |
write the current data in memory in file. More... | |
const MapOfParserResourcesType & | ParseXmlFiles () |
parse the data type catalog More... | |
const MapOfParserResourcesType & | GetList () const |
consult the content of the list More... | |
ParserResourcesType | GetResourcesDescr (const std::string &name) const |
thread safe More... | |
Protected Member Functions | |
void | SelectOnlyResourcesWithOS (std::vector< std::string > &resources, std::string OS) |
Gives a sublist of resources with matching OS. More... | |
void | KeepOnlyResourcesWithComponent (std::vector< std::string > &resources, const std::vector< std::string > &componentList) |
Gives a sublist of machines on which the component is known. More... | |
void | AddDefaultResourceInCatalog () |
Add the default local resource in the catalog. More... | |
Protected Attributes | |
std::list< std::string > | _path_resources |
will contain the path to the ressources catalog More... | |
std::list< std::string >::iterator | _path_resources_it |
MapOfParserResourcesType | _resourcesList |
will contain the informations on the data type catalog(after parsing) More... | |
std::map< std::string, LoadRateManager * > | _resourceManagerMap |
a map that contains all the available load rate managers (the key is the name) More... | |
time_t | _lasttime |
contain the time where resourcesList was created More... | |
Static Protected Attributes | |
static const std::string | DEFAULT_RESOURCE_NAME = "localhost" |
the name of the default local resource More... | |
ResourcesManager_cpp::ResourcesManager_cpp | ( | const char * | xmlFilePath | ) |
just for test
References _path_resources, _resourceManagerMap, AddDefaultResourceInCatalog(), altcycl, cycl, and first.
ResourcesManager_cpp::ResourcesManager_cpp | ( | ) | throw (ResourcesException) |
Standard constructor, parse resource file.
References _lasttime, _path_resources, _resourceManagerMap, AddDefaultResourceInCatalog(), altcycl, cycl, first, ParseXmlFiles(), RES_INFOS, and RES_MESSAGE.
ResourcesManager_cpp::~ResourcesManager_cpp | ( | ) |
Standard Destructor.
References RES_MESSAGE.
|
protected |
Add the default local resource in the catalog.
References ResourceDataToSort::_Name, _resourcesList, ParserResourcesType::AppliPath, ParserResourcesType::Batch, ParserResourcesType::can_launch_batch_jobs, ParserResourcesType::can_run_containers, ParserResourcesType::DataForSort, DEFAULT_RESOURCE_NAME, Kernel_Utils::GetHostname(), ParserResourcesType::HostName, ParserResourcesType::Name, none, ParserResourcesType::Protocol, sh, and ParserResourcesType::working_directory.
Referenced by ParseXmlFiles(), and ResourcesManager_cpp().
void ResourcesManager_cpp::AddResourceInCatalog | ( | const ParserResourcesType & | new_resource | ) |
add an entry in the ressources catalog xml file.
References _resourcesList, DEFAULT_RESOURCE_NAME, and ParserResourcesType::Name.
Referenced by SALOME_ResourcesManager::AddResource().
void ResourcesManager_cpp::DeleteResourceInCatalog | ( | const char * | name | ) |
Deletes a resource from the catalog.
References _resourcesList, DEFAULT_RESOURCE_NAME, and RES_INFOS.
Referenced by SALOME_ResourcesManager::RemoveResource().
std::string ResourcesManager_cpp::Find | ( | const std::string & | policy, |
const std::vector< std::string > & | listOfResources | ||
) | const |
threadsafe
References _resourceManagerMap, and _resourcesList.
Referenced by SALOME_ResourcesManager::Find(), and SALOME_ResourcesManager::FindFirst().
std::vector< std::string > ResourcesManager_cpp::GetFittingResources | ( | const resourceParams & | params | ) | throw (ResourcesException) |
get the list of resource names fitting constraints given by params
Steps: 1: Restrict list with resourceList if defined 2: If name is defined -> check resource list 3: If not 2:, if hostname is defined -> check resource list 4: If not 3:, sort resource with nb_proc, etc... 5: In all cases remove resource that does not correspond with OS 6: And remove resource with componentList - if list is empty ignored it...
References ResourceDataToSort::_CPUFreqMHzWanted, ResourceDataToSort::_memInMBWanted, ResourceDataToSort::_nbOfNodesWanted, ResourceDataToSort::_nbOfProcPerNodeWanted, ResourceDataToSort::_nbOfProcWanted, Kernel_Utils::GetHostname(), and RES_MESSAGE.
Referenced by SALOME_ResourcesManager::GetFittingResources().
const MapOfParserResourcesType & ResourcesManager_cpp::GetList | ( | ) | const |
consult the content of the list
References _resourcesList.
Referenced by SALOME_ResourcesManager::getMachineFile(), and SALOME_ResourcesManager::ListAllAvailableResources().
ParserResourcesType ResourcesManager_cpp::GetResourcesDescr | ( | const std::string & | name | ) | const |
thread safe
References _resourcesList.
Referenced by SALOME_ResourcesManager::GetResourceDefinition().
|
protected |
Gives a sublist of machines on which the component is known.
References _resourcesList.
const MapOfParserResourcesType & ResourcesManager_cpp::ParseXmlFiles | ( | ) |
parse the data type catalog
References ResourceDataToSort::_CPUFreqMHz, _lasttime, ResourceDataToSort::_memInMB, ResourceDataToSort::_nbOfNodes, ResourceDataToSort::_nbOfProcPerNode, _path_resources, _path_resources_it, _resourcesList, AddDefaultResourceInCatalog(), ParserResourcesType::DataForSort, DEFAULT_RESOURCE_NAME, Kernel_Utils::GetHostname(), SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(), and RES_MESSAGE.
Referenced by SALOME_ResourcesManager::AddResource(), SALOME_ResourcesManager::RemoveResource(), and ResourcesManager_cpp().
|
protected |
Gives a sublist of resources with matching OS.
If parameter OS is empty, gives the complete list of resources
References _resourcesList.
void ResourcesManager_cpp::WriteInXmlFile | ( | std::string | xml_file | ) |
write the current data in memory in file.
References _path_resources, _path_resources_it, _resourcesList, DEFAULT_RESOURCE_NAME, SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(), and RES_MESSAGE.
Referenced by SALOME_ResourcesManager::AddResource(), and SALOME_ResourcesManager::RemoveResource().
|
protected |
contain the time where resourcesList was created
Referenced by ParseXmlFiles(), and ResourcesManager_cpp().
|
protected |
will contain the path to the ressources catalog
Referenced by ParseXmlFiles(), ResourcesManager_cpp(), and WriteInXmlFile().
|
protected |
Referenced by ParseXmlFiles(), and WriteInXmlFile().
|
protected |
a map that contains all the available load rate managers (the key is the name)
Referenced by Find(), and ResourcesManager_cpp().
|
protected |
will contain the informations on the data type catalog(after parsing)
Referenced by AddDefaultResourceInCatalog(), AddResourceInCatalog(), DeleteResourceInCatalog(), Find(), GetList(), GetResourcesDescr(), KeepOnlyResourcesWithComponent(), ParseXmlFiles(), SelectOnlyResourcesWithOS(), and WriteInXmlFile().
|
staticprotected |
the name of the default local resource
Referenced by AddDefaultResourceInCatalog(), AddResourceInCatalog(), DeleteResourceInCatalog(), ParseXmlFiles(), and WriteInXmlFile().