Logo ROOT   6.10/09
Reference Guide
TGLiteJobStatus.cxx
Go to the documentation of this file.
1 // @(#) root/glite:$Id$
2 // Author: Anar Manafov <A.Manafov@gsi.de> 2006-04-10
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /************************************************************************/
13 /*! \file TGLiteJobStatus.h
14 Class defining interface to a gLite result set.
15 Objects of this class are created by TGrid methods.*//*
16 
17  version number: $LastChangedRevision: 1678 $
18  created by: Anar Manafov
19  2006-04-10
20  last changed by: $LastChangedBy: manafov $ $LastChangedDate: 2008-01-21 18:22:14 +0100 (Mon, 21 Jan 2008) $
21 
22  Copyright (c) 2006-2008 GSI GridTeam. All rights reserved.
23 *************************************************************************/
24 
25 //glite-api-wrapper
26 #include <glite-api-wrapper/gLiteAPIWrapper.h>
27 // STD
28 #include <string>
29 // ROOT
30 #include "TGridJobStatus.h"
31 #include "TGLiteJobStatus.h"
32 //////////////////////////////////////////////////////////////////////////
33 //
34 // The TGLiteJobStatus class is a part of RGLite plug-in and
35 // represents a status of Grid jobs.
36 // Actually this class is responsible to retrieve a Grid job status and
37 // translate it to a TGridJobStatus::EGridJobStatus statuses.
38 //
39 // Related classes are TGLite.
40 //
41 //////////////////////////////////////////////////////////////////////////
42 
44 
45 using namespace std;
46 using namespace glite_api_wrapper;
47 
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 
51 TGLiteJobStatus::TGLiteJobStatus(TString _jobID): m_sJobID(_jobID)
52 {
53 }
54 
55 
56 ////////////////////////////////////////////////////////////////////////////////
57 /// The GetStat() method retrieves a gLite job status and
58 /// translates it to a TGridJobStatus::EGridJobStatus type.
59 /// RETURN:
60 /// a TGridJobStatus::EGridJobStatus status value.
61 
63 {
64  string sStatusName;
65  string sStatusString;
66  // Gets the status of the job reduced to the subset defined in TGridJobStatus.
67  glite::lb::JobStatus::Code code(glite::lb::JobStatus::UNDEF);
68  try {
69  code = CGLiteAPIWrapper::Instance().GetJobManager().JobStatus(m_sJobID, &sStatusName, &sStatusString);
70  } catch (const exception &e) {
71  Error("GetStatus", "Exception: %s", e.what());
72  return kUNKNOWN;
73  }
74 
75  Info("GetStatus", "JobID = %s", m_sJobID.c_str());
76  Info("GetStatus",
77  "Job status is [%d]; gLite status code is \"%s\"; gLite status string is \"%s\"",
78  code, sStatusName.c_str(), sStatusString.c_str());
79  switch (code) {
80  case glite::lb::JobStatus::DONE:
81  case glite::lb::JobStatus::CLEARED:
82  case glite::lb::JobStatus::PURGED:
83  Info("GetStatus", "Job status is kDONE");
84  return kDONE;
85  case glite::lb::JobStatus::SUBMITTED:
86  case glite::lb::JobStatus::WAITING:
87  case glite::lb::JobStatus::READY:
88  Info("GetStatus", "Job status is kWAITING");
89  return kWAITING;
90  case glite::lb::JobStatus::SCHEDULED:
91  case glite::lb::JobStatus::RUNNING:
92  Info("GetStatus", "Job status is kRUNNING");
93  return kRUNNING;
94  case glite::lb::JobStatus::ABORTED:
95  Info("GetStatus", "Job status is kABORTED");
96  return kABORTED;
97  case glite::lb::JobStatus::CANCELLED:
98  Info("GetStatus", "Job status is kFAIL");
99  return kFAIL;
100  default:
101  // glite::lb::JobStatus::CODE_MAX:
102  // glite::lb::JobStatus::UNKNOWN:
103  // glite::lb::JobStatus::UNDEF:
104  Info("GetStatus", "Job status is kUNKNOWN");
105  return kUNKNOWN;
106  }
107 }
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:847
std::string m_sJobID
virtual EGridJobStatus GetStatus() const
The GetStat() method retrieves a gLite job status and translates it to a TGridJobStatus::EGridJobStat...
STL namespace.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:873
#define ClassImp(name)
Definition: Rtypes.h:336
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
gLite implementation of TGridJobStatus