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