#include <ResourcesManager.hxx>
Public Member Functions | |
ResourcesManager_cpp (const char *xmlFilePath) | |
just for test More... | |
ResourcesManager_cpp () | |
Standard constructor, parse resource file. More... | |
~ResourcesManager_cpp () | |
Standard Destructor. More... | |
std::vector< std::string > | GetFittingResources (const resourceParams ¶ms) |
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 resources catalog xml file. More... | |
void | DeleteAllResourcesInCatalog () |
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 resources catalog More... | |
std::list< std::string >::iterator | _path_resources_it |
MapOfParserResourcesType | _resourcesList |
will contain the information 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 = 0 |
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, first, and ParseXmlFiles().
ResourcesManager_cpp::ResourcesManager_cpp | ( | ) |
Standard constructor, parse resource file.
References _path_resources, _resourceManagerMap, AddDefaultResourceInCatalog(), altcycl, cycl, first, Kernel_Utils::HomePath(), 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(), Kernel_Utils::HomePath(), 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 resources catalog xml file.
References _resourcesList, ParserResourcesType::AppliPath, ParserResourcesType::can_launch_batch_jobs, ParserResourcesType::can_run_containers, DEFAULT_RESOURCE_NAME, ParserResourcesType::HostName, ParserResourcesType::Name, and ParserResourcesType::Protocol.
void ResourcesManager_cpp::DeleteAllResourcesInCatalog | ( | ) |
References _resourcesList.
void ResourcesManager_cpp::DeleteResourceInCatalog | ( | const char * | name | ) |
Deletes a resource from the catalog.
References _resourcesList, DEFAULT_RESOURCE_NAME, IDLparser::error(), pythfilter::name, and RES_INFOS.
std::string ResourcesManager_cpp::Find | ( | const std::string & | policy, |
const std::vector< std::string > & | listOfResources | ||
) | const |
threadsafe
References _resourceManagerMap, and _resourcesList.
std::vector< std::string > ResourcesManager_cpp::GetFittingResources | ( | const resourceParams & | params | ) |
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, _resourcesList, resourceParams::can_launch_batch_jobs, resourceParams::can_run_containers, resourceParams::componentList, resourceParams::cpu_clock, IDLparser::error(), Kernel_Utils::GetHostname(), test::hostname, resourceParams::hostname, KeepOnlyResourcesWithComponent(), resourceParams::mem_mb, resourceParams::name, resourceParams::nb_node, resourceParams::nb_proc, resourceParams::nb_proc_per_node, resourceParams::OS, ParseXmlFiles(), RES_MESSAGE, resourceParams::resourceList, and SelectOnlyResourcesWithOS().
const MapOfParserResourcesType & ResourcesManager_cpp::GetList | ( | ) | const |
consult the content of the list
References _resourcesList.
ParserResourcesType ResourcesManager_cpp::GetResourcesDescr | ( | const std::string & | name | ) | const |
thread safe
References _resourcesList, IDLparser::error(), and pythfilter::name.
|
protected |
Gives a sublist of machines on which the component is known.
References _resourcesList.
Referenced by GetFittingResources().
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 GetFittingResources(), 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.
Referenced by GetFittingResources().
void ResourcesManager_cpp::WriteInXmlFile | ( | std::string | xml_file | ) |
write the current data in memory in file.
References _path_resources, _path_resources_it, _resourcesList, SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(), and RES_MESSAGE.
|
protected |
contain the time where resourcesList was created
Referenced by ParseXmlFiles().
|
protected |
will contain the path to the resources 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 information on the data type catalog(after parsing)
Referenced by AddDefaultResourceInCatalog(), AddResourceInCatalog(), DeleteAllResourcesInCatalog(), DeleteResourceInCatalog(), Find(), GetFittingResources(), GetList(), GetResourcesDescr(), KeepOnlyResourcesWithComponent(), ParseXmlFiles(), SelectOnlyResourcesWithOS(), and WriteInXmlFile().
|
staticprotected |
the name of the default local resource
Referenced by AddDefaultResourceInCatalog(), AddResourceInCatalog(), DeleteResourceInCatalog(), and ParseXmlFiles().