1 // Copyright (C) 2009-2012 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 _files_params.result_directory = "";
33 _resource_choosed = "";
35 _state = BL::Job::CREATED;
36 _thread_state = BL::Job::NOTHING;
37 _salome_launcher_id = -1;
42 BL::Job::Job(const std::string & name)
44 DEBTRACE("Creating BL::Job with name : " << name);
48 _batch_params.batch_directory = "";
49 _batch_params.maximum_duration = "";
50 _batch_params.expected_memory = "";
51 _batch_params.nb_proc = 0;
52 _files_params.result_directory = "";
53 _resource_choosed = "";
55 _state = BL::Job::CREATED;
56 _thread_state = BL::Job::NOTHING;
57 _salome_launcher_id = -1;
66 BL::Job::setName(const std::string & name)
78 BL::Job::setType(BL::Job::JobType type)
84 BL::Job::setType(const std::string & type)
86 if (type == "command")
88 setType(BL::Job::COMMAND);
90 else if (type == "yacs_file")
92 setType(BL::Job::YACS_SCHEMA);
94 else if (type == "python_salome")
96 setType(BL::Job::PYTHON_SALOME);
107 BL::Job::setDumpYACSState(const int & dump_yacs_state)
109 _dump_yacs_state = dump_yacs_state;
113 BL::Job::getDumpYACSState()
115 return _dump_yacs_state;
119 BL::Job::setJobFile(const std::string & job_file)
121 _job_file = job_file;
125 BL::Job::getJobFile()
131 BL::Job::setEnvFile(const std::string & env_file)
133 _env_file = env_file;
137 BL::Job::getEnvFile()
143 BL::Job::setBatchParameters(BL::Job::BatchParam & param)
145 _batch_params.batch_directory = param.batch_directory;
146 _batch_params.maximum_duration = param.maximum_duration;
147 _batch_params.expected_memory = param.expected_memory;
148 _batch_params.nb_proc = param.nb_proc;
151 BL::Job::BatchParam &
152 BL::Job::getBatchParameters()
154 return _batch_params;
158 BL::Job::setFilesParameters(BL::Job::FilesParam & param)
160 _files_params.result_directory = param.result_directory;
161 _files_params.input_files_list = param.input_files_list;
162 _files_params.output_files_list = param.output_files_list;
165 BL::Job::FilesParam &
166 BL::Job::getFilesParameters()
168 return _files_params;
172 BL::Job::setResource(const std::string & resource)
174 _resource_choosed = resource;
178 BL::Job::getResource()
180 return _resource_choosed;
184 BL::Job::setBatchQueue(const std::string & queue)
186 _batch_queue = queue;
190 BL::Job::getBatchQueue()
196 BL::Job::setLoadLevelerJobType(const std::string & jobtype)
198 _ll_jobtype = jobtype;
202 BL::Job::getLoadLevelerJobType()
208 BL::Job::setState(BL::Job::State state)
220 BL::Job::setStringState(const std::string & state)
222 std::string result("");
224 // Check if state is an error
225 if (state != "CREATED" &&
226 state != "IN_PROCESS" &&
228 state != "RUNNING" &&
230 state != "FINISHED" &&
232 state != "NOT_CREATED" &&
236 DEBTRACE("Error state in setStringState");
237 result = "RefreshError";
242 if (state == "CREATED")
244 if (_state != BL::Job::CREATED)
246 setState(BL::Job::CREATED);
250 else if (state == "NOT_CREATED")
252 if (_state != BL::Job::NOT_CREATED)
254 setState(BL::Job::NOT_CREATED);
258 else if (state == "QUEUED")
260 if (_state != BL::Job::QUEUED)
262 setState(BL::Job::QUEUED);
266 else if (state == "IN_PROCESS")
268 if (_state != BL::Job::IN_PROCESS)
270 setState(BL::Job::IN_PROCESS);
274 else if (state == "RUNNING")
276 if (_state != BL::Job::RUNNING)
278 setState(BL::Job::RUNNING);
282 else if (state == "PAUSED")
284 if (_state != BL::Job::PAUSED)
286 setState(BL::Job::PAUSED);
290 else if (state == "FINISHED")
292 if (_state != BL::Job::FINISHED)
294 setState(BL::Job::FINISHED);
298 else if (state == "ERROR")
300 if (_state != BL::Job::ERROR)
302 setState(BL::Job::ERROR);
306 else if (state == "FAILED")
308 if (_state != BL::Job::FAILED)
310 setState(BL::Job::FAILED);
319 BL::Job::setThreadState(BL::Job::ThreadState state)
321 _thread_state = state;
325 BL::Job::getThreadState()
327 return _thread_state;
331 BL::Job::setSalomeLauncherId(int id)
333 _salome_launcher_id = id;
337 BL::Job::getSalomeLauncherId()
339 return _salome_launcher_id;