Logo ROOT   6.12/07
Reference Guide
TGLiteJob.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 TGLiteJob.cxx
14 gLite implementation of TGridJob*//*
15 
16  version number: $LastChangedRevision: 1678 $
17  created by: Anar Manafov
18  2006-04-10
19  last changed by: $LastChangedBy: manafov $ $LastChangedDate: 2008-01-21 18:22:14 +0100 (Mon, 21 Jan 2008) $
20 
21  Copyright (c) 2006-2008 GSI GridTeam. All rights reserved.
22 *************************************************************************/
23 
24 // glite-api-wrapper
25 #include <glite-api-wrapper/gLiteAPIWrapper.h>
26 // ROOT RGLite
27 #include "TGLiteJob.h"
28 #include "TGLiteJobStatus.h"
29 
30 //////////////////////////////////////////////////////////////////////////
31 //
32 // The TGLiteJob class is a part of RGLite plug-in and
33 // represents a Grid job and offers a possibility to
34 // query the job status and retrieve its output sandbox.
35 //
36 // Related classes are TGLite.
37 //
38 //////////////////////////////////////////////////////////////////////////
39 
41 
42 using namespace std;
43 using namespace glite_api_wrapper;
44 using namespace MiscCommon;
45 
46 ////////////////////////////////////////////////////////////////////////////////
47 /// The GetJobStatus() method queries the job for its status.
48 /// RETURN:
49 /// a TGridJobStatus object.
50 
52 {
53  // Returns 0 in case of failure.
54  return dynamic_cast<TGridJobStatus*>(new TGLiteJobStatus(fJobID));
55 }
56 
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 /// Retrieving the output sandbox files.
60 /// INPUT:
61 /// _localpath [in] - a local destination path for output sandbox.
62 /// NOTE:
63 /// The other parameter is unsupported.
64 /// RETURN:
65 /// The method returns -1 in case of errors and 0 otherwise.
66 
67 Int_t TGLiteJob::GetOutputSandbox(const char* _localpath, Option_t* /*opt*/)
68 {
69  // TODO: Add Info message;
70  // TODO: Add option "nopurge" to TGLiteJob::GetOutputSandbox, since it's supported now by glite-api-wrapper
71  try {
72  CJobManager::delivered_output_t joboutput_path;
73  CGLiteAPIWrapper::Instance().GetJobManager().JobOutput(string(fJobID), _localpath, &joboutput_path);
74 
75  // Print all output directories
76  CJobManager::delivered_output_t::const_iterator iter = joboutput_path.begin();
77  CJobManager::delivered_output_t::const_iterator iter_end = joboutput_path.end();
78  Info("GetOutputSandbox", "The output has been delivered [ job ] -> [local output directory]");
79  for (; iter != iter_end; ++iter) {
80  stringstream ss;
81  ss << "[" << iter->first << "] -> [" << iter->second << "]";
82  Info("GetOutputSandbox", ss.str().c_str());
83  }
84  return 0;
85  } catch (const exception &_e) {
86  Error("GetOutputSandbox", "Exception: %s", _e.what());
87  return -1;
88  }
89 }
90 
91 
92 ////////////////////////////////////////////////////////////////////////////////
93 /// Not implemented for RGLite.
94 
96 {
97  MayNotUse("Resubmit");
98  return kFALSE;
99 }
100 
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 /// The Cancel() method cancels a gLite job, which was assigned to the class.
104 /// RETURN:
105 /// kTRUE if succeeded and kFALSE otherwise.
106 
108 {
109  try {
110  CGLiteAPIWrapper::Instance().GetJobManager().JobCancel(string(fJobID));
111  } catch (const exception &_e) {
112  Error("Cancel", "Exception: %s", _e.what());
113  return kFALSE;
114  }
115  return kTRUE;
116 }
virtual Bool_t Cancel()
The Cancel() method cancels a gLite job, which was assigned to the class.
Definition: TGLiteJob.cxx:107
const char Option_t
Definition: RtypesCore.h:62
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
STL namespace.
Int_t GetOutputSandbox(const char *_localpath, Option_t *=0)
Retrieving the output sandbox files.
Definition: TGLiteJob.cxx:67
void Info(const char *location, const char *msgfmt,...)
gLite implementation of TGridJob
void Error(const char *location, const char *msgfmt,...)
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
Definition: TError.cxx:269
const Bool_t kFALSE
Definition: RtypesCore.h:88
#define ClassImp(name)
Definition: Rtypes.h:359
virtual TGridJobStatus * GetJobStatus() const
The GetJobStatus() method queries the job for its status.
Definition: TGLiteJob.cxx:51
virtual Bool_t Resubmit()
Not implemented for RGLite.
Definition: TGLiteJob.cxx:95
gLite implementation of TGridJobStatus
const Bool_t kTRUE
Definition: RtypesCore.h:87