]> SALOME platform Git repositories - modules/jobmanager.git/blob - src/genericgui/BL_CreateJobWizard.hxx
Salome HOME
Add job parameter 'exclusive' to let the user choose to share nodes or not (EDF issue...
[modules/jobmanager.git] / src / genericgui / BL_CreateJobWizard.hxx
1 // Copyright (C) 2009-2013  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef _BL_CREATEJOBWIZARD_HXX_
21 #define _BL_CREATEJOBWIZARD_HXX_
22
23 #include <QtGui>
24
25 #include "BL_Traces.hxx"
26 #include "BL_SALOMEServices.hxx"
27 #include "JM_ResourceCatalog.hxx"
28
29 #include <string>
30 #include <list>
31
32 namespace BL{
33
34   class JobsManager_QT;
35   class JobNamePage;
36   class CreateJobWizard: public QWizard
37   {
38     Q_OBJECT
39
40     public:
41       CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services);
42       virtual ~CreateJobWizard();
43
44       void setFilesList(QListWidget * input_files_list, QListWidget * output_files_list);
45
46       void clone(const std::string & name);
47
48     public slots:
49       void end(int result);
50
51     private:
52       //Page Name
53       QLineEdit * _nameLineEdit;
54       BL::JobsManager_QT * _jobs_manager;
55       QListWidget * _input_files_list;
56       QListWidget * _output_files_list;
57
58       BL::JobNamePage * _job_name_page;
59       BL::SALOMEServices * _salome_services;
60
61     public:
62       // Results
63       std::string job_name;
64
65       std::string yacs_file;
66       std::string command;
67       std::string python_salome_file;
68
69       std::string env_file;
70
71       std::string batch_directory;
72
73           // For COORM
74           std::string coorm_batch_directory;
75
76           std::string maximum_duration;
77       std::string expected_memory;
78       int nb_proc;
79       bool exclusive;
80
81           // Parameters for COORM
82           std::string launcher_file;
83           std::string launcher_args;
84
85       std::string result_directory;
86       std::list<std::string> input_files_list;
87       std::list<std::string> output_files_list;
88
89       std::string resource_choosed;
90       std::string batch_queue;
91
92       bool start_job;
93       int dump_yacs_state;
94       std::string ll_jobtype;
95
96     public:
97       enum {Page_JobName,
98             Page_YACSSchema,
99             Page_Command_Main_Definitions,
100             Page_PythonSalome_Main_Definitions,
101             Page_BatchParameters,
102                         Page_COORM_BatchParameters,
103             Page_Files,
104             Page_Resource,
105             Page_Conclusion};
106   };
107
108   class JobNamePage: public QWizardPage
109   {
110     Q_OBJECT
111
112     public:
113       JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
114       virtual ~JobNamePage();
115
116       virtual bool validatePage();
117       virtual int nextId() const ;
118       virtual void cleanupPage() {}
119
120     public slots:
121       void yacs_schema_button(bool checked);
122       void command_button(bool checked);
123       void python_salome_button(bool checked);
124
125     private:
126       BL::JobsManager_QT * _jobs_manager;
127       QLabel * _explanation;
128
129     public:
130       QRadioButton * _yacs_schema_button;
131       QRadioButton * _command_button;
132       QRadioButton * _python_salome_button;
133       bool _check_name;
134   };
135
136   class ConclusionPage: public QWizardPage
137   {
138     public:
139       ConclusionPage(QWidget * parent);
140       virtual ~ConclusionPage();
141
142       virtual bool validatePage();
143       virtual int nextId() const ;
144       virtual void cleanupPage() {}
145   };
146
147   class BatchParametersPage: public QWizardPage
148   {
149     Q_OBJECT
150
151     public:
152       BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
153       virtual ~BatchParametersPage();
154
155       virtual bool validatePage();
156       virtual int nextId() const;
157       virtual void cleanupPage();
158       virtual void initializePage();
159
160     private:
161       BL::SALOMEServices * _salome_services;
162       QString resource_choosed;
163   };
164
165   // For COORM
166   class COORM_BatchParametersPage: public QWizardPage
167   {
168     Q_OBJECT
169
170     public:
171       COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
172       virtual ~COORM_BatchParametersPage();
173
174       virtual bool validatePage();
175       virtual int nextId() const;
176       virtual void cleanupPage();
177       virtual void initializePage();
178
179     public slots:
180       void choose_launcher_file();
181
182     private:
183       BL::SALOMEServices * _salome_services;
184       QLineEdit * _launcher_file_text;
185       QString resource_choosed;
186   };
187
188   class FilesPage: public QWizardPage
189   {
190     Q_OBJECT
191
192     public:
193       FilesPage(BL::CreateJobWizard * parent);
194       virtual ~FilesPage();
195
196       virtual int nextId() const;
197       virtual bool validatePage();
198       virtual void cleanupPage() {}
199
200     public slots:
201       void choose_input_files();
202       void remove_input_files();
203       void input_itemSelectionChanged();
204       void choose_local_directory();
205
206       void add_output_file();
207       void remove_output_files();
208       void output_itemSelectionChanged();
209
210     private:
211       QPushButton * _input_files_button;
212       QPushButton * _remove_input_files_button;
213       QListWidget * _input_files_list;
214       QLineEdit * _result_directory;
215
216       QPushButton * _output_files_button;
217       QPushButton * _remove_output_files_button;
218       QListWidget * _output_files_list;
219   };
220
221   class ResourcePage: public QWizardPage
222   {
223     Q_OBJECT
224
225     public:
226       ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
227       virtual ~ResourcePage();
228
229       virtual int nextId() const;
230       virtual bool validatePage();
231       virtual void initializePage();
232       virtual void cleanupPage() {}
233
234     public slots:
235       void itemSelected(QListWidgetItem * item);
236
237     private:
238       JM::ResourceCatalog * _resource_list;
239       QLineEdit * _resource_choosed;
240       BL::SALOMEServices * _salome_services;
241
242       QLabel * _ll_label;
243       QLineEdit * _ll_value;
244       QGridLayout * _main_layout;
245   };
246
247   class YACSSchemaPage: public QWizardPage
248   {
249     Q_OBJECT
250
251     public:
252       YACSSchemaPage(QWidget * parent);
253       virtual ~YACSSchemaPage();
254
255       virtual bool validatePage();
256       virtual int nextId() const ;
257       virtual void cleanupPage() {}
258
259     public slots:
260       void choose_file();
261       void choose_env_file();
262
263     private:
264       QLineEdit * _yacs_file_text;
265       QLineEdit * _line_env_file;
266   };
267
268   class CommandMainPage: public QWizardPage
269   {
270     Q_OBJECT
271
272     public:
273       CommandMainPage(QWidget * parent);
274       virtual ~CommandMainPage();
275
276       virtual bool validatePage();
277       virtual int nextId() const ;
278       virtual void cleanupPage() {}
279
280     public slots:
281       void choose_command_file();
282       void choose_env_file();
283
284     private:
285       QLineEdit * _line_command;
286       QLineEdit * _line_env_file;
287   };
288
289   class PythonSalomeMainPage: public QWizardPage
290   {
291     Q_OBJECT
292
293     public:
294       PythonSalomeMainPage(QWidget * parent);
295       virtual ~PythonSalomeMainPage();
296
297       virtual bool validatePage();
298       virtual int nextId() const ;
299       virtual void cleanupPage() {}
300
301     public slots:
302       void choose_PythonSalome_file();
303       void choose_env_file();
304
305     private:
306       QLineEdit * _line_PythonSalome;
307       QLineEdit * _line_env_file;
308   };
309 }
310
311 #endif
312