TGLiteJobStatus.cxx

Go to the documentation of this file.
00001 // @(#) root/glite:$Id: TGLiteJobStatus.cxx 24647 2008-07-03 14:20:28Z anar $
00002 // Author: Anar Manafov <A.Manafov@gsi.de> 2006-04-10
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 /************************************************************************/
00013 /*! \file TGLiteJobStatus.h
00014 Class defining interface to a gLite result set.
00015 Objects of this class are created by TGrid methods.*//*
00016 
00017          version number:    $LastChangedRevision: 1678 $
00018          created by:        Anar Manafov
00019                             2006-04-10
00020          last changed by:   $LastChangedBy: manafov $ $LastChangedDate: 2008-01-21 18:22:14 +0100 (Mon, 21 Jan 2008) $
00021 
00022          Copyright (c) 2006-2008 GSI GridTeam. All rights reserved.
00023 *************************************************************************/
00024 
00025 //glite-api-wrapper
00026 #include <glite-api-wrapper/gLiteAPIWrapper.h>
00027 // STD
00028 #include <string>
00029 // ROOT
00030 #include "TGridJobStatus.h"
00031 #include "TGLiteJobStatus.h"
00032 //////////////////////////////////////////////////////////////////////////
00033 //
00034 // The TGLiteJobStatus class is a part of RGLite plug-in and
00035 // represents a status of Grid jobs.
00036 // Actually this class is responsible to retrieve a Grid job status and
00037 // translate it to a TGridJobStatus::EGridJobStatus statuses.
00038 //
00039 // Related classes are TGLite.
00040 //
00041 //////////////////////////////////////////////////////////////////////////
00042 
00043 ClassImp(TGLiteJobStatus)
00044 
00045 using namespace std;
00046 using namespace glite_api_wrapper;
00047 
00048 
00049 //______________________________________________________________________________
00050 TGLiteJobStatus::TGLiteJobStatus(TString _jobID): m_sJobID(_jobID)
00051 {
00052 }
00053 
00054 
00055 //______________________________________________________________________________
00056 TGridJobStatus::EGridJobStatus TGLiteJobStatus::GetStatus() const
00057 {
00058    // The GetStat() method retrieves a gLite job status and
00059    // translates it to a TGridJobStatus::EGridJobStatus type.
00060    // RETURN:
00061    //      a TGridJobStatus::EGridJobStatus status value.
00062 
00063    string sStatusName;
00064    string sStatusString;
00065    // Gets the status of the job reduced to the subset defined in TGridJobStatus.
00066    glite::lb::JobStatus::Code code(glite::lb::JobStatus::UNDEF);
00067    try {
00068       code = CGLiteAPIWrapper::Instance().GetJobManager().JobStatus(m_sJobID, &sStatusName, &sStatusString);
00069    } catch (const exception &e) {
00070       Error("GetStatus", "Exception: %s", e.what());
00071       return kUNKNOWN;
00072    }
00073 
00074    Info("GetStatus", "JobID = %s", m_sJobID.c_str());
00075    Info("GetStatus",
00076         "Job status is [%d]; gLite status code is \"%s\"; gLite status string is \"%s\"",
00077         code, sStatusName.c_str(), sStatusString.c_str());
00078    switch (code) {
00079       case glite::lb::JobStatus::DONE:
00080       case glite::lb::JobStatus::CLEARED:
00081       case glite::lb::JobStatus::PURGED:
00082          Info("GetStatus", "Job status is kDONE");
00083          return kDONE;
00084       case glite::lb::JobStatus::SUBMITTED:
00085       case glite::lb::JobStatus::WAITING:
00086       case glite::lb::JobStatus::READY:
00087          Info("GetStatus", "Job status is kWAITING");
00088          return kWAITING;
00089       case glite::lb::JobStatus::SCHEDULED:
00090       case glite::lb::JobStatus::RUNNING:
00091          Info("GetStatus", "Job status is kRUNNING");
00092          return kRUNNING;
00093       case glite::lb::JobStatus::ABORTED:
00094          Info("GetStatus", "Job status is kABORTED");
00095          return kABORTED;
00096       case glite::lb::JobStatus::CANCELLED:
00097          Info("GetStatus", "Job status is kFAIL");
00098          return kFAIL;
00099       default:
00100          // glite::lb::JobStatus::CODE_MAX:
00101          // glite::lb::JobStatus::UNKNOWN:
00102          // glite::lb::JobStatus::UNDEF:
00103          Info("GetStatus", "Job status is kUNKNOWN");
00104          return kUNKNOWN;
00105    }
00106 }

Generated on Tue Jul 5 14:45:40 2011 for ROOT_528-00b_version by  doxygen 1.5.1