1 // Copyright (C) 2009-2016 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _BL_CREATEJOBWIZARD_HXX_
21 #define _BL_CREATEJOBWIZARD_HXX_
23 #include "BL_Traces.hxx"
24 #include "BL_SALOMEServices.hxx"
25 #include "JM_ResourceCatalog.hxx"
28 #include <QWizardPage>
38 class ResourceRequirementsWizardPage;
39 class FilesWizardPage;
40 class AdvancedParametersWizardPage;
47 class BatchParametersPage;
48 class CreateJobWizard: public QWizard
53 CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services);
54 virtual ~CreateJobWizard();
56 void setFilesList(QListWidget * input_files_list, QListWidget * output_files_list);
58 void clone(const std::string & name);
64 BL::JobsManager_QT * _jobs_manager;
65 QListWidget * _input_files_list;
66 QListWidget * _output_files_list;
68 BL::JobNamePage * _job_name_page;
69 BL::BatchParametersPage * _batch_parameters_page;
70 BL::SALOMEServices * _salome_services;
75 enum {YACS, COMMAND, PYTHON_SALOME} job_type;
77 std::string yacs_file;
79 std::string python_salome_file;
82 std::string pre_command;
84 std::string batch_directory;
87 std::string coorm_batch_directory;
89 std::string maximum_duration;
91 BL::Job::MemReqType mem_req_type;
96 // Parameters for COORM
97 std::string launcher_file;
98 std::string launcher_args;
100 std::string result_directory;
101 std::list<std::string> input_files_list;
102 std::list<std::string> output_files_list;
104 std::string resource_choosed;
105 std::string batch_queue;
106 std::string batch_partition;
108 std::string extra_params;
112 std::string ll_jobtype;
113 std::string yacs_driver_options;
118 Page_Command_Main_Definitions,
119 Page_PythonSalome_Main_Definitions,
120 Page_BatchParameters,
121 Page_COORM_BatchParameters,
128 class JobNamePage: public QWizardPage
133 JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
134 virtual ~JobNamePage();
136 virtual bool validatePage();
137 virtual int nextId() const ;
138 virtual void cleanupPage() {}
141 void yacs_schema_button(bool checked);
142 void command_button(bool checked);
143 void python_salome_button(bool checked);
146 BL::JobsManager_QT * _jobs_manager;
147 QLabel * _explanation;
153 class ConclusionPage: public QWizardPage
156 ConclusionPage(QWidget * parent);
157 virtual ~ConclusionPage();
159 virtual bool validatePage();
160 virtual int nextId() const ;
161 virtual void cleanupPage() {}
164 class BatchParametersPage: public QWizardPage
169 enum MemUnit {MB, GB};
171 BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
172 virtual ~BatchParametersPage();
174 virtual void initializePage();
175 virtual int nextId() const;
176 virtual void cleanupPage();
178 MemUnit getMemUnit() const;
179 void setMemUnit(MemUnit mem_unit);
181 BL::Job::MemReqType getMemReqType() const;
182 void setMemReqType(BL::Job::MemReqType mem_req_type);
189 Ui::ResourceRequirementsWizardPage * ui;
190 BL::SALOMEServices * _salome_services;
191 std::string resource_choosed;
195 class COORM_BatchParametersPage: public QWizardPage
200 COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
201 virtual ~COORM_BatchParametersPage();
203 virtual bool validatePage();
204 virtual int nextId() const;
205 virtual void cleanupPage();
206 virtual void initializePage();
209 void choose_launcher_file();
212 BL::SALOMEServices * _salome_services;
213 QLineEdit * _launcher_file_text;
214 QString resource_choosed;
217 class FilesPage: public QWizardPage
222 FilesPage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
223 virtual ~FilesPage();
225 virtual void initializePage();
226 virtual int nextId() const;
227 virtual bool isComplete() const;
228 virtual void cleanupPage() {}
231 void choose_input_files();
232 void remove_input_files();
233 void input_itemSelectionChanged();
234 void choose_local_directory();
236 void add_output_file();
237 void remove_output_files();
238 void output_itemSelectionChanged();
241 Ui::FilesWizardPage * ui;
242 BL::SALOMEServices * _salome_services;
243 QString resource_choosed;
246 class ResourcePage: public QWizardPage
251 ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
252 virtual ~ResourcePage();
254 virtual int nextId() const;
255 virtual bool validatePage();
256 virtual void initializePage();
257 virtual void cleanupPage() {}
260 void itemSelected(QListWidgetItem * item);
263 JM::ResourceCatalog * _resource_list;
264 QLineEdit * _resource_choosed;
265 BL::SALOMEServices * _salome_services;
268 QLineEdit * _ll_value;
269 QGridLayout * _main_layout;
272 class YACSSchemaPage: public QWizardPage
277 YACSSchemaPage(QWidget * parent);
278 virtual ~YACSSchemaPage();
280 virtual bool validatePage();
281 virtual int nextId() const ;
282 virtual void cleanupPage() {}
286 void choose_env_file();
287 void choose_pre_command_file();
290 QLineEdit * _yacs_file_text;
291 QLineEdit * _line_env_file;
292 QLineEdit * _line_pre_command;
295 class CommandMainPage: public QWizardPage
300 CommandMainPage(QWidget * parent);
301 virtual ~CommandMainPage();
303 virtual bool validatePage();
304 virtual int nextId() const ;
305 virtual void cleanupPage() {}
308 void choose_command_file();
309 void choose_env_file();
310 void choose_pre_command_file();
313 QLineEdit * _line_command;
314 QLineEdit * _line_env_file;
315 QLineEdit * _line_pre_command;
318 class PythonSalomeMainPage: public QWizardPage
323 PythonSalomeMainPage(QWidget * parent);
324 virtual ~PythonSalomeMainPage();
326 virtual bool validatePage();
327 virtual int nextId() const ;
328 virtual void cleanupPage() {}
331 void choose_PythonSalome_file();
332 void choose_env_file();
333 void choose_pre_command_file();
336 QLineEdit * _line_PythonSalome;
337 QLineEdit * _line_env_file;
338 QLineEdit * _line_pre_command;
341 class AdvancedParametersPage: public QWizardPage
346 AdvancedParametersPage(BL::CreateJobWizard * parent);
347 virtual ~AdvancedParametersPage();
349 virtual int nextId() const;
350 virtual void cleanupPage() {}
353 Ui::AdvancedParametersWizardPage * ui;