Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 };
38  enum CatalogType { kFailed = -1, kFile = 0, kDirectory, kCollection };
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