Logo ROOT   6.08/07
Reference Guide
Go to the documentation of this file.
1 // @(#)root/proof:$Id$
2 // Author: Fons Rademakers 14/02/97
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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  *************************************************************************/
12 #ifndef ROOT_TSlave
13 #define ROOT_TSlave
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TSlave //
19 // //
20 // This class describes a PROOF slave server. //
21 // It contains information like the slaves host name, ordinal number, //
22 // performance index, socket, etc. Objects of this class can only be //
23 // created via TProof member functions. //
24 // //
25 //////////////////////////////////////////////////////////////////////////
27 #ifndef ROOT_TObject
28 #include "TObject.h"
29 #endif
30 #ifndef ROOT_TString
31 #include "TString.h"
32 #endif
34 class TFileHandler;
35 class TObjString;
36 class TProof;
37 class TSlave;
38 class TSocket;
40 // Special type for the hook to external function setting up authentication
41 // related stuff for old versions. For backward compatibility.
44 // Special type for the hook to the TSlave constructor, needed to avoid
45 // using the plugin manager
46 typedef TSlave *(*TSlave_t)(const char *url, const char *ord, Int_t perf,
47  const char *image, TProof *proof, Int_t stype,
48  const char *workdir, const char *msd, Int_t nwk);
50 class TSlave : public TObject {
52 friend class TProof;
53 friend class TProofLite;
54 friend class TSlaveLite;
55 friend class TXSlave;
57 public:
61  enum EStatusBits {
62  kOutputRequested = BIT(15) // If output has been requested
63  };
65 private:
69  TSlave(const TSlave &s) : TObject(s) { }
70  TSlave(const char *host, const char *ord, Int_t perf,
71  const char *image, TProof *proof, Int_t stype,
72  const char *workdir, const char *msd, Int_t = 1);
74  Int_t OldAuthSetup(Bool_t master, TString wconf);
75  void Init(const char *host, Int_t port, Int_t stype);
76  void operator=(const TSlave &) { }
78  static TSlave *Create(const char *url, const char *ord, Int_t perf,
79  const char *image, TProof *proof, Int_t stype,
80  const char *workdir, const char *msd, Int_t nwk = 1);
82 protected:
83  TString fName; //slave's hostname
84  TString fImage; //slave's image name
85  TString fProofWorkDir; //base proofserv working directory (info obtained from slave)
86  TString fWorkDir; //slave's working directory (info obtained from slave)
87  TString fUser; //slave's user id
88  TString fGroup; //slave's group id
89  Int_t fPort; //slave's port number
90  TString fOrdinal; //slave's ordinal number
91  Int_t fPerfIdx; //relative CPU performance index
92  Int_t fProtocol; //slave's protocol level
93  TSocket *fSocket; //socket to slave
94  TProof *fProof; //proof cluster to which slave belongs
95  TFileHandler *fInput; //input handler related to this slave
96  Long64_t fBytesRead; //bytes read by slave (info is obtained from slave)
97  Float_t fRealTime; //real time spent executing commands (info obtained from slave)
98  Float_t fCpuTime; //CPU time spent executing commands (info obtained from slave)
99  ESlaveType fSlaveType; //type of slave (either kMaster or kSlave)
100  Int_t fStatus; //remote return status
101  Int_t fParallel; //number of active slaves
102  TString fMsd; //mass storage domain of slave
103  TString fSessionTag;//unique tag for ths worker process
105  TString fROOTVers; //ROOT version run by worker
106  TString fArchComp; //Build architecture, compiler on worker (e.g. linux-gcc345)
108  TSlave();
109  virtual void FlushSocket() { }
110  void Init(TSocket *s, Int_t stype);
111  virtual void Interrupt(Int_t type);
112  virtual Int_t Ping();
113  virtual TObjString *SendCoordinator(Int_t kind, const char *msg = 0, Int_t int2 = 0);
114  virtual Int_t SendGroupPriority(const char * /*grp*/, Int_t /*priority*/) { return 0; }
115  virtual void SetAlias(const char *alias);
116  void SetSocket(TSocket *s) { fSocket = s; }
117  virtual void SetStatus(Int_t st) { fStatus = st; }
118  virtual void StopProcess(Bool_t abort, Int_t timeout);
120 public:
121  virtual ~TSlave();
123  virtual void Close(Option_t *opt = "");
125  Int_t Compare(const TObject *obj) const;
126  Bool_t IsSortable() const { return kTRUE; }
128  const char *GetName() const { return fName; }
129  const char *GetImage() const { return fImage; }
130  const char *GetProofWorkDir() const { return fProofWorkDir; }
131  const char *GetWorkDir() const { return fWorkDir; }
132  const char *GetUser() const { return fUser; }
133  const char *GetGroup() const { return fGroup; }
134  Int_t GetPort() const { return fPort; }
135  const char *GetOrdinal() const { return fOrdinal; }
136  Int_t GetPerfIdx() const { return fPerfIdx; }
137  Int_t GetProtocol() const { return fProtocol; }
138  TSocket *GetSocket() const { return fSocket; }
139  TProof *GetProof() const { return fProof; }
140  Long64_t GetBytesRead() const { return fBytesRead; }
141  Float_t GetRealTime() const { return fRealTime; }
142  Float_t GetCpuTime() const { return fCpuTime; }
143  Int_t GetSlaveType() const { return (Int_t)fSlaveType; }
144  Int_t GetStatus() const { return fStatus; }
145  Int_t GetParallel() const { return fParallel; }
146  const char *GetMsd() const { return fMsd; }
147  const char *GetSessionTag() const { return fSessionTag; }
148  TFileHandler *GetInputHandler() const { return fInput; }
149  void SetInputHandler(TFileHandler *ih);
151  const char *GetArchCompiler() const { return fArchComp; }
152  const char *GetROOTVersion() const { return fROOTVers; }
154  virtual Bool_t IsValid() const { return fSocket ? kTRUE : kFALSE; }
156  virtual void Print(Option_t *option="") const;
158  virtual Int_t SetupServ(Int_t stype, const char *conffile);
160  virtual void SetInterruptHandler(Bool_t /* on */) { }
162  void SetArchCompiler(const char *ac) { fArchComp = ac; }
163  void SetROOTVersion(const char *rv) { fROOTVers = rv; }
165  void SetSessionTag(const char *st) { fSessionTag = st; }
167  static void SetTXSlaveHook(TSlave_t xslavehook);
169  virtual void Touch() { }
171  ClassDef(TSlave,0) //PROOF slave server
172 };
174 #endif
Int_t GetSlaveType() const
Definition: TSlave.h:143
Int_t GetStatus() const
Definition: TSlave.h:144
TString fUser
Definition: TSlave.h:87
This class starts a PROOF session on the local machine: no daemons, client and master merged...
Definition: TProofLite.h:42
void SetSessionTag(const char *st)
Definition: TSlave.h:165
virtual Int_t SendGroupPriority(const char *, Int_t)
Definition: TSlave.h:114
long long Long64_t
Definition: RtypesCore.h:69
virtual void FlushSocket()
Definition: TSlave.h:109
Collectable string class.
Definition: TObjString.h:32
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
Int_t GetParallel() const
Definition: TSlave.h:145
Long64_t fBytesRead
Definition: TSlave.h:96
virtual TObjString * SendCoordinator(Int_t kind, const char *msg=0, Int_t int2=0)
Send message to intermediate coordinator.
Definition: TSlave.cxx:649
TString fArchComp
Definition: TSlave.h:106
Float_t GetCpuTime() const
Definition: TSlave.h:142
#define BIT(n)
Definition: Rtypes.h:120
void SetROOTVersion(const char *rv)
Definition: TSlave.h:163
const char * GetROOTVersion() const
Definition: TSlave.h:152
const char * GetMsd() const
Definition: TSlave.h:146
void SetArchCompiler(const char *ac)
Definition: TSlave.h:162
void SetSocket(TSocket *s)
Definition: TSlave.h:116
virtual void StopProcess(Bool_t abort, Int_t timeout)
Sent stop/abort request to PROOF server.
Definition: TSlave.cxx:635
const char * GetOrdinal() const
Definition: TSlave.h:135
Basic string class.
Definition: TString.h:137
virtual void Touch()
Definition: TSlave.h:169
virtual void Print(Option_t *option="") const
Printf info about slave.
Definition: TSlave.cxx:341
virtual void SetInterruptHandler(Bool_t)
Definition: TSlave.h:160
Version of TSlave for local worker servers.
Definition: TSlaveLite.h:33
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TFileHandler * GetInputHandler() const
Definition: TSlave.h:148
const char * GetName() const
Returns name of object.
Definition: TSlave.h:128
This is the version of TSlave for workers servers based on XProofD.
Definition: TXSlave.h:36
Int_t GetProtocol() const
Definition: TSlave.h:137
static TSlave_t fgTXSlaveHook
Definition: TSlave.h:67
const char * GetImage() const
Definition: TSlave.h:129
virtual ~TSlave()
Destroy slave.
Definition: TSlave.cxx:269
TSlave(const TSlave &s)
Definition: TSlave.h:69
TString fSessionTag
Definition: TSlave.h:103
virtual Bool_t IsValid() const
Definition: TSlave.h:154
#define ClassDef(name, id)
Definition: Rtypes.h:254
Int_t GetPerfIdx() const
Definition: TSlave.h:136
Int_t(* OldSlaveAuthSetup_t)(TSocket *, Bool_t, TString, TString)
Definition: TSlave.h:42
TSocket * GetSocket() const
Definition: TSlave.h:138
static void SetTXSlaveHook(TSlave_t xslavehook)
Set hook to TXSlave ctor.
Definition: TSlave.cxx:671
Int_t fParallel
Definition: TSlave.h:101
TString fOrdinal
Definition: TSlave.h:90
const char * GetProofWorkDir() const
Definition: TSlave.h:130
virtual void Interrupt(Int_t type)
Send interrupt OOB byte to master or slave servers.
Definition: TSlave.cxx:516
TString fROOTVers
Definition: TSlave.h:105
virtual void Close(Option_t *opt="")
Close slave socket.
Definition: TSlave.cxx:277
virtual void SetStatus(Int_t st)
Definition: TSlave.h:117
Int_t GetPort() const
Definition: TSlave.h:134
const char * GetSessionTag() const
Definition: TSlave.h:147
Default constructor used by derived classes.
Definition: TSlave.cxx:66
virtual Int_t Ping()
Ping the remote master or slave servers.
Definition: TSlave.cxx:499
TString fWorkDir
Definition: TSlave.h:86
const char * GetGroup() const
Definition: TSlave.h:133
TSocket * fSocket
Definition: TSlave.h:93
Float_t GetRealTime() const
Definition: TSlave.h:141
Int_t fProtocol
Definition: TSlave.h:92
TFileHandler * fInput
Definition: TSlave.h:95
static TSlave * Create(const char *url, const char *ord, Int_t perf, const char *image, TProof *proof, Int_t stype, const char *workdir, const char *msd, Int_t nwk=1)
Static method returning the appropriate TSlave object for the remote server.
Definition: TSlave.cxx:447
virtual void SetAlias(const char *alias)
Set an alias for this session.
Definition: TSlave.cxx:661
TString fName
Definition: TSlave.h:83
TProof * fProof
Definition: TSlave.h:94
Definition: TObject.h:55
TString fMsd
Definition: TSlave.h:102
int type
Definition: TGX11.cxx:120
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition: TProof.h:346
void Init(const char *host, Int_t port, Int_t stype)
Init a PROOF slave object.
Definition: TSlave.cxx:88
Bool_t IsSortable() const
Definition: TSlave.h:126
const char * GetWorkDir() const
Definition: TSlave.h:131
Float_t fRealTime
Definition: TSlave.h:97
TString fImage
Definition: TSlave.h:84
Mother of all ROOT objects.
Definition: TObject.h:37
Int_t fStatus
Definition: TSlave.h:100
const char * GetArchCompiler() const
Definition: TSlave.h:151
TSlave *(* TSlave_t)(const char *url, const char *ord, Int_t perf, const char *image, TProof *proof, Int_t stype, const char *workdir, const char *msd, Int_t nwk)
Definition: TSlave.h:46
Int_t fPort
Definition: TSlave.h:89
void operator=(const TSlave &)
Definition: TSlave.h:76
Definition: TSlave.h:60
const char * GetUser() const
Definition: TSlave.h:132
Int_t OldAuthSetup(Bool_t master, TString wconf)
Setup authentication related stuff for old versions.
Definition: TSlave.cxx:404
Float_t fCpuTime
Definition: TSlave.h:98
Class describing a PROOF worker server.
Definition: TSlave.h:50
const Bool_t kTRUE
Definition: Rtypes.h:91
Definition: TSlave.h:59
Long64_t GetBytesRead() const
Definition: TSlave.h:140
ESlaveType fSlaveType
Definition: TSlave.h:99
virtual Int_t SetupServ(Int_t stype, const char *conffile)
Init a PROOF slave object.
Definition: TSlave.cxx:179
TString fProofWorkDir
Definition: TSlave.h:85
TString fGroup
Definition: TSlave.h:88
Int_t Compare(const TObject *obj) const
Used to sort slaves by performance index.
Definition: TSlave.cxx:310
TProof * GetProof() const
Definition: TSlave.h:139
Int_t fPerfIdx
Definition: TSlave.h:91
void SetInputHandler(TFileHandler *ih)
Adopt and register input handler for this slave.
Definition: TSlave.cxx:394