1 // Copyright (C) 2009-2015 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;
83 std::string batch_directory;
86 std::string coorm_batch_directory;
88 std::string maximum_duration;
90 BL::Job::MemReqType mem_req_type;
94 // Parameters for COORM
95 std::string launcher_file;
96 std::string launcher_args;
98 std::string result_directory;
99 std::list<std::string> input_files_list;
100 std::list<std::string> output_files_list;
102 std::string resource_choosed;
103 std::string batch_queue;
105 std::string extra_params;
109 std::string ll_jobtype;
114 Page_Command_Main_Definitions,
115 Page_PythonSalome_Main_Definitions,
116 Page_BatchParameters,
117 Page_COORM_BatchParameters,
124 class JobNamePage: public QWizardPage
129 JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
130 virtual ~JobNamePage();
132 virtual bool validatePage();
133 virtual int nextId() const ;
134 virtual void cleanupPage() {}
137 void yacs_schema_button(bool checked);
138 void command_button(bool checked);
139 void python_salome_button(bool checked);
142 BL::JobsManager_QT * _jobs_manager;
143 QLabel * _explanation;
149 class ConclusionPage: public QWizardPage
152 ConclusionPage(QWidget * parent);
153 virtual ~ConclusionPage();
155 virtual bool validatePage();
156 virtual int nextId() const ;
157 virtual void cleanupPage() {}
160 class BatchParametersPage: public QWizardPage
165 enum MemUnit {MB, GB};
167 BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
168 virtual ~BatchParametersPage();
170 virtual void initializePage();
171 virtual int nextId() const;
172 virtual void cleanupPage();
174 MemUnit getMemUnit() const;
175 void setMemUnit(MemUnit mem_unit);
177 BL::Job::MemReqType getMemReqType() const;
178 void setMemReqType(BL::Job::MemReqType mem_req_type);
185 Ui::ResourceRequirementsWizardPage * ui;
186 BL::SALOMEServices * _salome_services;
187 std::string resource_choosed;
191 class COORM_BatchParametersPage: public QWizardPage
196 COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
197 virtual ~COORM_BatchParametersPage();
199 virtual bool validatePage();
200 virtual int nextId() const;
201 virtual void cleanupPage();
202 virtual void initializePage();
205 void choose_launcher_file();
208 BL::SALOMEServices * _salome_services;
209 QLineEdit * _launcher_file_text;
210 QString resource_choosed;
213 class FilesPage: public QWizardPage
218 FilesPage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
219 virtual ~FilesPage();
221 virtual void initializePage();
222 virtual int nextId() const;
223 virtual bool isComplete() const;
224 virtual void cleanupPage() {}
227 void choose_input_files();
228 void remove_input_files();
229 void input_itemSelectionChanged();
230 void choose_local_directory();
232 void add_output_file();
233 void remove_output_files();
234 void output_itemSelectionChanged();
237 Ui::FilesWizardPage * ui;
238 BL::SALOMEServices * _salome_services;
239 QString resource_choosed;
242 class ResourcePage: public QWizardPage
247 ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
248 virtual ~ResourcePage();
250 virtual int nextId() const;
251 virtual bool validatePage();
252 virtual void initializePage();
253 virtual void cleanupPage() {}
256 void itemSelected(QListWidgetItem * item);
259 JM::ResourceCatalog * _resource_list;
260 QLineEdit * _resource_choosed;
261 BL::SALOMEServices * _salome_services;
264 QLineEdit * _ll_value;
265 QGridLayout * _main_layout;
268 class YACSSchemaPage: public QWizardPage
273 YACSSchemaPage(QWidget * parent);
274 virtual ~YACSSchemaPage();
276 virtual bool validatePage();
277 virtual int nextId() const ;
278 virtual void cleanupPage() {}
282 void choose_env_file();
285 QLineEdit * _yacs_file_text;
286 QLineEdit * _line_env_file;
289 class CommandMainPage: public QWizardPage
294 CommandMainPage(QWidget * parent);
295 virtual ~CommandMainPage();
297 virtual bool validatePage();
298 virtual int nextId() const ;
299 virtual void cleanupPage() {}
302 void choose_command_file();
303 void choose_env_file();
306 QLineEdit * _line_command;
307 QLineEdit * _line_env_file;
310 class PythonSalomeMainPage: public QWizardPage
315 PythonSalomeMainPage(QWidget * parent);
316 virtual ~PythonSalomeMainPage();
318 virtual bool validatePage();
319 virtual int nextId() const ;
320 virtual void cleanupPage() {}
323 void choose_PythonSalome_file();
324 void choose_env_file();
327 QLineEdit * _line_PythonSalome;
328 QLineEdit * _line_env_file;
331 class AdvancedParametersPage: public QWizardPage
336 AdvancedParametersPage(BL::CreateJobWizard * parent);
337 virtual ~AdvancedParametersPage();
339 virtual int nextId() const;
340 virtual void cleanupPage() {}
343 Ui::AdvancedParametersWizardPage * ui;