1 // Copyright (C) 2009-2013 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.
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
24 DEBTRACE("Creating BL::Job");
28 _batch_params.batch_directory = "";
29 _batch_params.maximum_duration = "";
30 _batch_params.expected_memory = "";
31 _batch_params.nb_proc = 0;
32 _batch_params.exclusive = false;
33 _files_params.result_directory = "";
34 _resource_choosed = "";
36 _state = BL::Job::CREATED;
37 _thread_state = BL::Job::NOTHING;
38 _salome_launcher_id = -1;
42 // Parameters for COORM
43 _batch_params.launcher_file = "";
44 _batch_params.launcher_args = "";
47 BL::Job::Job(const std::string & name)
49 DEBTRACE("Creating BL::Job with name : " << name);
53 _batch_params.batch_directory = "";
54 _batch_params.maximum_duration = "";
55 _batch_params.expected_memory = "";
56 _batch_params.nb_proc = 0;
57 _batch_params.exclusive = false;
58 _files_params.result_directory = "";
59 _resource_choosed = "";
61 _state = BL::Job::CREATED;
62 _thread_state = BL::Job::NOTHING;
63 _salome_launcher_id = -1;
67 // Parameters for COORM
68 _batch_params.launcher_file = "";
69 _batch_params.launcher_args = "";
76 BL::Job::setName(const std::string & name)
88 BL::Job::setType(BL::Job::JobType type)
94 BL::Job::setType(const std::string & type)
96 if (type == "command")
98 setType(BL::Job::COMMAND);
100 else if (type == "yacs_file")
102 setType(BL::Job::YACS_SCHEMA);
104 else if (type == "python_salome")
106 setType(BL::Job::PYTHON_SALOME);
117 BL::Job::setDumpYACSState(const int & dump_yacs_state)
119 _dump_yacs_state = dump_yacs_state;
123 BL::Job::getDumpYACSState()
125 return _dump_yacs_state;
129 BL::Job::setJobFile(const std::string & job_file)
131 _job_file = job_file;
135 BL::Job::getJobFile()
141 BL::Job::setEnvFile(const std::string & env_file)
143 _env_file = env_file;
147 BL::Job::getEnvFile()
153 BL::Job::setBatchParameters(const BL::Job::BatchParam & param)
155 _batch_params = param;
158 const BL::Job::BatchParam &
159 BL::Job::getBatchParameters()
161 return _batch_params;
165 BL::Job::setFilesParameters(BL::Job::FilesParam & param)
167 _files_params.result_directory = param.result_directory;
168 _files_params.input_files_list = param.input_files_list;
169 _files_params.output_files_list = param.output_files_list;
172 BL::Job::FilesParam &
173 BL::Job::getFilesParameters()
175 return _files_params;
179 BL::Job::setResource(const std::string & resource)
181 _resource_choosed = resource;
185 BL::Job::getResource()
187 return _resource_choosed;
191 BL::Job::setBatchQueue(const std::string & queue)
193 _batch_queue = queue;
197 BL::Job::getBatchQueue()
203 BL::Job::setLoadLevelerJobType(const std::string & jobtype)
205 _ll_jobtype = jobtype;
209 BL::Job::getLoadLevelerJobType()
215 BL::Job::setState(BL::Job::State state)
227 BL::Job::setStringState(const std::string & state)
229 std::string result("");
231 // Check if state is an error
232 if (state != "CREATED" &&
233 state != "IN_PROCESS" &&
235 state != "RUNNING" &&
237 state != "FINISHED" &&
239 state != "NOT_CREATED" &&
243 DEBTRACE("Error state in setStringState");
244 result = "RefreshError";
249 if (state == "CREATED")
251 if (_state != BL::Job::CREATED)
253 setState(BL::Job::CREATED);
257 else if (state == "NOT_CREATED")
259 if (_state != BL::Job::NOT_CREATED)
261 setState(BL::Job::NOT_CREATED);
265 else if (state == "QUEUED")
267 if (_state != BL::Job::QUEUED)
269 setState(BL::Job::QUEUED);
273 else if (state == "IN_PROCESS")
275 if (_state != BL::Job::IN_PROCESS)
277 setState(BL::Job::IN_PROCESS);
281 else if (state == "RUNNING")
283 if (_state != BL::Job::RUNNING)
285 setState(BL::Job::RUNNING);
289 else if (state == "PAUSED")
291 if (_state != BL::Job::PAUSED)
293 setState(BL::Job::PAUSED);
297 else if (state == "FINISHED")
299 if (_state != BL::Job::FINISHED)
301 setState(BL::Job::FINISHED);
305 else if (state == "ERROR")
307 if (_state != BL::Job::ERROR)
309 setState(BL::Job::ERROR);
313 else if (state == "FAILED")
315 if (_state != BL::Job::FAILED)
317 setState(BL::Job::FAILED);
326 BL::Job::setThreadState(BL::Job::ThreadState state)
328 _thread_state = state;
332 BL::Job::getThreadState()
334 return _thread_state;
338 BL::Job::setSalomeLauncherId(int id)
340 _salome_launcher_id = id;
344 BL::Job::getSalomeLauncherId()
346 return _salome_launcher_id;