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");
29 _batch_params.batch_directory = "";
30 _batch_params.maximum_duration = "";
31 _batch_params.mem_limit = 0;
32 _batch_params.mem_req_type = MEM_PER_NODE;
33 _batch_params.nb_proc = 0;
34 _batch_params.exclusive = false;
35 _files_params.result_directory = "";
36 _resource_choosed = "";
38 _state = BL::Job::CREATED;
39 _thread_state = BL::Job::NOTHING;
40 _salome_launcher_id = -1;
44 // Parameters for COORM
45 _batch_params.launcher_file = "";
46 _batch_params.launcher_args = "";
49 BL::Job::Job(const std::string & name)
51 DEBTRACE("Creating BL::Job with name : " << name);
56 _batch_params.batch_directory = "";
57 _batch_params.maximum_duration = "";
58 _batch_params.mem_limit = 0;
59 _batch_params.mem_req_type = MEM_PER_NODE;
60 _batch_params.nb_proc = 0;
61 _batch_params.exclusive = false;
62 _files_params.result_directory = "";
63 _resource_choosed = "";
65 _state = BL::Job::CREATED;
66 _thread_state = BL::Job::NOTHING;
67 _salome_launcher_id = -1;
71 // Parameters for COORM
72 _batch_params.launcher_file = "";
73 _batch_params.launcher_args = "";
80 BL::Job::setName(const std::string & name)
92 BL::Job::setType(BL::Job::JobType type)
98 BL::Job::setType(const std::string & type)
100 if (type == "command")
102 setType(BL::Job::COMMAND);
104 else if (type == "yacs_file")
106 setType(BL::Job::YACS_SCHEMA);
108 else if (type == "python_salome")
110 setType(BL::Job::PYTHON_SALOME);
121 BL::Job::setDumpYACSState(const int & dump_yacs_state)
123 _dump_yacs_state = dump_yacs_state;
127 BL::Job::getDumpYACSState()
129 return _dump_yacs_state;
133 BL::Job::setJobFile(const std::string & job_file)
135 _job_file = job_file;
139 BL::Job::getJobFile()
145 BL::Job::setEnvFile(const std::string & env_file)
147 _env_file = env_file;
151 BL::Job::getEnvFile()
157 BL::Job::setBatchParameters(const BL::Job::BatchParam & param)
159 _batch_params = param;
162 const BL::Job::BatchParam &
163 BL::Job::getBatchParameters()
165 return _batch_params;
169 BL::Job::setFilesParameters(BL::Job::FilesParam & param)
171 _files_params.result_directory = param.result_directory;
172 _files_params.input_files_list = param.input_files_list;
173 _files_params.output_files_list = param.output_files_list;
176 BL::Job::FilesParam &
177 BL::Job::getFilesParameters()
179 return _files_params;
183 BL::Job::setResource(const std::string & resource)
185 _resource_choosed = resource;
189 BL::Job::getResource()
191 return _resource_choosed;
195 BL::Job::setBatchQueue(const std::string & queue)
197 _batch_queue = queue;
201 BL::Job::getBatchQueue()
207 BL::Job::setLoadLevelerJobType(const std::string & jobtype)
209 _ll_jobtype = jobtype;
213 BL::Job::getLoadLevelerJobType()
219 BL::Job::setState(BL::Job::State state)
231 BL::Job::setStringState(const std::string & state)
233 std::string result("");
235 // Check if state is an error
236 if (state != "CREATED" &&
237 state != "IN_PROCESS" &&
239 state != "RUNNING" &&
241 state != "FINISHED" &&
243 state != "NOT_CREATED" &&
247 DEBTRACE("Error state in setStringState");
248 result = "RefreshError";
253 if (state == "CREATED")
255 if (_state != BL::Job::CREATED)
257 setState(BL::Job::CREATED);
261 else if (state == "NOT_CREATED")
263 if (_state != BL::Job::NOT_CREATED)
265 setState(BL::Job::NOT_CREATED);
269 else if (state == "QUEUED")
271 if (_state != BL::Job::QUEUED)
273 setState(BL::Job::QUEUED);
277 else if (state == "IN_PROCESS")
279 if (_state != BL::Job::IN_PROCESS)
281 setState(BL::Job::IN_PROCESS);
285 else if (state == "RUNNING")
287 if (_state != BL::Job::RUNNING)
289 setState(BL::Job::RUNNING);
293 else if (state == "PAUSED")
295 if (_state != BL::Job::PAUSED)
297 setState(BL::Job::PAUSED);
301 else if (state == "FINISHED")
303 if (_state != BL::Job::FINISHED)
305 setState(BL::Job::FINISHED);
309 else if (state == "ERROR")
311 if (_state != BL::Job::ERROR)
313 setState(BL::Job::ERROR);
317 else if (state == "FAILED")
319 if (_state != BL::Job::FAILED)
321 setState(BL::Job::FAILED);
330 BL::Job::setThreadState(BL::Job::ThreadState state)
332 _thread_state = state;
336 BL::Job::getThreadState()
338 return _thread_state;
342 BL::Job::setSalomeLauncherId(int id)
344 _salome_launcher_id = id;
348 BL::Job::getSalomeLauncherId()
350 return _salome_launcher_id;