]> SALOME platform Git repositories - modules/jobmanager.git/blob - src/genericgui/BL_CreateJobWizard.hxx
Salome HOME
Add possibility to keep default values for memory and time requirements
[modules/jobmanager.git] / src / genericgui / BL_CreateJobWizard.hxx
1 // Copyright (C) 2009-2014  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, or (at your option) any later version.
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 Ui {
33   class ResourceRequirementsWizardPage;
34   class FilesWizardPage;
35   class AdvancedParametersWizardPage;
36 }
37
38 namespace BL{
39
40   class JobsManager_QT;
41   class JobNamePage;
42   class BatchParametersPage;
43   class CreateJobWizard: public QWizard
44   {
45     Q_OBJECT
46
47     public:
48       CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services);
49       virtual ~CreateJobWizard();
50
51       void setFilesList(QListWidget * input_files_list, QListWidget * output_files_list);
52
53       void clone(const std::string & name);
54
55     public slots:
56       void end(int result);
57
58     private:
59       BL::JobsManager_QT * _jobs_manager;
60       QListWidget * _input_files_list;
61       QListWidget * _output_files_list;
62
63       BL::JobNamePage * _job_name_page;
64       BL::BatchParametersPage * _batch_parameters_page;
65       BL::SALOMEServices * _salome_services;
66
67     public:
68       // Results
69       std::string job_name;
70
71       std::string yacs_file;
72       std::string command;
73       std::string python_salome_file;
74
75       std::string env_file;
76
77       std::string batch_directory;
78
79       // For COORM
80       std::string coorm_batch_directory;
81
82       std::string maximum_duration;
83       long mem_limit;
84       BL::Job::MemReqType mem_req_type;
85       int nb_proc;
86       bool exclusive;
87
88       // Parameters for COORM
89       std::string launcher_file;
90       std::string launcher_args;
91
92       std::string result_directory;
93       std::list<std::string> input_files_list;
94       std::list<std::string> output_files_list;
95
96       std::string resource_choosed;
97       std::string batch_queue;
98       std::string wckey;
99
100       bool start_job;
101       int dump_yacs_state;
102       std::string ll_jobtype;
103
104     public:
105       enum {Page_JobName,
106             Page_YACSSchema,
107             Page_Command_Main_Definitions,
108             Page_PythonSalome_Main_Definitions,
109             Page_BatchParameters,
110             Page_COORM_BatchParameters,
111             Page_Files,
112             Page_Resource,
113             Page_Advanced,
114             Page_Conclusion};
115   };
116
117   class JobNamePage: public QWizardPage
118   {
119     Q_OBJECT
120
121     public:
122       JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
123       virtual ~JobNamePage();
124
125       virtual bool validatePage();
126       virtual int nextId() const ;
127       virtual void cleanupPage() {}
128
129     public slots:
130       void yacs_schema_button(bool checked);
131       void command_button(bool checked);
132       void python_salome_button(bool checked);
133
134     private:
135       BL::JobsManager_QT * _jobs_manager;
136       QLabel * _explanation;
137
138     public:
139       QRadioButton * _yacs_schema_button;
140       QRadioButton * _command_button;
141       QRadioButton * _python_salome_button;
142       bool _check_name;
143   };
144
145   class ConclusionPage: public QWizardPage
146   {
147     public:
148       ConclusionPage(QWidget * parent);
149       virtual ~ConclusionPage();
150
151       virtual bool validatePage();
152       virtual int nextId() const ;
153       virtual void cleanupPage() {}
154   };
155
156   class BatchParametersPage: public QWizardPage
157   {
158     Q_OBJECT
159
160     public:
161       enum MemUnit {MB, GB};
162
163       BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
164       virtual ~BatchParametersPage();
165
166       virtual void initializePage();
167       virtual int nextId() const;
168       virtual void cleanupPage();
169
170       MemUnit getMemUnit() const;
171       void setMemUnit(MemUnit mem_unit);
172
173       BL::Job::MemReqType getMemReqType() const;
174       void setMemReqType(BL::Job::MemReqType mem_req_type);
175
176     public slots:
177       void timeChanged();
178       void memChanged();
179
180     private:
181       Ui::ResourceRequirementsWizardPage * ui;
182       BL::SALOMEServices * _salome_services;
183       std::string resource_choosed;
184   };
185
186   // For COORM
187   class COORM_BatchParametersPage: public QWizardPage
188   {
189     Q_OBJECT
190
191     public:
192       COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
193       virtual ~COORM_BatchParametersPage();
194
195       virtual bool validatePage();
196       virtual int nextId() const;
197       virtual void cleanupPage();
198       virtual void initializePage();
199
200     public slots:
201       void choose_launcher_file();
202
203     private:
204       BL::SALOMEServices * _salome_services;
205       QLineEdit * _launcher_file_text;
206       QString resource_choosed;
207   };
208
209   class FilesPage: public QWizardPage
210   {
211     Q_OBJECT
212
213     public:
214       FilesPage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
215       virtual ~FilesPage();
216
217       virtual void initializePage();
218       virtual int nextId() const;
219       virtual bool isComplete() const;
220       virtual void cleanupPage() {}
221
222     public slots:
223       void choose_input_files();
224       void remove_input_files();
225       void input_itemSelectionChanged();
226       void choose_local_directory();
227
228       void add_output_file();
229       void remove_output_files();
230       void output_itemSelectionChanged();
231
232     private:
233       Ui::FilesWizardPage * ui;
234       BL::SALOMEServices * _salome_services;
235       QString resource_choosed;
236   };
237
238   class ResourcePage: public QWizardPage
239   {
240     Q_OBJECT
241
242     public:
243       ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
244       virtual ~ResourcePage();
245
246       virtual int nextId() const;
247       virtual bool validatePage();
248       virtual void initializePage();
249       virtual void cleanupPage() {}
250
251     public slots:
252       void itemSelected(QListWidgetItem * item);
253
254     private:
255       JM::ResourceCatalog * _resource_list;
256       QLineEdit * _resource_choosed;
257       BL::SALOMEServices * _salome_services;
258
259       QLabel * _ll_label;
260       QLineEdit * _ll_value;
261       QGridLayout * _main_layout;
262   };
263
264   class YACSSchemaPage: public QWizardPage
265   {
266     Q_OBJECT
267
268     public:
269       YACSSchemaPage(QWidget * parent);
270       virtual ~YACSSchemaPage();
271
272       virtual bool validatePage();
273       virtual int nextId() const ;
274       virtual void cleanupPage() {}
275
276     public slots:
277       void choose_file();
278       void choose_env_file();
279
280     private:
281       QLineEdit * _yacs_file_text;
282       QLineEdit * _line_env_file;
283   };
284
285   class CommandMainPage: public QWizardPage
286   {
287     Q_OBJECT
288
289     public:
290       CommandMainPage(QWidget * parent);
291       virtual ~CommandMainPage();
292
293       virtual bool validatePage();
294       virtual int nextId() const ;
295       virtual void cleanupPage() {}
296
297     public slots:
298       void choose_command_file();
299       void choose_env_file();
300
301     private:
302       QLineEdit * _line_command;
303       QLineEdit * _line_env_file;
304   };
305
306   class PythonSalomeMainPage: public QWizardPage
307   {
308     Q_OBJECT
309
310     public:
311       PythonSalomeMainPage(QWidget * parent);
312       virtual ~PythonSalomeMainPage();
313
314       virtual bool validatePage();
315       virtual int nextId() const ;
316       virtual void cleanupPage() {}
317
318     public slots:
319       void choose_PythonSalome_file();
320       void choose_env_file();
321
322     private:
323       QLineEdit * _line_PythonSalome;
324       QLineEdit * _line_env_file;
325   };
326
327   class AdvancedParametersPage: public QWizardPage
328   {
329     Q_OBJECT
330
331     public:
332       AdvancedParametersPage(BL::CreateJobWizard * parent);
333       virtual ~AdvancedParametersPage();
334
335       virtual int nextId() const;
336       virtual void cleanupPage() {}
337
338     private:
339       Ui::AdvancedParametersWizardPage * ui;
340
341   };
342
343 }
344
345 #endif
346