1 // Copyright (C) 2007-2013 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
23 #ifndef __RESOURCESMANAGER_HXX__
24 #define __RESOURCESMANAGER_HXX__
26 #include "ResourcesManager_Defs.hxx"
32 #include "SALOME_ResourcesCatalog_Parser.hxx"
33 #include "SALOME_ResourcesCatalog_Handler.hxx"
34 #include "SALOME_LoadRateManager.hxx"
35 #include <sys/types.h>
43 #pragma warning(disable:4251) // Warning DLL Interface ...
44 #pragma warning(disable:4290) // Warning Exception ...
48 // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
49 // in a critical section to be sure to be clean.
50 // Only one thread should use the SALOME_ResourcesManager class in a SALOME
56 bool can_launch_batch_jobs;
57 bool can_run_containers;
61 long nb_proc_per_node;
64 std::vector<std::string> componentList;
65 std::vector<std::string> resourceList;
68 class RESOURCESMANAGER_EXPORT ResourcesException
71 const std::string msg;
73 ResourcesException(const std::string m) : msg(m) {}
76 class RESOURCESMANAGER_EXPORT ResourcesManager_cpp
81 ResourcesManager_cpp(const char *xmlFilePath);
82 ResourcesManager_cpp() throw(ResourcesException);
84 ~ResourcesManager_cpp();
86 std::vector<std::string>
87 GetFittingResources(const resourceParams& params) throw(ResourcesException);
89 std::string Find(const std::string& policy,
90 const std::vector<std::string>& listOfResources);
92 void AddResourceInCatalog (const ParserResourcesType & new_resource);
94 void DeleteResourceInCatalog(const char * name);
96 void WriteInXmlFile(std::string xml_file);
98 const MapOfParserResourcesType& ParseXmlFiles();
100 const MapOfParserResourcesType& GetList() const;
102 ParserResourcesType GetResourcesDescr(const std::string & name);
106 void SelectOnlyResourcesWithOS(std::vector<std::string>& resources, std::string OS);
108 void KeepOnlyResourcesWithComponent(std::vector<std::string>& resources,
109 const std::vector<std::string>& componentList);
112 * Add the default local resource in the catalog
114 void AddDefaultResourceInCatalog();
116 //! will contain the path to the ressources catalog
117 std::list<std::string> _path_resources;
118 std::list<std::string>::iterator _path_resources_it;
120 //! will contain the informations on the data type catalog(after parsing)
121 MapOfParserResourcesType _resourcesList;
123 //! a map that contains all the available load rate managers (the key is the name)
124 std::map<std::string , LoadRateManager*> _resourceManagerMap;
126 //! contain the time where resourcesList was created
129 //! the name of the default local resource
130 static const std::string DEFAULT_RESOURCE_NAME;
133 #endif // __RESOURCESMANAGER_HXX__