Logo ROOT   6.12/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 #include "TGrid.h"
25 
26 #include "TList.h"
27 
28 class GapiUI;
29 class TGridJob;
30 class TGridJobStatusList;
31 class TMap;
32 
33 
34 class TAlien : public TGrid {
35 
36 public:
37  enum { kSTDOUT = 0, kSTDERR = 1 , kOUTPUT = 2, kENVIR = 3 };
39 
40 private:
41  // Stream content types.
42  // The streams are originally defined in the CODEC.h of
43  // the external gapiUI library.
44 
45  GapiUI *fGc; // the GapiUI object implementing the communication layer
46  TString fPwd; // working directory
47  TString fHome; // home directory with alien:// prefix
48 
49  TGridResult *Command(const char *command, bool interactive = kFALSE,
50  UInt_t stream = kOUTPUT);
51  virtual TGridResult *Query(const char *path, const char *pattern,
52  const char *conditions = "", const char *options = "");
53 
54  virtual TGridResult *LocateSites();
55  virtual TGridResult *OpenDataset(const char *lfn, const char *options = "");
56 
57 public:
58  TAlien(const char *gridurl, const char *uid=0, const char *passwd=0,
59  const char *options=0);
60  virtual ~TAlien();
61 
62  void Shell(); // start an interactive ALIEN shell
63 
64  void Stdout(); // print the stdout of the last executed command
65  void Stderr(); // print the stderr of the last executed command
66 
67  TMap *GetColumn(UInt_t stream=0, UInt_t column=0);
68  UInt_t GetNColumns(UInt_t stream);
69 
70  const char *GetStreamFieldValue(UInt_t stream, UInt_t column, UInt_t row);
71  const char *GetStreamFieldKey(UInt_t stream, UInt_t column, UInt_t row);
72 
73  TString Escape(const char *input);
74  virtual TGridJob *Submit(const char *jdl); // submit a grid job
75  virtual TGridJDL *GetJDLGenerator(); // get a AliEn grid JDL object
76  virtual TGridCollection* OpenCollection(const char* collectionfile, UInt_t maxentries = kTRUE);
77  virtual TGridCollection* OpenCollectionQuery(TGridResult * queryresult, Bool_t nogrouping = kFALSE);
78  virtual TGridJobStatusList* Ps(const char* options, Bool_t verbose = kTRUE);
79  virtual Bool_t KillById(TString jobid);
80  virtual Bool_t ResubmitById(TString jobid);
81 
82  //--- Catalogue Interface
83  virtual TGridResult *Ls(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE);
84  virtual const char *Pwd(Bool_t verbose=kFALSE);
85  virtual const char *GetHomeDirectory() { return fHome.Data(); }
86  virtual Bool_t Cd(const char *ldn="", Bool_t verbose=kFALSE);
87  virtual Int_t Mkdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE);
88  virtual Bool_t Rmdir(const char *ldn="", Option_t *options="", Bool_t verbose=kFALSE);
89  virtual Bool_t Register(const char *lfn, const char *turl, Long_t size=-1,
90  const char *se=0, const char *guid=0, Bool_t verbose=kFALSE);
91  virtual Bool_t Rm(const char *lfn, Option_t *option="", Bool_t verbose=kFALSE);
92  virtual CatalogType Type(const char* lfn, Option_t* option = "", Bool_t verbose=kFALSE);
93  virtual TGridResult* GetCollection(const char* lfn, Option_t* option = "", Bool_t verbose=kFALSE);
94 
95  //--- Software Packages
96  virtual TGridResult* ListPackages(const char* alienpackagedir="/alice/packages");
97  ClassDef(TAlien,0) // Interface to Alien GRID services
98 };
99 
100 #endif
TString fPwd
Definition: TAlien.h:46
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:38
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:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
GapiUI * fGc
Definition: TAlien.h:45
Definition: TAlien.h:34
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:320
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
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:85
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
virtual TGridJob * Submit(const char *jdl)
Submit a command to AliEn. Returns 0 in case of error.
Definition: TAlien.cxx:231
const Bool_t kFALSE
Definition: RtypesCore.h:88
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:40
TString fHome
Definition: TAlien.h:47
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:45
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
const Bool_t kTRUE
Definition: RtypesCore.h:87
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:345