1 // Copyright (C) 2009-2014 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
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::setWCKey(const std::string & wckey)
219 BL::Job::setExtraParams(const std::string & extra_params)
221 _extra_params = extra_params;
225 BL::Job::getExtraParams()
227 return _extra_params;
231 BL::Job::setLoadLevelerJobType(const std::string & jobtype)
233 _ll_jobtype = jobtype;
237 BL::Job::getLoadLevelerJobType()
243 BL::Job::setState(BL::Job::State state)
255 BL::Job::setStringState(const std::string & state)
257 std::string result("");
259 // Check if state is an error
260 if (state != "CREATED" &&
261 state != "IN_PROCESS" &&
263 state != "RUNNING" &&
265 state != "FINISHED" &&
267 state != "NOT_CREATED" &&
271 DEBTRACE("Error state in setStringState");
272 result = "RefreshError";
277 if (state == "CREATED")
279 if (_state != BL::Job::CREATED)
281 setState(BL::Job::CREATED);
285 else if (state == "NOT_CREATED")
287 if (_state != BL::Job::NOT_CREATED)
289 setState(BL::Job::NOT_CREATED);
293 else if (state == "QUEUED")
295 if (_state != BL::Job::QUEUED)
297 setState(BL::Job::QUEUED);
301 else if (state == "IN_PROCESS")
303 if (_state != BL::Job::IN_PROCESS)
305 setState(BL::Job::IN_PROCESS);
309 else if (state == "RUNNING")
311 if (_state != BL::Job::RUNNING)
313 setState(BL::Job::RUNNING);
317 else if (state == "PAUSED")
319 if (_state != BL::Job::PAUSED)
321 setState(BL::Job::PAUSED);
325 else if (state == "FINISHED")
327 if (_state != BL::Job::FINISHED)
329 setState(BL::Job::FINISHED);
333 else if (state == "ERROR")
335 if (_state != BL::Job::ERROR)
337 setState(BL::Job::ERROR);
341 else if (state == "FAILED")
343 if (_state != BL::Job::FAILED)
345 setState(BL::Job::FAILED);
354 BL::Job::setThreadState(BL::Job::ThreadState state)
356 _thread_state = state;
360 BL::Job::getThreadState()
362 return _thread_state;
366 BL::Job::setSalomeLauncherId(int id)
368 _salome_launcher_id = id;
372 BL::Job::getSalomeLauncherId()
374 return _salome_launcher_id;