Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:04

0001 // @(#)root/net:$Id$
0002 // Author: Fons Rademakers   3/1/2002
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGrid
0013 #define ROOT_TGrid
0014 
0015 //////////////////////////////////////////////////////////////////////////
0016 //                                                                      //
0017 // TGrid                                                                //
0018 //                                                                      //
0019 // Abstract base class defining interface to common GRID services.      //
0020 //                                                                      //
0021 // To open a connection to a GRID use the static method Connect().      //
0022 // The argument of Connect() is of the form:                            //
0023 //    <grid>://<host>[:<port>], e.g. alien://alice.cern.ch              //
0024 // Depending on the <grid> specified an appropriate plugin library      //
0025 // will be loaded which will provide the real interface.                //
0026 //                                                                      //
0027 // Related classes are TGridResult.                                     //
0028 //                                                                      //
0029 //////////////////////////////////////////////////////////////////////////
0030 
0031 #include "TObject.h"
0032 
0033 #include "TString.h"
0034 
0035 #include "TGridJob.h"
0036 
0037 class TGridResult;
0038 class TGridJDL;
0039 class TGridJob;
0040 class TGridCollection;
0041 class TGridJobStatusList;
0042 
0043 
0044 class TGrid : public TObject {
0045 
0046 protected:
0047    TString        fGridUrl; // the GRID url used to create the grid connection
0048    TString        fGrid;    // type of GRID (AliEn, ...)
0049    TString        fHost;    // GRID portal to which we are connected
0050    TString        fUser;    // user name
0051    TString        fPw;      // user passwd
0052    TString        fOptions; // options specified
0053    Int_t          fPort;    // port to which we are connected
0054 
0055 public:
0056    TGrid() : fGridUrl(), fGrid(), fHost(), fUser(), fPw(), fOptions(), fPort(-1) {}
0057    virtual ~TGrid() {}
0058 
0059    const char    *GridUrl() const { return fGridUrl; }
0060    const char    *GetGrid() const { return fGrid; }
0061    const char    *GetHost() const { return fHost; }
0062    const char    *GetUser() const { return fUser; }
0063    const char    *GetPw() const { return fPw; }
0064    const char    *GetOptions() const { return fOptions; }
0065    Int_t          GetPort() const { return fPort; }
0066    virtual Bool_t IsConnected() const { return fPort == -1 ? kFALSE : kTRUE; }
0067 
0068    virtual void Shell() { MayNotUse("Shell"); }
0069    virtual void Stdout() { MayNotUse("Stdout"); }
0070    virtual void Stderr() { MayNotUse("Stderr"); }
0071 
0072    virtual TGridResult *Command(const char * /*command*/,
0073                                 Bool_t /*interactive*/ = kFALSE,
0074                                 UInt_t /*stream*/ = 2)
0075       { MayNotUse("Command"); return nullptr; }
0076 
0077    virtual TGridResult *Query(const char * /*path*/, const char * /*pattern*/,
0078                               const char * /*conditions*/ = "", const char * /*options*/ = "")
0079       { MayNotUse("Query"); return nullptr; }
0080 
0081    virtual TGridResult *LocateSites() { MayNotUse("LocalSites"); return nullptr; }
0082 
0083    //--- Catalogue Interface
0084    virtual TGridResult *Ls(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
0085       { MayNotUse("Ls"); return nullptr; }
0086    virtual const char  *Pwd(Bool_t /*verbose*/ =kFALSE)
0087       { MayNotUse("Pwd"); return nullptr; }
0088    virtual const char  *GetHomeDirectory()
0089       { MayNotUse("GetHomeDirectory"); return nullptr; }
0090    virtual Bool_t Cd(const char* /*ldn*/ ="",Bool_t /*verbose*/ =kFALSE)
0091       { MayNotUse("Cd"); return kFALSE; }
0092    virtual Int_t  Mkdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
0093       { MayNotUse("Mkdir"); return kFALSE; }
0094    virtual Bool_t Rmdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE)
0095       { MayNotUse("Mkdir"); return kFALSE; }
0096    virtual Bool_t Register(const char* /*lfn*/ , const char* /*turl*/ , Long_t /*size*/ =-1, const char* /*se*/ =nullptr, const char* /*guid*/ =nullptr, Bool_t /*verbose*/ =kFALSE)
0097       { MayNotUse("Mkdir"); return kFALSE; }
0098    virtual Bool_t Rm(const char* /*lfn*/ , Option_t* /*option*/ ="", Bool_t /*verbose*/ =kFALSE)
0099       { MayNotUse("Mkdir"); return kFALSE; }
0100 
0101    //--- Job Submission Interface
0102    virtual TGridJob *Submit(const char * /*jdl*/)
0103       { MayNotUse("Submit"); return nullptr; }
0104    virtual TGridJDL *GetJDLGenerator()
0105       { MayNotUse("GetJDLGenerator"); return nullptr; }
0106    virtual TGridCollection *OpenCollection(const char *, UInt_t /*maxentries*/ = 1000000)
0107       { MayNotUse("OpenCollection"); return nullptr; }
0108    virtual TGridCollection *OpenCollectionQuery(TGridResult * /*queryresult*/,Bool_t /*nogrouping*/ = kFALSE)
0109       { MayNotUse("OpenCollection"); return nullptr; }
0110    virtual TGridJobStatusList* Ps(const char* /*options*/, Bool_t /*verbose*/ = kTRUE)
0111       { MayNotUse("Ps"); return nullptr; }
0112    virtual Bool_t KillById(TString /*jobid*/)
0113       { MayNotUse("KillById"); return kFALSE; }
0114    virtual Bool_t ResubmitById(TString /*jobid*/)
0115       { MayNotUse("ResubmitById"); return kFALSE; }
0116    virtual Bool_t Kill(TGridJob *gridjob)
0117       { return ((gridjob)?KillById(gridjob->GetJobID()):kFALSE); }
0118    virtual Bool_t Resubmit(TGridJob* gridjob)
0119       { return ((gridjob)?ResubmitById(gridjob->GetJobID()):kFALSE); }
0120 
0121    //--- Load desired plugin and setup conection to GRID
0122    static TGrid *Connect(const char *grid, const char *uid = nullptr,
0123                          const char *pw = nullptr, const char *options = nullptr);
0124 
0125    ClassDefOverride(TGrid,0)  // ABC defining interface to GRID services
0126 };
0127 
0128 R__EXTERN TGrid *gGrid;
0129 
0130 #endif