Salome HOME
Add new wizard page "Advanced Parameters" with new parameter wckey
[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       unsigned 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     private:
177       Ui::ResourceRequirementsWizardPage * ui;
178       BL::SALOMEServices * _salome_services;
179       std::string resource_choosed;
180   };
181
182   // For COORM
183   class COORM_BatchParametersPage: public QWizardPage
184   {
185     Q_OBJECT
186
187     public:
188       COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
189       virtual ~COORM_BatchParametersPage();
190
191       virtual bool validatePage();
192       virtual int nextId() const;
193       virtual void cleanupPage();
194       virtual void initializePage();
195
196     public slots:
197       void choose_launcher_file();
198
199     private:
200       BL::SALOMEServices * _salome_services;
201       QLineEdit * _launcher_file_text;
202       QString resource_choosed;
203   };
204
205   class FilesPage: public QWizardPage
206   {
207     Q_OBJECT
208
209     public:
210       FilesPage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
211       virtual ~FilesPage();
212
213       virtual void initializePage();
214       virtual int nextId() const;
215       virtual bool isComplete() const;
216       virtual void cleanupPage() {}
217
218     public slots:
219       void choose_input_files();
220       void remove_input_files();
221       void input_itemSelectionChanged();
222       void choose_local_directory();
223
224       void add_output_file();
225       void remove_output_files();
226       void output_itemSelectionChanged();
227
228     private:
229       Ui::FilesWizardPage * ui;
230       BL::SALOMEServices * _salome_services;
231       QString resource_choosed;
232   };
233
234   class ResourcePage: public QWizardPage
235   {
236     Q_OBJECT
237
238     public:
239       ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
240       virtual ~ResourcePage();
241
242       virtual int nextId() const;
243       virtual bool validatePage();
244       virtual void initializePage();
245       virtual void cleanupPage() {}
246
247     public slots:
248       void itemSelected(QListWidgetItem * item);
249
250     private:
251       JM::ResourceCatalog * _resource_list;
252       QLineEdit * _resource_choosed;
253       BL::SALOMEServices * _salome_services;
254
255       QLabel * _ll_label;
256       QLineEdit * _ll_value;
257       QGridLayout * _main_layout;
258   };
259
260   class YACSSchemaPage: public QWizardPage
261   {
262     Q_OBJECT
263
264     public:
265       YACSSchemaPage(QWidget * parent);
266       virtual ~YACSSchemaPage();
267
268       virtual bool validatePage();
269       virtual int nextId() const ;
270       virtual void cleanupPage() {}
271
272     public slots:
273       void choose_file();
274       void choose_env_file();
275
276     private:
277       QLineEdit * _yacs_file_text;
278       QLineEdit * _line_env_file;
279   };
280
281   class CommandMainPage: public QWizardPage
282   {
283     Q_OBJECT
284
285     public:
286       CommandMainPage(QWidget * parent);
287       virtual ~CommandMainPage();
288
289       virtual bool validatePage();
290       virtual int nextId() const ;
291       virtual void cleanupPage() {}
292
293     public slots:
294       void choose_command_file();
295       void choose_env_file();
296
297     private:
298       QLineEdit * _line_command;
299       QLineEdit * _line_env_file;
300   };
301
302   class PythonSalomeMainPage: public QWizardPage
303   {
304     Q_OBJECT
305
306     public:
307       PythonSalomeMainPage(QWidget * parent);
308       virtual ~PythonSalomeMainPage();
309
310       virtual bool validatePage();
311       virtual int nextId() const ;
312       virtual void cleanupPage() {}
313
314     public slots:
315       void choose_PythonSalome_file();
316       void choose_env_file();
317
318     private:
319       QLineEdit * _line_PythonSalome;
320       QLineEdit * _line_env_file;
321   };
322
323   class AdvancedParametersPage: public QWizardPage
324   {
325     Q_OBJECT
326
327     public:
328       AdvancedParametersPage(BL::CreateJobWizard * parent);
329       virtual ~AdvancedParametersPage();
330
331       virtual int nextId() const;
332       virtual void cleanupPage() {}
333
334     private:
335       Ui::AdvancedParametersWizardPage * ui;
336
337   };
338
339 }
340
341 #endif
342