Logo ROOT  
Reference Guide
TAlienJob.cxx
Go to the documentation of this file.
1// @(#)root/alien:$Id$
2// Author: Jan Fiete Grosse-Oetringhaus 06/10/2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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// //
14// TAlienJob //
15// //
16// Alien implentation of TGridJob //
17// //
18// Related classes are TAlienJobStatus. //
19// //
20//////////////////////////////////////////////////////////////////////////
21
22#include "TGrid.h"
23#include "TAlienJob.h"
24#include "TAlienJobStatus.h"
25#include "TObjString.h"
26#include "gapi_job_operations.h"
27
29
30
31////////////////////////////////////////////////////////////////////////////////
32/// Queries the job for its status and returns a TGridJobStatus object.
33/// Returns 0 in case of failure.
34
36{
37 TString jobID;
38 jobID = fJobID;
39
40 GAPI_JOBARRAY *gjobarray = gapi_queryjobs("-", "%", "-", "-", "-", "-",
41 jobID.Data(), "-", "-");
42
43 if (!gjobarray)
44 return 0;
45
46 if (gjobarray->size() == 0) {
47 delete gjobarray;
48 return 0;
49 }
50
51 TAlienJobStatus *status = new TAlienJobStatus();
52
53 GAPI_JOB gjob = gjobarray->at(0);
54 std::map<std::string, std::string>::const_iterator iter = gjob.gapi_jobmap.begin();
55 for (; iter != gjob.gapi_jobmap.end(); ++iter) {
56 status->fStatus.Add(new TObjString(iter->first.c_str()), new TObjString(iter->second.c_str()));
57 }
58
59 delete gjobarray;
60
61 return status;
62}
63
64////////////////////////////////////////////////////////////////////////////////
65/// Cancels a job e.g. sends a kill command.
66/// Returns kFALSE in case of failure, otherwise kTRUE.
67
69{
70 if (gGrid) {
71 return gGrid->Kill((TGridJob*)this);
72 }
73 Error("Cancel","No GRID connection (gGrid=0)");
74 return kFALSE;
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// Resubmits a job.
79/// Returns kFALSE in case of failure, otherwise kTRUE.
80
82{
83 if (gGrid) {
84 return gGrid->Resubmit((TGridJob*)this);
85 }
86 Error("Cancel","No GRID connection (gGrid=0)");
87 return kFALSE;
88}
const Bool_t kFALSE
Definition: RtypesCore.h:101
#define ClassImp(name)
Definition: Rtypes.h:375
R__EXTERN TGrid * gGrid
Definition: TGrid.h:128
virtual TGridJobStatus * GetJobStatus() const
Queries the job for its status and returns a TGridJobStatus object.
Definition: TAlienJob.cxx:35
virtual Bool_t Cancel()
Cancels a job e.g.
Definition: TAlienJob.cxx:68
virtual Bool_t Resubmit()
Resubmits a job.
Definition: TAlienJob.cxx:81
TString fJobID
Definition: TGridJob.h:34
virtual Bool_t Kill(TGridJob *gridjob)
Definition: TGrid.h:116
virtual Bool_t Resubmit(TGridJob *gridjob)
Definition: TGrid.h:118
void Add(TObject *obj) override
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
Definition: TMap.cxx:54
Collectable string class.
Definition: TObjString.h:28
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:970
Basic string class.
Definition: TString.h:136
const char * Data() const
Definition: TString.h:369