1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 * Batch_JobInfo_eLL.cxx :
25 * Created on: 30 nov. 2010
26 * Author : Renaud BARATE - EDF R&D
33 #include <Batch_RunTimeException.hxx>
35 #include "Batch_JobInfo_eLL.hxx"
41 JobInfo_eLL::JobInfo_eLL(const std::string & id, const std::string & logFile)
47 ifstream log(logFile.c_str());
50 // status should be on the third line
51 for (int i=0 ; i<3 ; i++)
55 istringstream iss(line);
58 if (status.size() == 0) {
59 // On some batch managers, the job is deleted as soon as it is finished,
60 // so we have to consider that an unknown job is a finished one, even if
61 // it is not always true.
62 _param[STATE] = FINISHED;
63 } else if (status == "C") { // Completed
64 _param[STATE] = FINISHED;
65 } else if (status == "R") { // Running
66 _param[STATE] = RUNNING;
67 } else if (status == "I") { // Idle
68 _param[STATE] = QUEUED;
69 } else if (status == "CA") { // Canceled
70 _param[STATE] = FAILED;
71 } else if (status == "CK") { // Checkpointing
72 _param[STATE] = RUNNING;
73 } else if (status == "CP") { // Complete Pending
74 _param[STATE] = RUNNING;
75 } else if (status == "D") { // Deferred
76 _param[STATE] = QUEUED;
77 } else if (status == "NQ") { // Not Queued
78 _param[STATE] = QUEUED;
79 } else if (status == "NR") { // Not Run
80 _param[STATE] = FAILED;
81 } else if (status == "P") { // Pending
82 _param[STATE] = RUNNING;
83 } else if (status == "E") { // Preempted
84 _param[STATE] = RUNNING;
85 } else if (status == "EP") { // Preempt Pending
86 _param[STATE] = RUNNING;
87 } else if (status == "X") { // Rejected
88 _param[STATE] = FAILED;
89 } else if (status == "XP") { // Reject Pending
90 _param[STATE] = QUEUED;
91 } else if (status == "RM") { // Removed
92 _param[STATE] = FAILED;
93 } else if (status == "RP") { // Remove Pending
94 _param[STATE] = FAILED;
95 } else if (status == "MP") { // Resume Pending
96 _param[STATE] = RUNNING;
97 } else if (status == "ST") { // Starting
98 _param[STATE] = RUNNING;
99 } else if (status == "S") { // System Hold
100 _param[STATE] = PAUSED;
101 } else if (status == "TX") { // Terminated
102 _param[STATE] = FAILED;
103 } else if (status == "HS") { // User & System Hold
104 _param[STATE] = PAUSED;
105 } else if (status == "H") { // User Hold
106 _param[STATE] = PAUSED;
107 } else if (status == "V") { // Vacated
108 _param[STATE] = FAILED;
109 } else if (status == "VP") { // Vacate Pending
110 _param[STATE] = FAILED;
112 throw RunTimeException("Unknown job state code: \"" + status + "\"");
116 JobInfo_eLL::~JobInfo_eLL()