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