TSlave.h

Go to the documentation of this file.
00001 // @(#)root/proof:$Id: TSlave.h 37978 2011-02-04 11:49:23Z ganis $
00002 // Author: Fons Rademakers   14/02/97
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TSlave
00013 #define ROOT_TSlave
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TSlave                                                               //
00019 //                                                                      //
00020 // This class describes a PROOF slave server.                           //
00021 // It contains information like the slaves host name, ordinal number,   //
00022 // performance index, socket, etc. Objects of this class can only be    //
00023 // created via TProof member functions.                                 //
00024 //                                                                      //
00025 //////////////////////////////////////////////////////////////////////////
00026 
00027 #ifndef ROOT_TObject
00028 #include "TObject.h"
00029 #endif
00030 #ifndef ROOT_TString
00031 #include "TString.h"
00032 #endif
00033 
00034 class TFileHandler;
00035 class TObjString;
00036 class TProof;
00037 class TSlave;
00038 class TSocket;
00039 
00040 // Special type for the hook to external function setting up authentication
00041 // related stuff for old versions. For backward compatibility.
00042 typedef Int_t (*OldSlaveAuthSetup_t)(TSocket *, Bool_t, TString, TString);
00043 
00044 // Special type for the hook to the TSlave constructor, needed to avoid
00045 // using the plugin manager
00046 typedef TSlave *(*TSlave_t)(const char *url, const char *ord, Int_t perf,
00047                             const char *image, TProof *proof, Int_t stype,
00048                             const char *workdir, const char *msd);
00049 
00050 class TSlave : public TObject {
00051 
00052 friend class TProof;
00053 friend class TProofLite;
00054 friend class TSlaveLite;
00055 friend class TXSlave;
00056 
00057 public:
00058 
00059    enum ESlaveType { kMaster, kSlave };
00060    enum ESlaveStatus { kInvalid, kActive, kInactive };
00061 
00062 private:
00063 
00064    static TSlave_t fgTXSlaveHook;
00065 
00066    TSlave(const TSlave &s) : TObject(s) { }
00067    TSlave(const char *host, const char *ord, Int_t perf,
00068           const char *image, TProof *proof, Int_t stype,
00069           const char *workdir, const char *msd);
00070 
00071    Int_t  OldAuthSetup(Bool_t master, TString wconf);
00072    void   Init(const char *host, Int_t port, Int_t stype);
00073    void   operator=(const TSlave &) { }
00074 
00075    static TSlave *Create(const char *url, const char *ord, Int_t perf,
00076                          const char *image, TProof *proof, Int_t stype,
00077                          const char *workdir, const char *msd);
00078 
00079 protected:
00080    TString       fName;      //slave's hostname
00081    TString       fImage;     //slave's image name
00082    TString       fProofWorkDir; //base proofserv working directory (info obtained from slave)
00083    TString       fWorkDir;   //slave's working directory (info obtained from slave)
00084    TString       fUser;      //slave's user id
00085    TString       fGroup;     //slave's group id
00086    Int_t         fPort;      //slave's port number
00087    TString       fOrdinal;   //slave's ordinal number
00088    Int_t         fPerfIdx;   //relative CPU performance index
00089    Int_t         fProtocol;  //slave's protocol level
00090    TSocket      *fSocket;    //socket to slave
00091    TProof       *fProof;     //proof cluster to which slave belongs
00092    TFileHandler *fInput;     //input handler related to this slave
00093    Long64_t      fBytesRead; //bytes read by slave (info is obtained from slave)
00094    Float_t       fRealTime;  //real time spent executing commands (info obtained from slave)
00095    Float_t       fCpuTime;   //CPU time spent executing commands (info obtained from slave)
00096    ESlaveType    fSlaveType; //type of slave (either kMaster or kSlave)
00097    Int_t         fStatus;    //remote return status
00098    Int_t         fParallel;  //number of active slaves
00099    TString       fMsd;       //mass storage domain of slave
00100    TString       fSessionTag;//unique tag for ths worker process
00101 
00102    TString       fROOTVers;  //ROOT version run by worker
00103    TString       fArchComp;  //Build architecture, compiler on worker (e.g. linux-gcc345)
00104 
00105    TSlave();
00106    virtual void  FlushSocket() { }
00107    void          Init(TSocket *s, Int_t stype);
00108    virtual void  Interrupt(Int_t type);
00109    virtual Int_t Ping();
00110    virtual TObjString *SendCoordinator(Int_t kind, const char *msg = 0, Int_t int2 = 0);
00111    virtual Int_t SendGroupPriority(const char * /*grp*/, Int_t /*priority*/) { return 0; }
00112    virtual void  SetAlias(const char *alias);
00113    void          SetSocket(TSocket *s) { fSocket = s; }
00114    virtual void  SetStatus(Int_t st) { fStatus = st; }
00115    virtual void  StopProcess(Bool_t abort, Int_t timeout);
00116 
00117 public:
00118    virtual ~TSlave();
00119 
00120    virtual void   Close(Option_t *opt = "");
00121 
00122    Int_t          Compare(const TObject *obj) const;
00123    Bool_t         IsSortable() const { return kTRUE; }
00124 
00125    const char    *GetName() const { return fName; }
00126    const char    *GetImage() const { return fImage; }
00127    const char    *GetProofWorkDir() const { return fProofWorkDir; }
00128    const char    *GetWorkDir() const { return fWorkDir; }
00129    const char    *GetUser() const { return fUser; }
00130    const char    *GetGroup() const { return fGroup; }
00131    Int_t          GetPort() const { return fPort; }
00132    const char    *GetOrdinal() const { return fOrdinal; }
00133    Int_t          GetPerfIdx() const { return fPerfIdx; }
00134    Int_t          GetProtocol() const { return fProtocol; }
00135    TSocket       *GetSocket() const { return fSocket; }
00136    TProof        *GetProof() const { return fProof; }
00137    Long64_t       GetBytesRead() const { return fBytesRead; }
00138    Float_t        GetRealTime() const { return fRealTime; }
00139    Float_t        GetCpuTime() const { return fCpuTime; }
00140    Int_t          GetSlaveType() const { return (Int_t)fSlaveType; }
00141    Int_t          GetStatus() const { return fStatus; }
00142    Int_t          GetParallel() const { return fParallel; }
00143    const char    *GetMsd() const { return fMsd; }
00144    const char    *GetSessionTag() const { return fSessionTag; }
00145    TFileHandler  *GetInputHandler() const { return fInput; }
00146    void           SetInputHandler(TFileHandler *ih);
00147 
00148    const char    *GetArchCompiler() const { return fArchComp; }
00149    const char    *GetROOTVersion() const { return fROOTVers; }
00150 
00151    virtual Bool_t IsValid() const { return fSocket ? kTRUE : kFALSE; }
00152 
00153    virtual void   Print(Option_t *option="") const;
00154 
00155    virtual Int_t  SetupServ(Int_t stype, const char *conffile);
00156 
00157    virtual void   SetInterruptHandler(Bool_t /* on */) { }
00158 
00159    void           SetArchCompiler(const char *ac) { fArchComp = ac; }
00160    void           SetROOTVersion(const char *rv) { fROOTVers = rv; }
00161 
00162    void           SetSessionTag(const char *st) { fSessionTag = st; }
00163 
00164    static void    SetTXSlaveHook(TSlave_t xslavehook);
00165 
00166    virtual void   Touch() { }
00167 
00168    ClassDef(TSlave,0)  //PROOF slave server
00169 };
00170 
00171 #endif

Generated on Tue Jul 5 14:28:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1