1 // Copyright (C) 2009-2019 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, COMMAND_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 command_salome_button(bool checked);
144 void python_salome_button(bool checked);
147 BL::JobsManager_QT * _jobs_manager;
148 QLabel * _explanation;
154 class ConclusionPage: public QWizardPage
157 ConclusionPage(QWidget * parent);
158 virtual ~ConclusionPage();
160 virtual bool validatePage();
161 virtual int nextId() const ;
162 virtual void cleanupPage() {}
165 class BatchParametersPage: public QWizardPage
170 enum MemUnit {MB, GB};
172 BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
173 virtual ~BatchParametersPage();
175 virtual void initializePage();
176 virtual int nextId() const;
177 virtual void cleanupPage();
179 MemUnit getMemUnit() const;
180 void setMemUnit(MemUnit mem_unit);
182 BL::Job::MemReqType getMemReqType() const;
183 void setMemReqType(BL::Job::MemReqType mem_req_type);
190 Ui::ResourceRequirementsWizardPage * ui;
191 BL::SALOMEServices * _salome_services;
192 std::string resource_choosed;
196 class COORM_BatchParametersPage: public QWizardPage
201 COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
202 virtual ~COORM_BatchParametersPage();
204 virtual bool validatePage();
205 virtual int nextId() const;
206 virtual void cleanupPage();
207 virtual void initializePage();
210 void choose_launcher_file();
213 BL::SALOMEServices * _salome_services;
214 QLineEdit * _launcher_file_text;
215 QString resource_choosed;
218 class FilesPage: public QWizardPage
223 FilesPage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
224 virtual ~FilesPage();
226 virtual void initializePage();
227 virtual int nextId() const;
228 virtual bool isComplete() const;
229 virtual void cleanupPage() {}
232 void choose_input_files();
233 void remove_input_files();
234 void input_itemSelectionChanged();
235 void choose_local_directory();
237 void add_output_file();
238 void remove_output_files();
239 void output_itemSelectionChanged();
242 Ui::FilesWizardPage * ui;
243 BL::SALOMEServices * _salome_services;
244 QString resource_choosed;
247 class ResourcePage: public QWizardPage
252 ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
253 virtual ~ResourcePage();
255 virtual int nextId() const;
256 virtual bool validatePage();
257 virtual void initializePage();
258 virtual void cleanupPage() {}
261 void itemSelected(QListWidgetItem * item);
264 JM::ResourceCatalog * _resource_list;
265 QLineEdit * _resource_choosed;
266 BL::SALOMEServices * _salome_services;
269 QLineEdit * _ll_value;
270 QGridLayout * _main_layout;
273 class YACSSchemaPage: public QWizardPage
278 YACSSchemaPage(QWidget * parent);
279 virtual ~YACSSchemaPage();
281 virtual bool validatePage();
282 virtual int nextId() const ;
283 virtual void cleanupPage() {}
287 void choose_env_file();
288 void choose_pre_command_file();
291 QLineEdit * _yacs_file_text;
292 QLineEdit * _line_env_file;
293 QLineEdit * _line_pre_command;
296 class CommandMainPage: public QWizardPage
301 CommandMainPage(QWidget * parent);
302 virtual ~CommandMainPage();
304 virtual bool validatePage();
305 virtual int nextId() const ;
306 virtual void cleanupPage() {}
309 void choose_command_file();
310 void choose_env_file();
311 void choose_pre_command_file();
314 QLineEdit * _line_command;
315 QLineEdit * _line_env_file;
316 QLineEdit * _line_pre_command;
319 class PythonSalomeMainPage: public QWizardPage
324 PythonSalomeMainPage(QWidget * parent);
325 virtual ~PythonSalomeMainPage();
327 virtual bool validatePage();
328 virtual int nextId() const ;
329 virtual void cleanupPage() {}
332 void choose_PythonSalome_file();
333 void choose_env_file();
334 void choose_pre_command_file();
337 QLineEdit * _line_PythonSalome;
338 QLineEdit * _line_env_file;
339 QLineEdit * _line_pre_command;
342 class AdvancedParametersPage: public QWizardPage
347 AdvancedParametersPage(BL::CreateJobWizard * parent);
348 virtual ~AdvancedParametersPage();
350 virtual int nextId() const;
351 virtual void cleanupPage() {}
354 Ui::AdvancedParametersWizardPage * ui;