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