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
30class TFileHandler;
31class TObjString;
32class TProof;
33class TSlave;
34class 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
42typedef 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
46class TSlave : public TObject {
47
48friend class TProof;
49friend class TProofLite;
50friend class TSlaveLite;
51friend class TXSlave;
52
53public:
54
58 kOutputRequested = BIT(15) // If output has been requested
59 };
60
61private:
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
78protected:
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);
113 virtual void SetStatus(Int_t st) { fStatus = st; }
114 virtual void StopProcess(Bool_t abort, Int_t timeout);
115
116public:
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; }
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
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:69
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
#define BIT(n)
Definition: Rtypes.h:83
int type
Definition: TGX11.cxx:120
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
Int_t(* OldSlaveAuthSetup_t)(TSocket *, Bool_t, TString, TString)
Definition: TSlave.h:38
Collectable string class.
Definition: TObjString.h:28
Mother of all ROOT objects.
Definition: TObject.h:37
EStatusBits
Definition: TObject.h:57
This class starts a PROOF session on the local machine: no daemons, client and master merged,...
Definition: TProofLite.h:40
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition: TProof.h:316
Version of TSlave for local worker servers.
Definition: TSlaveLite.h:31
Class describing a PROOF worker server.
Definition: TSlave.h:46
Int_t fStatus
Definition: TSlave.h:96
Int_t fParallel
Definition: TSlave.h:97
virtual void SetAlias(const char *alias)
Set an alias for this session.
Definition: TSlave.cxx:656
TString fImage
Definition: TSlave.h:80
Float_t fRealTime
Definition: TSlave.h:93
TSocket * fSocket
Definition: TSlave.h:89
virtual ~TSlave()
Destroy slave.
Definition: TSlave.cxx:269
const char * GetWorkDir() const
Definition: TSlave.h:127
TProof * fProof
Definition: TSlave.h:90
ESlaveType fSlaveType
Definition: TSlave.h:95
Int_t GetSlaveType() const
Definition: TSlave.h:139
Bool_t IsSortable() const
Definition: TSlave.h:122
TProof * GetProof() const
Definition: TSlave.h:135
Float_t GetRealTime() const
Definition: TSlave.h:137
TString fUser
Definition: TSlave.h:83
Int_t fPort
Definition: TSlave.h:85
Int_t GetParallel() const
Definition: TSlave.h:141
static TSlave_t fgTXSlaveHook
Definition: TSlave.h:63
Float_t fCpuTime
Definition: TSlave.h:94
const char * GetImage() const
Definition: TSlave.h:125
void SetArchCompiler(const char *ac)
Definition: TSlave.h:158
Int_t GetPort() const
Definition: TSlave.h:130
void operator=(const TSlave &)
Definition: TSlave.h:72
ESlaveType
Definition: TSlave.h:55
@ kSlave
Definition: TSlave.h:55
@ kMaster
Definition: TSlave.h:55
TSocket * GetSocket() const
Definition: TSlave.h:134
TSlave()
Default constructor used by derived classes.
Definition: TSlave.cxx:66
TString fArchComp
Definition: TSlave.h:102
@ kOutputRequested
Definition: TSlave.h:58
Long64_t GetBytesRead() const
Definition: TSlave.h:136
const char * GetGroup() const
Definition: TSlave.h:129
TString fGroup
Definition: TSlave.h:84
virtual void SetStatus(Int_t st)
Definition: TSlave.h:113
virtual void StopProcess(Bool_t abort, Int_t timeout)
Sent stop/abort request to PROOF server.
Definition: TSlave.cxx:630
TString fSessionTag
Definition: TSlave.h:99
virtual void FlushSocket()
Definition: TSlave.h:105
const char * GetUser() const
Definition: TSlave.h:128
TFileHandler * GetInputHandler() const
Definition: TSlave.h:144
TString fWorkDir
Definition: TSlave.h:82
const char * GetMsd() const
Definition: TSlave.h:142
ESlaveStatus
Definition: TSlave.h:56
@ kActive
Definition: TSlave.h:56
@ kInvalid
Definition: TSlave.h:56
@ kInactive
Definition: TSlave.h:56
TString fOrdinal
Definition: TSlave.h:86
void Init(const char *host, Int_t port, Int_t stype)
Init a PROOF slave object.
Definition: TSlave.cxx:88
Long64_t fBytesRead
Definition: TSlave.h:92
TFileHandler * fInput
Definition: TSlave.h:91
static void SetTXSlaveHook(TSlave_t xslavehook)
Set hook to TXSlave ctor.
Definition: TSlave.cxx:666
void SetSocket(TSocket *s)
Definition: TSlave.h:112
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:442
Int_t GetProtocol() const
Definition: TSlave.h:133
virtual void Touch()
Definition: TSlave.h:165
TString fProofWorkDir
Definition: TSlave.h:81
const char * GetSessionTag() const
Definition: TSlave.h:143
TSlave(const TSlave &s)
Definition: TSlave.h:65
void SetInputHandler(TFileHandler *ih)
Adopt and register input handler for this slave.
Definition: TSlave.cxx:394
Int_t fPerfIdx
Definition: TSlave.h:87
virtual void Interrupt(Int_t type)
Send interrupt OOB byte to master or slave servers.
Definition: TSlave.cxx:511
Int_t GetStatus() const
Definition: TSlave.h:140
Int_t fProtocol
Definition: TSlave.h:88
Int_t Compare(const TObject *obj) const
Used to sort slaves by performance index.
Definition: TSlave.cxx:310
virtual void SetInterruptHandler(Bool_t)
Definition: TSlave.h:156
const char * GetArchCompiler() const
Definition: TSlave.h:147
virtual Int_t SetupServ(Int_t stype, const char *conffile)
Init a PROOF slave object.
Definition: TSlave.cxx:179
virtual Int_t Ping()
Ping the remote master or slave servers.
Definition: TSlave.cxx:494
virtual TObjString * SendCoordinator(Int_t kind, const char *msg=0, Int_t int2=0)
Send message to intermediate coordinator.
Definition: TSlave.cxx:644
virtual Int_t SendGroupPriority(const char *, Int_t)
Definition: TSlave.h:110
const char * GetName() const
Returns name of object.
Definition: TSlave.h:124
const char * GetROOTVersion() const
Definition: TSlave.h:148
TString fROOTVers
Definition: TSlave.h:101
Float_t GetCpuTime() const
Definition: TSlave.h:138
TString fName
Definition: TSlave.h:79
virtual Bool_t IsValid() const
Definition: TSlave.h:150
void SetSessionTag(const char *st)
Definition: TSlave.h:161
Int_t OldAuthSetup(Bool_t master, TString wconf)
Setup authentication related stuff for old versions.
Definition: TSlave.cxx:404
const char * GetOrdinal() const
Definition: TSlave.h:131
virtual void Print(Option_t *option="") const
Printf info about slave.
Definition: TSlave.cxx:341
const char * GetProofWorkDir() const
Definition: TSlave.h:126
TString fMsd
Definition: TSlave.h:98
void SetROOTVersion(const char *rv)
Definition: TSlave.h:159
virtual void Close(Option_t *opt="")
Close slave socket.
Definition: TSlave.cxx:277
Int_t GetPerfIdx() const
Definition: TSlave.h:132
Basic string class.
Definition: TString.h:131
This is the version of TSlave for workers servers based on XProofD.
Definition: TXSlave.h:32
static constexpr double s