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;
95 // Parameters for COORM
96 std::string launcher_file;
97 std::string launcher_args;
99 std::string result_directory;
100 std::list<std::string> input_files_list;
101 std::list<std::string> output_files_list;
103 std::string resource_choosed;
104 std::string batch_queue;
106 std::string extra_params;
110 std::string ll_jobtype;
111 std::string yacs_driver_options;
116 Page_Command_Main_Definitions,
117 Page_PythonSalome_Main_Definitions,
118 Page_BatchParameters,
119 Page_COORM_BatchParameters,
126 class JobNamePage: public QWizardPage
131 JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
132 virtual ~JobNamePage();
134 virtual bool validatePage();
135 virtual int nextId() const ;
136 virtual void cleanupPage() {}
139 void yacs_schema_button(bool checked);
140 void command_button(bool checked);
141 void python_salome_button(bool checked);
144 BL::JobsManager_QT * _jobs_manager;
145 QLabel * _explanation;
151 class ConclusionPage: public QWizardPage
154 ConclusionPage(QWidget * parent);
155 virtual ~ConclusionPage();
157 virtual bool validatePage();
158 virtual int nextId() const ;
159 virtual void cleanupPage() {}
162 class BatchParametersPage: public QWizardPage
167 enum MemUnit {MB, GB};
169 BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
170 virtual ~BatchParametersPage();
172 virtual void initializePage();
173 virtual int nextId() const;
174 virtual void cleanupPage();
176 MemUnit getMemUnit() const;
177 void setMemUnit(MemUnit mem_unit);
179 BL::Job::MemReqType getMemReqType() const;
180 void setMemReqType(BL::Job::MemReqType mem_req_type);
187 Ui::ResourceRequirementsWizardPage * ui;
188 BL::SALOMEServices * _salome_services;
189 std::string resource_choosed;
193 class COORM_BatchParametersPage: public QWizardPage
198 COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
199 virtual ~COORM_BatchParametersPage();
201 virtual bool validatePage();
202 virtual int nextId() const;
203 virtual void cleanupPage();
204 virtual void initializePage();
207 void choose_launcher_file();
210 BL::SALOMEServices * _salome_services;
211 QLineEdit * _launcher_file_text;
212 QString resource_choosed;
215 class FilesPage: public QWizardPage
220 FilesPage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
221 virtual ~FilesPage();
223 virtual void initializePage();
224 virtual int nextId() const;
225 virtual bool isComplete() const;
226 virtual void cleanupPage() {}
229 void choose_input_files();
230 void remove_input_files();
231 void input_itemSelectionChanged();
232 void choose_local_directory();
234 void add_output_file();
235 void remove_output_files();
236 void output_itemSelectionChanged();
239 Ui::FilesWizardPage * ui;
240 BL::SALOMEServices * _salome_services;
241 QString resource_choosed;
244 class ResourcePage: public QWizardPage
249 ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
250 virtual ~ResourcePage();
252 virtual int nextId() const;
253 virtual bool validatePage();
254 virtual void initializePage();
255 virtual void cleanupPage() {}
258 void itemSelected(QListWidgetItem * item);
261 JM::ResourceCatalog * _resource_list;
262 QLineEdit * _resource_choosed;
263 BL::SALOMEServices * _salome_services;
266 QLineEdit * _ll_value;
267 QGridLayout * _main_layout;
270 class YACSSchemaPage: public QWizardPage
275 YACSSchemaPage(QWidget * parent);
276 virtual ~YACSSchemaPage();
278 virtual bool validatePage();
279 virtual int nextId() const ;
280 virtual void cleanupPage() {}
284 void choose_env_file();
285 void choose_pre_command_file();
288 QLineEdit * _yacs_file_text;
289 QLineEdit * _line_env_file;
290 QLineEdit * _line_pre_command;
293 class CommandMainPage: public QWizardPage
298 CommandMainPage(QWidget * parent);
299 virtual ~CommandMainPage();
301 virtual bool validatePage();
302 virtual int nextId() const ;
303 virtual void cleanupPage() {}
306 void choose_command_file();
307 void choose_env_file();
308 void choose_pre_command_file();
311 QLineEdit * _line_command;
312 QLineEdit * _line_env_file;
313 QLineEdit * _line_pre_command;
316 class PythonSalomeMainPage: public QWizardPage
321 PythonSalomeMainPage(QWidget * parent);
322 virtual ~PythonSalomeMainPage();
324 virtual bool validatePage();
325 virtual int nextId() const ;
326 virtual void cleanupPage() {}
329 void choose_PythonSalome_file();
330 void choose_env_file();
331 void choose_pre_command_file();
334 QLineEdit * _line_PythonSalome;
335 QLineEdit * _line_env_file;
336 QLineEdit * _line_pre_command;
339 class AdvancedParametersPage: public QWizardPage
344 AdvancedParametersPage(BL::CreateJobWizard * parent);
345 virtual ~AdvancedParametersPage();
347 virtual int nextId() const;
348 virtual void cleanupPage() {}
351 Ui::AdvancedParametersWizardPage * ui;