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
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;
42 _yacs_driver_options = "";
45 // Parameters for COORM
46 _batch_params.launcher_file = "";
47 _batch_params.launcher_args = "";
50 BL::Job::Job(const std::string & name)
52 DEBTRACE("Creating BL::Job with name : " << name);
57 _batch_params.batch_directory = "";
58 _batch_params.maximum_duration = "";
59 _batch_params.mem_limit = 0;
60 _batch_params.mem_req_type = MEM_PER_NODE;
61 _batch_params.nb_proc = 0;
62 _batch_params.exclusive = false;
63 _files_params.result_directory = "";
64 _resource_choosed = "";
66 _state = BL::Job::CREATED;
67 _thread_state = BL::Job::NOTHING;
68 _salome_launcher_id = -1;
70 _yacs_driver_options = "";
73 // Parameters for COORM
74 _batch_params.launcher_file = "";
75 _batch_params.launcher_args = "";
82 BL::Job::setName(const std::string & name)
94 BL::Job::setType(BL::Job::JobType type)
100 BL::Job::setType(const std::string & type)
102 if (type == "command")
104 setType(BL::Job::COMMAND);
106 else if (type == "yacs_file")
108 setType(BL::Job::YACS_SCHEMA);
110 else if (type == "python_salome")
112 setType(BL::Job::PYTHON_SALOME);
123 BL::Job::setDumpYACSState(const int & dump_yacs_state)
125 _dump_yacs_state = dump_yacs_state;
129 BL::Job::getDumpYACSState()
131 return _dump_yacs_state;
135 BL::Job::setYacsDriverOptions(const std::string& options)
137 _yacs_driver_options = options;
141 BL::Job::getYacsDriverOptions()const
143 return _yacs_driver_options;
147 BL::Job::setJobFile(const std::string & job_file)
149 _job_file = job_file;
153 BL::Job::getJobFile()
159 BL::Job::setEnvFile(const std::string & env_file)
161 _env_file = env_file;
165 BL::Job::getEnvFile()
171 BL::Job::setBatchParameters(const BL::Job::BatchParam & param)
173 _batch_params = param;
176 const BL::Job::BatchParam &
177 BL::Job::getBatchParameters()
179 return _batch_params;
183 BL::Job::setFilesParameters(BL::Job::FilesParam & param)
185 _files_params.result_directory = param.result_directory;
186 _files_params.input_files_list = param.input_files_list;
187 _files_params.output_files_list = param.output_files_list;
190 BL::Job::FilesParam &
191 BL::Job::getFilesParameters()
193 return _files_params;
197 BL::Job::setResource(const std::string & resource)
199 _resource_choosed = resource;
203 BL::Job::getResource()
205 return _resource_choosed;
209 BL::Job::setBatchQueue(const std::string & queue)
211 _batch_queue = queue;
215 BL::Job::getBatchQueue()
221 BL::Job::setWCKey(const std::string & wckey)
233 BL::Job::setExtraParams(const std::string & extra_params)
235 _extra_params = extra_params;
239 BL::Job::getExtraParams()
241 return _extra_params;
245 BL::Job::setLoadLevelerJobType(const std::string & jobtype)
247 _ll_jobtype = jobtype;
251 BL::Job::getLoadLevelerJobType()
257 BL::Job::setState(BL::Job::State state)
269 BL::Job::setStringState(const std::string & state)
271 std::string result("");
273 // Check if state is an error
274 if (state != "CREATED" &&
275 state != "IN_PROCESS" &&
277 state != "RUNNING" &&
279 state != "FINISHED" &&
281 state != "NOT_CREATED" &&
285 DEBTRACE("Error state in setStringState");
286 result = "RefreshError";
291 if (state == "CREATED")
293 if (_state != BL::Job::CREATED)
295 setState(BL::Job::CREATED);
299 else if (state == "NOT_CREATED")
301 if (_state != BL::Job::NOT_CREATED)
303 setState(BL::Job::NOT_CREATED);
307 else if (state == "QUEUED")
309 if (_state != BL::Job::QUEUED)
311 setState(BL::Job::QUEUED);
315 else if (state == "IN_PROCESS")
317 if (_state != BL::Job::IN_PROCESS)
319 setState(BL::Job::IN_PROCESS);
323 else if (state == "RUNNING")
325 if (_state != BL::Job::RUNNING)
327 setState(BL::Job::RUNNING);
331 else if (state == "PAUSED")
333 if (_state != BL::Job::PAUSED)
335 setState(BL::Job::PAUSED);
339 else if (state == "FINISHED")
341 if (_state != BL::Job::FINISHED)
343 setState(BL::Job::FINISHED);
347 else if (state == "ERROR")
349 if (_state != BL::Job::ERROR)
351 setState(BL::Job::ERROR);
355 else if (state == "FAILED")
357 if (_state != BL::Job::FAILED)
359 setState(BL::Job::FAILED);
368 BL::Job::setThreadState(BL::Job::ThreadState state)
370 _thread_state = state;
374 BL::Job::getThreadState()
376 return _thread_state;
380 BL::Job::setSalomeLauncherId(int id)
382 _salome_launcher_id = id;
386 BL::Job::getSalomeLauncherId()
388 return _salome_launcher_id;