Salome HOME
c0acc59600fcc67f88a69a35e521f6d9baa74b4a
[modules/kernel.git] / SALOME_ResourcesManager.idl
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef _SALOME_RESOURCESMANAGER_IDL_
24 #define _SALOME_RESOURCESMANAGER_IDL_
25
26 #include "SALOME_Exception.idl"
27
28 /*! \file SALOME_ResourcesManager.idl \brief interfaces for %SALOME Resources Manager service
29 */
30
31 module Engines
32 {
33
34 //!  Type to transmit list of resources.
35 typedef sequence<string> ResourceList;
36 //! components list
37 typedef sequence<string> CompoList;
38
39 //! Type to describe required properties of a resource
40 struct ResourceParameters
41 {
42   //! resource name - manual selection
43   /*! If a name is provided, the ressource will be imposed.
44       If the name is an empty string, the ressource will be chosen to match
45       the other parameters.
46   */
47   string name;
48
49   //! host name
50   string hostname;
51   //! if true select only resources that can launch batch jobs
52   boolean can_launch_batch_jobs;
53   //! if true select only resources that can run containers
54   boolean can_run_containers;
55   //! if given required operating system 
56   string OS;
57   //! if given, list of components that could be loaded on a container.
58   /*! Ignored if no resources are found with this constraint.*/
59   CompoList componentList;
60
61   // Permits to order resources
62   //! required number of processors
63   /*! This parameter must be specified explicitly, because it is not provided
64       by the resource definition.
65   */
66   long nb_proc;
67
68   //! required memory size
69   /*! This parameter must be specified explicitly, because it is not provided
70       by the resource definition.
71
72       The parameter specifies the maximum memory value that could be allocated
73       for executing the job. This takes into account not only the data that
74       could be loaded by the batch process but also the linked dynamic library.
75       A possible problem, for exemple in the case where you use the ssh
76       emulation of a batch system, is to get an error message as below
77       when libBatch tries to run the ssh command:
78 \verbatim
79 /usr/bin/ssh: error while loading shared libraries: libcrypto.so.0.9.8: failed
80 to map segment from shared object: Cannot allocate memory
81 \endverbatim
82       In this exemple, the mem_mb was set to 1MB, value that is not
83       sufficient to load the dynamic libraries linked to the ssh
84       executable (libcrypto.so in the error message).
85       So, even in the case of a simple test shell script, you should
86       set this value at least to a standard threshold as 500MB.
87   */
88   long mem_mb;
89   //! required frequency
90   long cpu_clock;
91   //! required number of nodes
92   long nb_node;
93   //! required number of proc per node
94   long nb_proc_per_node;
95
96   // Permits to configure SALOME resource management
97   //! resource management policy : first, cycl, altcycl or best (can be extended)
98   string policy;
99   //! restricted list of resources to search in
100   ResourceList resList;
101 };
102
103 //!  Type to describe a resource
104 struct ResourceDefinition
105 {
106   //! name 
107   string name;
108   //! hostname 
109   string hostname;
110   //! Type of the resource ("cluster" or "single_machine")
111   string type;
112   //! protocol to connect to the resource
113   //! protocol used to start a remote container (ssh or rsh)
114   string protocol;
115   //! login name to use to start a remote container
116   string username;
117   //! salome application to use to start a remote container
118   string applipath;
119   //! list of available components.
120   //! An empty list means every component is available.
121   CompoList componentList;
122
123   //! operating system 
124   string OS;
125   //! memory size per node
126   long mem_mb;
127   //! frequency
128   long cpu_clock;
129   //! number of node
130   long nb_node;
131   //! number of proc per node
132   long nb_proc_per_node;
133   //! batch system
134   string batch;
135   //! MPI implementation
136   string mpiImpl;
137   //! if the resource is a cluster:
138   //! internal protocol to use to start a remote container (ssh or rsh) on the cluster
139   string iprotocol;
140
141   //! Specify if the resource can launch batch jobs
142   boolean can_launch_batch_jobs;
143   //! Specify if the resource can run containers
144   boolean can_run_containers;
145
146   //! Predefined working directory on the resource
147   string working_directory;
148 };
149
150 /*! \brief Interface of the %resourcesManager
151     This interface is used for interaction with the unique instance
152     of ResourcesManager
153 */
154 interface ResourcesManager
155 {
156   //!  Find first available resource in a resources list
157   string FindFirst(in ResourceList possibleResources);
158
159   //!  Find best available computer according to policy in a computers list
160   string Find(in string policy, in ResourceList possibleResources);
161
162   //!  Get a list of resources that are best suited to launch a container given constraints 
163   /*! 
164        The constraints are resource constraints (params) and components constraints (componentList)
165   */
166   ResourceList GetFittingResources(in ResourceParameters params) raises (SALOME::SALOME_Exception);
167
168   //!  Get definition of a resource
169   ResourceDefinition GetResourceDefinition(in string name) raises (SALOME::SALOME_Exception);
170
171   //! Add a new resource to the resource_manager
172   /*!
173       write -> true, resource manager will add it into a xml_file
174       xml_file -> could be empty, in this case if write is true, resource manager will write
175       the resource in its first ResourceCatalog file
176     */
177   void AddResource(in ResourceDefinition new_resource, in boolean write, in string xml_file) 
178     raises (SALOME::SALOME_Exception);
179
180   //! Remove a new resource to the resource_manager
181   /*!
182       write -> true, resource manager will write a new xml_file
183       xml_file -> could be empty, in this case if write is true, resource manager will write
184       the resource in its first ResourceCatalog file
185     */
186   void RemoveResource(in string resource_name, in boolean write, in string xml_file) 
187     raises (SALOME::SALOME_Exception);
188
189   //! Create a machine file for PaCO container
190   string getMachineFile(in string resource_name, in long nb_procs, in string parallelLib)
191     raises (SALOME::SALOME_Exception);
192 };
193
194 };
195   
196 #endif