Logo ROOT   6.08/07
Reference Guide
TAlien.h
Go to the documentation of this file.
1 // @(#)root/alien:$Id$
2 // Author: Andreas Peters 5/5/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, 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 #ifndef ROOT_TAlien
13 #define ROOT_TAlien
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TAlien //
19 // //
20 // Class defining interface to TAlien GRID services. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TGrid
25 #include "TGrid.h"
26 #endif
27 
28 #ifndef ROOT_TList
29 #include "TList.h"
30 #endif
31 
32 class GapiUI;
33 class TGridJob;
34 class TGridJobStatusList;
35 class TMap;
36 
37 
38 class TAlien : public TGrid {
39 
40 public:
41  enum { kSTDOUT = 0, kSTDERR = 1 , kOUTPUT = 2, kENVIR = 3 };
43 
44 private:
45  // Stream content types.
46  // The streams are originally defined in the CODEC.h of
47  // the external gapiUI library.
48 
49  GapiUI *fGc; // the GapiUI object implementing the communication layer
50  TString fPwd; // working directory
51  TString fHome; // home directory with alien:// prefix
52 
53  TGridResult *Command(const char *command, bool interactive = kFALSE,
54  UInt_t stream = kOUTPUT);
55  virtual TGridResult *Query(const char *path, const char *pattern,
56  const char *conditions = "", const char *options = "");
57 
58  virtual TGridResult *LocateSites();
59  virtual TGridResult *OpenDataset(const char *lfn, const char *options = "");
60 
61 public:
62  TAlien(const char *gridurl, const char *uid=0, const char *passwd=0,
63  const char *options=0);
64  virtual ~TAlien();
65 
66  void Shell(); // start an interactive ALIEN shell
67 
68  void Stdout(); // print the stdout of the last executed command
69  void Stderr(); // print the stderr of the last executed command
70 
71  TMap *GetColumn(UInt_t stream=0, UInt_t column=0);
72  UInt_t GetNColumns(UInt_t stream);
73 
74  const char *GetStreamFieldValue(UInt_t stream, UInt_t column, UInt_t row);
75  const char *GetStreamFieldKey(UInt_t stream, UInt_t column, UInt_t row);
76 
77  TString Escape(const char *input);
78  virtual TGridJob *Submit(const char *jdl); // submit a grid job
79  virtual TGridJDL *GetJDLGenerator(); // get a AliEn grid JDL object
80  virtual TGridCollection* OpenCollection(const char* collectionfile, UInt_t maxentries = kTRUE);
81  virtual TGridCollection* OpenCollectionQuery(TGridResult * queryresult, Bool_t nogrouping = kFALSE);
82  virtual TGridJobStatusList* Ps(const char* options, Bool_t verbose = kTRUE);
83  virtual Bool_t KillById(TString jobid);
84  virtual Bool_t ResubmitById(TString jobid);
85 
86  //--- Catalogue Interface
87  virtual TGridResult *Ls(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE);
88  virtual const char *Pwd(Bool_t verbose=kFALSE);
89  virtual const char *GetHomeDirectory() { return fHome.Data(); }
90  virtual Bool_t Cd(const char *ldn="", Bool_t verbose=kFALSE);
91  virtual Int_t Mkdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE);
92  virtual Bool_t Rmdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE);
93  virtual Bool_t Register(const char *lfn, const char *turl, Long_t size=-1,
94  const char *se=0, const char *guid=0, Bool_t verbose=kFALSE);
95  virtual Bool_t Rm(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE);
96  virtual CatalogType Type(const char* lfn, Option_t* option = "", Bool_t verbose=kFALSE);
97  virtual TGridResult* GetCollection(const char* lfn, Option_t* option = "", Bool_t verbose=kFALSE);
98 
99  //--- Software Packages
100  virtual TGridResult* ListPackages(const char* alienpackagedir="/alice/packages");
101  ClassDef(TAlien,0) // Interface to Alien GRID services
102 };
103 
104 #endif
TString fPwd
Definition: TAlien.h:50
virtual Bool_t ResubmitById(TString jobid)
Resubmit a specific job.
Definition: TAlien.cxx:335
virtual Int_t Mkdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:521
CatalogType
Definition: TAlien.h:42
void Stderr()
Definition: TAlien.cxx:391
const char Option_t
Definition: RtypesCore.h:62
virtual Bool_t Register(const char *lfn, const char *turl, Long_t size=-1, const char *se=0, const char *guid=0, Bool_t verbose=kFALSE)
Definition: TAlien.cxx:584
virtual CatalogType Type(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
returns the type of the given lfn
Definition: TAlien.cxx:686
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
GapiUI * fGc
Definition: TAlien.h:49
Definition: TAlien.h:38
TString Escape(const char *input)
Escape " by \".
Definition: TAlien.cxx:217
const char * GetStreamFieldKey(UInt_t stream, UInt_t column, UInt_t row)
Definition: TAlien.cxx:436
virtual TGridJobStatusList * Ps(const char *options, Bool_t verbose=kTRUE)
Get job status list.
Definition: TAlien.cxx:290
virtual TGridCollection * OpenCollection(const char *collectionfile, UInt_t maxentries=kTRUE)
Factory function for a TAlienCollection based on an XML file.
Definition: TAlien.cxx:646
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual const char * Pwd(Bool_t verbose=kFALSE)
Definition: TAlien.cxx:488
void Shell()
Start an interactive AliEn shell.
Definition: TAlien.cxx:209
virtual Bool_t Rmdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:553
static const std::string pattern("pattern")
virtual TGridCollection * OpenCollectionQuery(TGridResult *queryresult, Bool_t nogrouping=kFALSE)
Factory function fo a TAlienCollection based on a gGrid Query.
Definition: TAlien.cxx:677
virtual const char * GetHomeDirectory()
Definition: TAlien.h:89
virtual TGridResult * ListPackages(const char *alienpackagedir="/alice/packages")
List packages in the specified directory.
Definition: TAlien.cxx:745
virtual ~TAlien()
do we need to delete fGc ? (rdm)
Definition: TAlien.cxx:200
unsigned int UInt_t
Definition: RtypesCore.h:42
bool verbose
virtual TGridJob * Submit(const char *jdl)
Submit a command to AliEn. Returns 0 in case of error.
Definition: TAlien.cxx:231
virtual Bool_t Cd(const char *ldn="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:461
long Long_t
Definition: RtypesCore.h:50
virtual TGridResult * Ls(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:452
virtual Bool_t Rm(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:619
virtual Bool_t KillById(TString jobid)
Kill a specific job.
Definition: TAlien.cxx:324
virtual TGridResult * OpenDataset(const char *lfn, const char *options="")
Definition: TAlien.cxx:409
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
TString fHome
Definition: TAlien.h:51
virtual TGridResult * LocateSites()
Definition: TAlien.cxx:375
UInt_t GetNColumns(UInt_t stream)
Definition: TAlien.cxx:443
TAlien(const char *gridurl, const char *uid=0, const char *passwd=0, const char *options=0)
Definition: TAlien.cxx:90
const char * GetStreamFieldValue(UInt_t stream, UInt_t column, UInt_t row)
Definition: TAlien.cxx:429
virtual TGridResult * GetCollection(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE)
Definition: TAlien.cxx:728
virtual TGridResult * Query(const char *path, const char *pattern, const char *conditions="", const char *options="")
Definition: TAlien.cxx:400
void Stdout()
Definition: TAlien.cxx:382
Definition: TGrid.h:51
const Bool_t kTRUE
Definition: Rtypes.h:91
TGridResult * Command(const char *command, bool interactive=kFALSE, UInt_t stream=kOUTPUT)
Execute AliEn command. Returns 0 in case or error.
Definition: TAlien.cxx:346
virtual TGridJDL * GetJDLGenerator()
Create a Alien JDL.
Definition: TAlien.cxx:282
TMap * GetColumn(UInt_t stream=0, UInt_t column=0)
Definition: TAlien.cxx:417
const char * Data() const
Definition: TString.h:349