Salome HOME
Rename new ResourcesManager CORBA method
[modules/kernel.git] / idl / SALOME_ContainerManager.idl
1 //  Copyright (C) 2007-2008  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.
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 #ifndef _SALOME_CONTAINERMANAGER_IDL_
23 #define _SALOME_CONTAINERMANAGER_IDL_
24
25 #include "SALOME_Exception.idl"
26 #include "SALOME_Component.idl"
27
28 /*! \file SALOME_ContainerManager.idl \brief interfaces for %SALOME launcher and container manager
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 //! files list
39 typedef sequence<string> FilesList;
40 //! modules list
41 typedef sequence<string> ModulesList;
42
43 //! A generic parameter
44 struct Parameter
45 {
46   string name;
47   string value;
48 };
49 //! Generic parameter list
50 typedef sequence<Engines::Parameter> ParameterList;
51
52 //! Type to describe required properties of a resource
53 struct ResourceParameters
54 {
55   //! resource name - manual selection
56   string name;
57   //! host name
58   string hostname;
59   //! if given required operating system 
60   string OS;
61   //! if given list of components that could be loaded on a container
62   //! Optional if no resource are found with this constraint
63   CompoList componentList;
64
65   // Permits to order resources
66   //! required number of proc
67   long nb_proc;
68   //! required memory size
69   long mem_mb;
70   //! required frequency
71   long cpu_clock;
72   //! required number of node
73   long nb_node;
74   //! required number of proc per node
75   long nb_proc_per_node;
76
77   // Permits to configure SALOME resource management
78   //! resource management policy : first, cycl, altcycl or best (can be extended)
79   string policy;
80   //! restricted list of resources to search in
81   ResourceList resList;
82 };
83
84 //! Type to describe required properties of a container
85 struct ContainerParameters
86 {
87   //! container name if given else automatic
88   string container_name;
89
90   //! creation mode for GiveContainer if given else automatic 
91   /*!start creates a new container
92    * get  try to find an existing container
93    * getorstart   use an existing container if it exists or creates a new one
94    */
95   string mode;
96
97   //! container working directory if given else automatic
98   string workingdir;
99
100   // Parallel part
101   //! Number of proc of a parallel container
102   long nb_proc;
103   //! if true start a MPI container
104   boolean isMPI;
105   //! PaCO specific informations
106   string parallelLib;
107
108   //! Parameters to choose a resource
109   ResourceParameters resource_params;
110 };
111
112 //!  Type to describe a resource
113 struct ResourceDefinition
114 {
115   //! name 
116   string name;
117   //! hostname 
118   string hostname;
119   //! protocol to connect to the resource
120   //! protocol used to start a remote container (ssh or rsh)
121   string protocol;
122   //! login name to use to start a remote container
123   string username;
124   //! salome application to use to start a remote container
125   string applipath;
126   //! list of available components 
127   CompoList componentList;
128   //! Type of resource: interactive or batch
129   string mode;
130
131   //! operating system 
132   string OS;
133   //! memory size per node
134   long mem_mb;
135   //! frequency
136   long cpu_clock;
137   //! number of node
138   long nb_node;
139   //! number of proc per node
140   long nb_proc_per_node;
141   //! batch system
142   string batch;
143   //! MPI implementation
144   string mpiImpl;
145   //! if the resource is a cluster:
146   //! internal protocol to use to start a remote container (ssh or rsh) on the cluster
147   string iprotocol;
148 };
149
150 //! exception thrown if a computer is not found in the catalog
151 exception NotFound {};
152
153 struct JobParameters
154 {
155   //! Job Type - Could be equal to "command" or "yacs_file" or "python_salome"
156   string job_type;
157
158   // Common values
159   string job_file;
160   string env_file; 
161   FilesList in_files;
162   FilesList out_files;
163   string work_directory;
164   string local_directory;
165   string result_directory;
166
167   /*! Time for the batch (has to be like this : hh:mm) - Could be empty, in
168        this case, default value of the selected resource will be used.
169   */
170   string maximum_duration; 
171
172   // Memory is expressed in megabytes -> mem_mb
173   // Number of Processors -> nb_proc
174   ResourceParameters resource_required;
175
176   /*!
177     Name of the batch queue choosed - optional
178   */
179   string queue;
180
181   /*!
182     Specific parameters for each type of job - optional
183   */
184   Engines::ParameterList specific_parameters;
185 };
186
187 /*! \brief Interface of the %salomelauncher
188     This interface is used for interaction with the unique instance
189     of SalomeLauncher
190 */
191 interface SalomeLauncher
192 {
193   // Main methods
194   long   createJob    (in Engines::JobParameters job_parameters) raises (SALOME::SALOME_Exception);
195   void   launchJob    (in long job_id)                           raises (SALOME::SALOME_Exception);
196   string getJobState  (in long job_id)                           raises (SALOME::SALOME_Exception);
197   void   getJobResults(in long job_id, in string directory)      raises (SALOME::SALOME_Exception);
198   void   removeJob    (in long job_id)                           raises (SALOME::SALOME_Exception);
199
200   // Useful methods
201   long    createJobWithFile(in string xmlJobFile, in string clusterName) raises (SALOME::SALOME_Exception);
202   boolean testBatch        (in ResourceParameters params)                raises (SALOME::SALOME_Exception);
203
204   // SALOME kernel service methods
205   void Shutdown();
206   long getPID();
207 };
208   
209 /*! \brief Interface of the %containerManager
210     This interface is used for interaction with the unique instance
211     of ContainerManager
212 */
213 interface ContainerManager
214 {
215   //! GiveContainer - use mode parameter of ContainerParameters to configure
216   //! how this method works
217   //! Currently: get, start, getorstart, findorstart, find
218   Container GiveContainer(in ContainerParameters params);
219
220   //!  Shutdown all containers that have been launched by the container manager
221   void ShutdownContainers();
222 } ;
223   
224 /*! \brief Interface of the %resourcesManager
225     This interface is used for interaction with the unique instance
226     of ResourcesManager
227 */
228 interface ResourcesManager
229 {
230   //!  Find first available resource in a resources list
231   string FindFirst(in ResourceList possibleResources);
232
233   //!  Find best available computer according to policy in a computers list
234   string Find(in string policy, in ResourceList possibleResources);
235
236   //!  Get a list of resources that are best suited to launch a container given constraints 
237   /*! 
238        The constraints are resource constraints (params) and components constraints (componentList)
239   */
240   ResourceList GetFittingResources(in ResourceParameters params) raises (SALOME::SALOME_Exception);
241
242   //!  Get definition of a resource
243   ResourceDefinition GetResourceDefinition(in string name);
244
245   //! Add a new resource to the resource_manager
246   /*!
247       write -> true, resource manager will add it into a xml_file
248       xml_file -> could be empty, in this case if write is true, resource manager will write
249       the resource in its first ResourceCatalog file
250     */
251   void AddResource(in ResourceDefinition new_resource, in boolean write, in string xml_file) 
252     raises (SALOME::SALOME_Exception);
253 };
254
255
256 // For compatibility - will be erased on SALOME 6
257 typedef sequence<string> MachineList;
258 //!  Type to describe required properties of a container.
259 struct MachineParameters
260 {
261   //! container name if given else automatic
262   string container_name;
263   //! host name if given else automatic
264   string hostname;
265   //! if given list of components that could be loaded on the container
266   CompoList componentList;
267   //! if given restricted list of machines to search in
268   MachineList computerList;
269   //! required operating system 
270   string OS;
271   //! required memory size
272   long mem_mb;
273   //! required frequency
274   long cpu_clock;
275   //! required number of proc per node
276   long nb_proc_per_node;
277   //! required number of node
278   long nb_node;
279   //! if true start a MPI container
280   boolean isMPI;
281   //! container working directory 
282   string workingdir;
283   //! creation mode for GiveContainer. 
284   /*!start creates a new container
285    * get  try to find an existing container
286    * getorstart   use an existing container if it exists or creates a new one
287    */
288   string mode;
289   //! resource management policy : first, cycl, altcycl or best (can be extended)
290   string policy;
291
292   //! PaCO specific informations
293   string parallelLib;
294   long nb_component_nodes;
295 };
296 };
297   
298 #endif