Version: 9.16.0
ResourcesManager_cpp Class Reference

#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 &params)
 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 AddResourceInCatalogNoQuestion (const ParserResourcesType &new_resource)
 
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...
 

Constructor & Destructor Documentation

◆ ResourcesManager_cpp() [1/2]

ResourcesManager_cpp::ResourcesManager_cpp ( const char *  xmlFilePath)

◆ ResourcesManager_cpp() [2/2]

ResourcesManager_cpp::ResourcesManager_cpp ( )

Standard constructor, parse resource file.

  • if ${APPLI} exists in environment, look for ${HOME}/${APPLI}/CatalogResources.xml
  • else look for default: ${KERNEL_ROOT_DIR}/share/salome/resources/kernel/CatalogResources.xml
  • parse XML resource file.

References _path_resources, _resourceManagerMap, AddDefaultResourceInCatalog(), altcycl, cycl, first, ParseXmlFiles(), and RES_MESSAGE.

◆ ~ResourcesManager_cpp()

ResourcesManager_cpp::~ResourcesManager_cpp ( )

Standard Destructor.

References RES_MESSAGE.

Member Function Documentation

◆ AddDefaultResourceInCatalog()

◆ AddResourceInCatalog()

◆ AddResourceInCatalogNoQuestion()

void ResourcesManager_cpp::AddResourceInCatalogNoQuestion ( const ParserResourcesType &  new_resource)

◆ DeleteAllResourcesInCatalog()

void ResourcesManager_cpp::DeleteAllResourcesInCatalog ( )

References _resourcesList.

◆ DeleteResourceInCatalog()

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.

◆ Find()

std::string ResourcesManager_cpp::Find ( const std::string &  policy,
const std::vector< std::string > &  listOfResources 
) const

threadsafe

References _resourceManagerMap, and _resourcesList.

◆ GetFittingResources()

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(), 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().

◆ GetList()

const MapOfParserResourcesType & ResourcesManager_cpp::GetList ( ) const

consult the content of the list

References _resourcesList.

◆ GetResourcesDescr()

ParserResourcesType ResourcesManager_cpp::GetResourcesDescr ( const std::string &  name) const

thread safe

References _resourcesList, IDLparser::error(), and pythfilter::name.

◆ KeepOnlyResourcesWithComponent()

void ResourcesManager_cpp::KeepOnlyResourcesWithComponent ( std::vector< std::string > &  resources,
const std::vector< std::string > &  componentList 
)
protected

Gives a sublist of machines on which the component is known.

References _resourcesList.

Referenced by GetFittingResources().

◆ ParseXmlFiles()

◆ SelectOnlyResourcesWithOS()

void ResourcesManager_cpp::SelectOnlyResourcesWithOS ( std::vector< std::string > &  resources,
std::string  OS 
)
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().

◆ WriteInXmlFile()

void ResourcesManager_cpp::WriteInXmlFile ( std::string  xml_file)

Field Documentation

◆ _lasttime

time_t ResourcesManager_cpp::_lasttime = 0
protected

contain the time where resourcesList was created

Referenced by ParseXmlFiles().

◆ _path_resources

std::list<std::string> ResourcesManager_cpp::_path_resources
protected

will contain the path to the resources catalog

Referenced by ParseXmlFiles(), ResourcesManager_cpp(), and WriteInXmlFile().

◆ _path_resources_it

std::list<std::string>::iterator ResourcesManager_cpp::_path_resources_it
protected

Referenced by ParseXmlFiles(), and WriteInXmlFile().

◆ _resourceManagerMap

std::map<std::string , LoadRateManager*> ResourcesManager_cpp::_resourceManagerMap
protected

a map that contains all the available load rate managers (the key is the name)

Referenced by Find(), and ResourcesManager_cpp().

◆ _resourcesList

◆ DEFAULT_RESOURCE_NAME

const string ResourcesManager_cpp::DEFAULT_RESOURCE_NAME = "localhost"
staticprotected

the name of the default local resource

Referenced by AddDefaultResourceInCatalog(), AddResourceInCatalog(), DeleteResourceInCatalog(), and ParseXmlFiles().