1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef __RESOURCESMANAGER_HXX__
23 #define __RESOURCESMANAGER_HXX__
25 #include "ResourcesManager_Defs.hxx"
30 #include "SALOME_ResourcesCatalog_Parser.hxx"
31 #include "SALOME_ResourcesCatalog_Handler.hxx"
32 #include "SALOME_LoadRateManager.hxx"
35 // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
36 // in a critical section to be sure to be clean.
37 // Only one thread should use the SALOME_ResourcesManager class in a SALOME
44 unsigned int nb_proc_per_node;
45 unsigned int cpu_clock;
47 std::vector<std::string> componentList;
48 std::vector<std::string> computerList;
51 class RESOURCESMANAGER_EXPORT ResourcesException
54 const std::string msg;
56 ResourcesException(const std::string m) : msg(m) {}
59 class RESOURCESMANAGER_EXPORT ResourcesManager_cpp
64 ResourcesManager_cpp(const char *xmlFilePath);
65 ResourcesManager_cpp() throw(ResourcesException);
67 ~ResourcesManager_cpp();
69 std::vector<std::string>
70 GetFittingResources(const machineParams& params) throw(ResourcesException);
72 std::string Find(const std::string& policy, const std::vector<std::string>& listOfMachines);
74 int AddResourceInCatalog
75 (const machineParams& paramsOfNewResources,
76 const std::vector<std::string>& componentsOnNewResources,
80 AccessProtocolType prot) throw(ResourcesException);
82 void DeleteResourceInCatalog(const char *hostname);
84 void WriteInXmlFile();
86 const MapOfParserResourcesType& ParseXmlFile();
88 const MapOfParserResourcesType& GetList() const;
90 ParserResourcesType GetResourcesList(const std::string& machine);
94 void SelectOnlyResourcesWithOS(std::vector<std::string>& hosts,
96 throw(ResourcesException);
98 void KeepOnlyResourcesWithComponent(std::vector<std::string>& hosts,
99 const std::vector<std::string>& componentList) const
100 throw(ResourcesException);
102 //! will contain the path to the ressources catalog
103 std::string _path_resources;
105 //! will contain the informations on the data type catalog(after parsing)
106 MapOfParserResourcesType _resourcesList;
108 //! will contain the informations on the data type catalog(after parsing)
109 MapOfParserResourcesType _resourcesBatchList;
111 //! a map that contains all the available load rate managers (the key is the name)
112 std::map<std::string , LoadRateManager*> _resourceManagerMap;
114 //! different behaviour if $APPLI exists (SALOME Application)
115 bool _isAppliSalomeDefined;
118 #endif // __RESOURCESMANAGER_HXX__