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