Salome HOME
CCAR:
[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 machines.
35   typedef sequence<string> MachineList;
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 //!  Type to describe required properties of a container.
44 struct MachineParameters
45 {
46   //! container name if given else automatic
47   string container_name;
48   //! host name if given else automatic
49   string hostname;
50   //! if given alias name to use ??
51   string alias;
52   //! protocol to use to start a remote container (ssh or rsh)
53   string protocol;
54   //! login name to use to start a remote container
55   string username;
56   //! salome application to use to start a remote container
57   string applipath;
58   ModulesList modList;
59   string OS;
60   //! required memory size
61   long mem_mb;
62   //! required frequency
63   long cpu_clock;
64   //! required number of proc per node
65   long nb_proc_per_node;
66   //! required number of node
67   long nb_node;
68   //! if true start a MPI container ??
69   boolean isMPI;
70   //! required MPI implementation to use
71   string mpiImpl;
72   //! required batch system to use
73   string batch;
74   //! container working directory 
75   string workingdir;
76
77   // PaCO specific informations
78   string parallelLib;
79   long nb_component_nodes;
80 };
81
82 //!  Type to describe properties of a resource.
83 struct MachineDefinition
84 {
85   //! host name 
86   string hostname;
87   string alias;
88   //! protocol to use to start a remote container (ssh or rsh)
89   string protocol;
90   //! login name to use to start a remote container
91   string username;
92   //! salome application to use to start a remote container
93   string applipath;
94   //! list of available components 
95   CompoList componentList;
96   //! operating system 
97   string OS;
98   //! memory size
99   long mem_mb;
100   //! frequency
101   long cpu_clock;
102   //! number of proc per node
103   long nb_proc_per_node;
104   //! number of node
105   long nb_node;
106   //! MPI implementation
107   string mpiImpl;
108   //! batch system
109   string batch;
110   long nb_component_nodes;
111 };
112 //! exception thrown if a computer is not found in the catalog
113   exception NotFound {};
114
115 //! enumeration to set a resource management policy
116   enum policy {
117   //! first machine in the list of admissible computers
118   P_FIRST,
119   //! next machine in the list of admissible computers
120   P_CYCL,
121   //! best machine in the list of admissible computers
122   P_BEST};
123 //! resource management policy
124   typedef policy ResPolicy;
125
126 //!  Structure used for Salome Batch Job parameters
127 struct BatchParameters
128 {
129   //! Where batch command will be launched and log files will be created
130   string batch_directory; 
131   //! Time for the batch (has to be like this : hh:mm)
132   string expected_during_time; 
133   //! Minimum of memory needed (has to be like : 32gb or 512mb)
134   string mem; 
135   //! Number of processors requested
136   long nb_proc; 
137 };
138
139 /*! \brief Interface of the %salomelauncher
140     This interface is used for interaction with the unique instance
141     of SalomeLauncher
142 */
143   interface SalomeLauncher
144   {
145     long submitJob( in string xmlExecuteFile,
146                     in string clusterName ) raises (SALOME::SALOME_Exception);
147     long submitSalomeJob( in string fileToExecute,
148                           in FilesList filesToExport,
149                           in FilesList filesToImport,
150                           in BatchParameters batch_params,
151                           in MachineParameters params ) raises (SALOME::SALOME_Exception);
152     string queryJob( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception);
153     void deleteJob( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception);
154     void getResultsJob( in string directory, in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception);
155
156     boolean testBatch(in MachineParameters params) raises (SALOME::SALOME_Exception);
157
158     void Shutdown();
159
160     long getPID();
161
162   } ;
163   
164 /*! \brief Interface of the %containerManager
165     This interface is used for interaction with the unique instance
166     of ContainerManager
167 */
168   interface ContainerManager
169   {
170     //!  Find an existing container satisfying the constraints given by input parameters or start a new one.
171     Container FindOrStartContainer( in MachineParameters params,
172                                     in MachineList possibleComputers);
173
174     //!  This operation launches a PaCO++ container.
175     /*!  
176
177       \param Description of the container resquested.
178       \param List of computers ressources.
179
180       \return Container's CORBA reference.
181     */
182     Container FindOrStartParallelContainer( in MachineParameters params,
183                                             in MachineList possibleComputers);
184
185     //!  Start a new container satisfying the constraints given by input parameters.
186     Container StartContainer( in MachineParameters params,
187                               in ResPolicy policy,
188                               in CompoList componentList );
189
190     //!  Same as StartContainer except that in batch all containers have already been launched
191     /*! 
192
193          We are in batch if environment variable SALOME_BATCH is 1.
194          In this case, containers have been launched at the beginning of the Salome session and 
195          the container manager picks one in the pool of existing containers.
196     */
197     Container GiveContainer( in MachineParameters params,
198                              in ResPolicy policy,
199                              in CompoList componentList );
200
201     //!  Shutdown all containers that have been launched by the container manager
202     void ShutdownContainers();
203
204   } ;
205   
206 /*! \brief Interface of the %resourcesManager
207     This interface is used for interaction with the unique instance
208     of ResourcesManager
209 */
210   interface ResourcesManager
211   {
212     //!  Find first available computer in a computers list
213     string FindFirst(in MachineList possibleComputers);
214
215     //!  Get a list of computers that are best suited to launch a container given constraints 
216     /*! 
217
218          The constraints are resource constraints (params) and components constraints (componentList)
219     */
220     MachineList GetFittingResources( in MachineParameters params,
221                                      in CompoList componentList )
222       raises (SALOME::SALOME_Exception);
223
224     //!  Get the current machine parameters of a computer
225     MachineDefinition GetMachineParameters( in string hostname );
226
227   } ;
228 };
229   
230 #endif