23 #include "RConfigure.h"
48 const
char *workdir, const
char *msd,
Int_t)
49 : fImage(image), fProofWorkDir(workdir),
50 fWorkDir(workdir), fPort(-1),
51 fOrdinal(ord), fPerfIdx(perf),
52 fProtocol(0), fSocket(0), fProof(proof),
53 fInput(0), fBytesRead(0), fRealTime(0),
54 fCpuTime(0), fSlaveType((ESlaveType)stype), fStatus(
TSlave::kInvalid),
55 fParallel(0), fMsd(msd)
109 iam =
"Local Client";
112 Error(
"Init",
"Impossible PROOF <-> SlaveType Configuration Requested");
123 if (!fSocket || !fSocket->IsAuthenticated()) {
134 gROOT->GetListOfSockets()->Remove(fSocket);
138 fUser = fSocket->GetSecContext()->GetUser();
143 if (fSocket->GetRemoteProtocol() >= 14 ) {
153 const char *p = def.
Data();
160 Info(
"Init",
"** NOT ** Sending kPROOF_SETENV RemoteProtocol : %d",
161 fSocket->GetRemoteProtocol());
165 fSocket->Recv(buf,
sizeof(buf));
166 if (strcmp(buf,
"Okay")) {
185 if (fSocket->Recv(buf,
sizeof(buf), what) <= 0) {
186 Error(
"SetupServ",
"failed to receive slave startup message");
199 Error(
"SetupServ",
"failed to send local PROOF protocol");
204 if (fSocket->Recv(fProtocol, what) != 2*
sizeof(
Int_t)) {
205 Error(
"SetupServ",
"failed to receive remote PROOF protocol");
212 Error(
"SetupServ",
"incompatible PROOF versions (remote version"
213 " must be >= 4, is %d)", fProtocol);
226 Error(
"SetupServ",
"OldAuthSetup: failed to setup authentication");
239 if (fSocket->Send(mess) < 0) {
240 Error(
"SetupServ",
"failed to send ordinal and config info");
295 nscc->GetProtocol() < 9) {
315 Error(
"Compare",
"input is not a TSlave object");
323 while (myord && otherord) {
324 Int_t myval = atoi(myord);
325 Int_t otherval = atoi(otherord);
326 if (myval < otherval)
return 1;
327 if (myval > otherval)
return -1;
328 myord = strchr(myord,
'.');
330 otherord = strchr(otherord,
'.');
331 if (otherord) otherord++;
333 if (myord)
return -1;
334 if (otherord)
return 1;
345 const char *sst[] = {
"invalid" ,
"valid",
"inactive" };
360 if (fSocket->GetSecContext())
361 Printf(
" Security context: %s", fSocket->GetSecContext()->AsString(sc));
362 Printf(
" Proofd protocol version: %d", fSocket->GetRemoteProtocol());
367 Printf(
" MB's sent: %.2f",
float(fSocket->GetBytesRecv())/(1024*1024));
368 Printf(
" MB's received: %.2f",
float(fSocket->GetBytesSent())/(1024*1024));
377 Printf(
" Security context:");
378 Printf(
" Proofd protocol version:");
384 Printf(
" MB's received:");
408 if (!oldAuthSetupHook) {
410 TString authlib =
"libRootAuth";
416 Error(
"OldAuthSetup",
"can't load %s",authlib.
Data());
420 Error(
"OldAuthSetup",
"can't locate %s",authlib.
Data());
429 Error(
"OldAuthSetup",
"can't find OldSlaveAuthSetup");
435 if (oldAuthSetupHook) {
438 Error(
"OldAuthSetup",
"hook to method OldSlaveAuthSetup is undefined");
449 const char *workdir,
const char *msd,
Int_t nwk)
454 if (!strcmp(url,
"lite")) {
455 return new TSlaveLite(ord, perf, image, proof, stype, workdir, msd);
472 if (!fgTXSlaveHook) {
475 TString proofxlib =
"libProofx";
480 ::
Error(
"TSlave::Create",
"can't load %s", proofxlib.
Data());
482 ::Error(
"TSlave::Create",
"can't locate %s", proofxlib.
Data());
486 if (fgTXSlaveHook && tryxpd) {
489 s =
new TSlave(url, ord, perf, image, proof, stype, workdir, msd);
505 if (fSocket->Send(mess) == -1) {
520 char oobc = (char) type;
521 const int kBufSize = 1024;
522 char waste[kBufSize];
525 if (fSocket->SendRaw(&oobc, 1,
kOob) <= 0) {
532 int n, nch, nbytes = 0, nloop = 0;
535 while ((n = fSocket->RecvRaw(&oob_byte, 1,
kOob)) < 0) {
553 if (nch > kBufSize) nch = kBufSize;
554 n = fSocket->RecvRaw(waste, nch);
556 Error(
"Interrupt",
"error receiving waste from slave %s",
561 }
else if (n == -3) {
571 Error(
"Interrupt",
"error receiving OOB from server %s",
584 fSocket->GetOption(
kAtMark, atmark);
596 if (nch > kBufSize) nch = kBufSize;
597 n = fSocket->RecvRaw(waste, nch);
599 Error(
"Interrupt",
"error receiving waste (2) from slave %s",
607 Info(
"Interrupt",
"slave %s:%s synchronized: %d bytes discarded",
610 Info(
"Interrupt",
"PROOF synchronized: %d bytes discarded", nbytes);
652 Info(
"SendCoordinator",
"method not implemented for this communication layer");
664 Info(
"SetAlias",
"method not implemented for this communication layer");
673 fgTXSlaveHook = xslavehook;
virtual const char * GetTitle() const
Returns title of object.
const char * GetOrdinal() const
const char * GetHostName() const
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
const char Int_t const char TProof Int_t const char const char * msd
Float_t GetCpuTime() const
Collectable string class.
const char * GetSessionTag() const
const char * GetUser() const
This class represents a WWW compatible URL.
virtual TObjString * SendCoordinator(Int_t kind, const char *msg=0, Int_t int2=0)
Send message to intermediate coordinator.
const char * GetProtocol() const
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
static const TList * GetEnvVars()
Get environemnt variables.
virtual void StopProcess(Bool_t abort, Int_t timeout)
Sent stop/abort request to PROOF server.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
const char * GetGroup() const
virtual void Add()
Add file event handler to system file handler list.
Bool_t IsActive() const
Check remote OffSet and expiring Date.
R__EXTERN TVirtualMutex * gROOTMutex
R__EXTERN TApplication * gApplication
TString & Insert(Ssiz_t pos, const char *s)
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)
const char * Data() const
virtual ~TSlave()
Destroy slave.
const char * GetROOTVersion() const
Int_t(* OldSlaveAuthSetup_t)(TSocket *, Bool_t, TString, TString)
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
const char Int_t const char TProof Int_t stype
The TNamed class is the base class for all named ROOT classes.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
void Init(TClassEdit::TInterpreterLookupHelper *helper)
static void SetTXSlaveHook(TSlave_t xslavehook)
Set hook to TXSlave ctor.
Int_t Collect(const TSlave *sl, Long_t timeout=-1, Int_t endtype=-1, Bool_t deactonfail=kFALSE)
Collect responses from slave sl.
static TSocket * CreateAuthSocket(const char *user, const char *host, Int_t port, Int_t size=0, Int_t tcpwindowsize=-1, TSocket *s=0, Int_t *err=0)
Creates a socket or a parallel socket and authenticates to the remote server specified in 'url' on re...
virtual void Interrupt(Int_t type)
Send interrupt OOB byte to master or slave servers.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * GetWorkDir() const
virtual void Close(Option_t *opt="")
Close slave socket.
void Error(const char *location, const char *msgfmt,...)
const char Int_t const char TProof Int_t const char * workdir
const char * GetName() const
Returns name of object.
TSlave()
Default constructor used by derived classes.
R__EXTERN TSystem * gSystem
virtual Int_t Ping()
Ping the remote master or slave servers.
TList * GetSecContextCleanup() const
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
char * Form(const char *fmt,...)
virtual void DeActivate(Option_t *opt="CR")
Set OffSet to -1 and expiring Date to default Remove from the list If Opt contains "C" or "c"...
virtual const char * GetName() const
Returns name of object.
const Int_t kPROOF_Protocol
virtual void Print(Option_t *option="") const
Printf info about slave.
const char * GetImage() const
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
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.
virtual void SetAlias(const char *alias)
Set an alias for this session.
Int_t Compare(const TObject *obj) const
Used to sort slaves by performance index.
virtual Func_t DynFindSymbol(const char *module, const char *entry)
Find specific entry point in specified library.
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
This class controls a Parallel ROOT Facility, PROOF, cluster.
void Init(const char *host, Int_t port, Int_t stype)
Init a PROOF slave object.
Mother of all ROOT objects.
const char Int_t const char TProof * proof
void SetOptions(const char *opt)
const char * GetArchCompiler() const
Int_t OldAuthSetup(Bool_t master, TString wconf)
Setup authentication related stuff for old versions.
virtual Bool_t IsValid() const
const Bool_t kIterBackward
Class describing a PROOF worker server.
TInetAddress GetInetAddress() const
virtual Int_t SetupServ(Int_t stype, const char *conffile)
Init a PROOF slave object.
Float_t GetRealTime() const
Long64_t GetBytesRead() const
const char Int_t const char * image
void SetInputHandler(TFileHandler *ih)
Adopt and register input handler for this slave.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.