Version: 8.3.0
ResourcesManager_cpp Class Reference

#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 &params) 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 MapOfParserResourcesTypeParseXmlFiles ()
 parse the data type catalog More...
 
const MapOfParserResourcesTypeGetList () 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...
 

Constructor & Destructor Documentation

ResourcesManager_cpp::ResourcesManager_cpp ( const char xmlFilePath)
ResourcesManager_cpp::ResourcesManager_cpp ( ) throw (ResourcesException)

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 _lasttime, _path_resources, _resourceManagerMap, AddDefaultResourceInCatalog(), altcycl, cycl, first, ParseXmlFiles(), RES_INFOS, and RES_MESSAGE.

ResourcesManager_cpp::~ResourcesManager_cpp ( )

Standard Destructor.

References RES_MESSAGE.

Member Function Documentation

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
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
ParserResourcesType ResourcesManager_cpp::GetResourcesDescr ( const std::string &  name) const

thread safe

References _resourcesList.

Referenced by SALOME_ResourcesManager::GetResourceDefinition().

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.

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.

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

Field Documentation

time_t ResourcesManager_cpp::_lasttime
protected

contain the time where resourcesList was created

Referenced by ParseXmlFiles(), and ResourcesManager_cpp().

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

will contain the path to the ressources catalog

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

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

Referenced by ParseXmlFiles(), and WriteInXmlFile().

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

MapOfParserResourcesType ResourcesManager_cpp::_resourcesList
protected
const string ResourcesManager_cpp::DEFAULT_RESOURCE_NAME = "localhost"
staticprotected