Logo ROOT   6.16/01
Reference Guide
TXSlave.cxx
Go to the documentation of this file.
1// @(#)root/proofx:$Id$
2// Author: Gerardo Ganis 12/12/2005
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, 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/** \class TXSlave
13\ingroup proofx
14
15This is the version of TSlave for workers servers based on XProofD.
16See TSlave and TXSocket for details.
17
18*/
19
20#include "TXSlave.h"
21#include "TProof.h"
22#include "TProofServ.h"
23#include "TSystem.h"
24#include "TEnv.h"
25#include "TROOT.h"
26#include "TUrl.h"
27#include "TMessage.h"
28#include "TMonitor.h"
29#include "TError.h"
30#include "TSysEvtHandler.h"
31#include "TVirtualMutex.h"
32#include "TXSocket.h"
33#include "TXSocketHandler.h"
34#include "Varargs.h"
35#include "XProofProtocol.h"
36
37#include <mutex>
38
40
41//______________________________________________________________________________
42
43//---- Hook to the constructor -------------------------------------------------
44//---- This is needed to avoid using the plugin manager which may create -------
45//---- problems in multi-threaded environments. --------------------------------
46TSlave *GetTXSlave(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)
49{
50 return ((TSlave *)(new TXSlave(url, ord, perf, image,
51 proof, stype, workdir, msd, nwk)));
52}
53
54class XSlaveInit {
55 public:
56 XSlaveInit() {
58}};
59static XSlaveInit xslave_init;
60
61//______________________________________________________________________________
62
63//---- error handling ----------------------------------------------------------
64//---- Needed to avoid blocking on the CINT mutex in printouts -----------------
65
66////////////////////////////////////////////////////////////////////////////////
67/// Interface to ErrorHandler (protected).
68
69void TXSlave::DoError(int level, const char *location, const char *fmt, va_list va) const
70{
71 ::ErrorHandler(level, Form("TXSlave::%s", location), fmt, va);
72}
73
74//
75// Specific Interrupt signal handler
76//
77class TXSlaveInterruptHandler : public TSignalHandler {
78private:
79 TXSocket *fSocket;
80public:
81 TXSlaveInterruptHandler(TXSocket *s = 0)
82 : TSignalHandler(kSigInterrupt, kFALSE), fSocket(s) { }
83 Bool_t Notify();
84};
85
86////////////////////////////////////////////////////////////////////////////////
87/// TXSlave interrupt handler.
88
89Bool_t TXSlaveInterruptHandler::Notify()
90{
91 Info("Notify","Processing interrupt signal ...");
92
93 // Handle also interrupt condition on socket(s)
94 if (fSocket)
95 fSocket->SetInterrupt();
96
97 return kTRUE;
98}
99
100////////////////////////////////////////////////////////////////////////////////
101/// Create a PROOF slave object. Called via the TProof ctor.
102
103TXSlave::TXSlave(const char *url, const char *ord, Int_t perf,
104 const char *image, TProof *proof, Int_t stype,
105 const char *workdir, const char *msd, Int_t nwk) : TSlave()
106{
107 fImage = image;
108 fProofWorkDir = workdir;
109 fWorkDir = workdir;
110 fOrdinal = ord;
111 fPerfIdx = perf;
112 fProof = proof;
113 fSlaveType = (ESlaveType)stype;
114 fMsd = msd;
115 fNWrks = nwk;
116 fIntHandler = 0;
117 fValid = kFALSE;
118
119 // Instance of the socket input handler to monitor all the XPD sockets
122
123 TXSocket::SetLocation((fProof->IsMaster()) ? "master" : "client");
124
125 Init(url, stype);
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Init a PROOF slave object. Called via the TXSlave ctor.
130/// The Init method is technology specific and is overwritten by derived
131/// classes.
132
133void TXSlave::Init(const char *host, Int_t stype)
134{
135 // Url string with host, port information; 'host' may contain 'user' information
136 // in the usual form 'user@host'
137
138 // Auxilliary url
139 TUrl url(host);
141 // Check port
142 if (url.GetPort() == TUrl("a").GetPort()) {
143 // We use 'rootd' service as default.
144 Int_t port = gSystem->GetServiceByName("proofd");
145 if (port < 0) {
146 if (gDebug > 0)
147 Info("Init","service 'proofd' not found by GetServiceByName"
148 ": using default IANA assigned tcp port 1093");
149 port = 1093;
150 } else {
151 if (gDebug > 1)
152 Info("Init","port from GetServiceByName: %d", port);
153 }
154 url.SetPort(port);
155 }
156
157 // Fill members
158 fName = url.GetHostFQDN();
159 fPort = url.GetPort(); // We get the right default if the port is not specified
160 // Group specification , if any, uses the password field, i.e. user[:group]
161 fGroup = url.GetPasswd();
162
163 // The field 'psid' is interpreted as session ID when we are attaching
164 // to an existing session (ID passed in the options field of the url) or
165 // to our PROOF protocl version when we are creating a new session
166 TString opts(url.GetOptions());
167 Bool_t attach = (opts.Length() > 0 && opts.IsDigit()) ? kTRUE : kFALSE;
168 Int_t psid = (attach) ? opts.Atoi() : kPROOF_Protocol;
169
170 // Add information about our status (Client or Master)
171 TString iam;
172 Char_t mode = 's';
173 TString alias = fProof->GetTitle();
174 if (fProof->IsMaster() && stype == kSlave) {
175 iam = "Master";
176 mode = 's';
177 // Send session tag of the closest master to the slaves
178 alias.Form("session-%s|ord:%s", fProof->GetName(), fOrdinal.Data());
179 } else if (fProof->IsMaster() && stype == kMaster) {
180 iam = "Master";
181 mode = 'm';
182 // Send session tag of the closest master to the slaves
183 if (fNWrks > 1) {
184 alias.Form("session-%s|ord:%s|plite:%d", fProof->GetName(), fOrdinal.Data(), fNWrks);
185 mode = 'L';
186 } else {
187 alias.Form("session-%s|ord:%s", fProof->GetName(), fOrdinal.Data());
188 }
189 } else if (!fProof->IsMaster() && stype == kMaster) {
190 iam = "Local Client";
191 mode = (attach) ? 'A' : 'M';
192 } else {
193 Error("Init","Impossible PROOF <-> SlaveType Configuration Requested");
194 R__ASSERT(0);
195 }
196
197 // Add conf file, if required
198 if (fProof->fConfFile.Length() > 0 && fNWrks <= 1)
199 alias += Form("|cf:%s",fProof->fConfFile.Data());
200
201 // Send over env variables (may not be supported remotely)
202 TString envlist;
203 if (!fProof->GetManager() ||
204 fProof->GetManager()->GetRemoteProtocol() > 1001) {
205 // Check if the user forced locally a given authentication protocol:
206 // we need to do the same remotely to get the right credentials
207 if (gSystem->Getenv("XrdSecPROTOCOL")) {
208 TProof::DelEnvVar("XrdSecPROTOCOL");
209 TProof::AddEnvVar("XrdSecPROTOCOL", gSystem->Getenv("XrdSecPROTOCOL"));
210 }
211 const TList *envs = TProof::GetEnvVars();
212 if (envs != 0 ) {
213 TIter next(envs);
214 for (TObject *o = next(); o != 0; o = next()) {
215 TNamed *env = dynamic_cast<TNamed*>(o);
216 if (env != 0) {
217 if (!envlist.IsNull())
218 envlist += ",";
219 envlist += Form("%s=%s", env->GetName(), env->GetTitle());
220 }
221 }
222 }
223 } else {
225 Info("Init", "** NOT ** sending user envs - RemoteProtocol : %d",
227 }
228
229 // Add to the buffer
230 if (!envlist.IsNull())
231 alias += Form("|envs:%s", envlist.Data());
232
233 // Open connection to a remote XrdPROOF slave server.
234 // Login and authentication are dealt with at this level, if required.
235 if (!(fSocket = new TXSocket(url.GetUrl(kTRUE), mode, psid,
236 -1, alias, fProof->GetLogLevel(), this))) {
237 ParseBuffer(); // For the log path
238 Error("Init", "while opening the connection to %s - exit", url.GetUrl(kTRUE));
239 return;
240 }
241
242 // The socket may not be valid
243 if (!(fSocket->IsValid())) {
244 // Notify only if verbosity is on: most likely the failure has already been notified
245 PDB(kGlobal,1)
246 Error("Init", "some severe error occurred while opening "
247 "the connection at %s - exit", url.GetUrl(kTRUE));
248 ParseBuffer(); // For the log path
249 // Fill some useful info
250 fUser = ((TXSocket *)fSocket)->fUser;
251 PDB(kGlobal,3) Info("Init","%s: fUser is .... %s", iam.Data(), fUser.Data());
253 return;
254 }
255
256 // Set the ordinal in the title for debugging
258
259 // Check if the remote server supports user envs setting
260 if (!fProof->GetManager() && !envlist.IsNull() &&
261 ((TXSocket *)fSocket)->GetXrdProofdVersion() <= 1001) {
262 Info("Init","user envs setting sent but unsupported remotely - RemoteProtocol : %d",
263 ((TXSocket *)fSocket)->GetXrdProofdVersion());
264 }
265
266 // Set the reference to TProof
267 ((TXSocket *)fSocket)->fReference = fProof;
268
269 // Protocol run by remote PROOF server
271
272 // Set server type
274
275 // Set remote session ID
276 fProof->fSessionID = ((TXSocket *)fSocket)->GetSessionID();
277
278 // Extract the log file path and, if any, set URL entry point for the default data pool
279 ParseBuffer();
280
281 // Remove socket from global TROOT socket list. Only the TProof object,
282 // representing all slave sockets, will be added to this list. This will
283 // ensure the correct termination of all proof servers in case the
284 // root session terminates.
285 {
287 gROOT->GetListOfSockets()->Remove(fSocket);
288 }
289
290 // Fill some useful info
291 fUser = ((TXSocket *)fSocket)->fUser;
292 PDB(kGlobal,3) {
293 Info("Init","%s: fUser is .... %s", iam.Data(), fUser.Data());
294 }
295
296 // Set valid
297 fValid = kTRUE;
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Parse fBuffer after a connection attempt
302
304{
305 // Set URL entry point for the default data pool
306 TString buffer(((TXSocket *)fSocket)->fBuffer);
307 if (!buffer.IsNull()) {
308 Ssiz_t ilog = buffer.Index("|log:");
309 if (ilog != 0) {
310 // Extract the pool URL (on master)
311 TString dpu = (ilog != kNPOS) ? buffer(0, ilog) : buffer;
312 if (dpu.Length() > 0) fProof->SetDataPoolUrl(dpu);
313 }
314 if (ilog != kNPOS) {
315 // The rest, if any, if the log file path from which we extract the working dir
316 buffer.Remove(0, ilog + sizeof("|log:") - 1);
317 fWorkDir = buffer;
318 if ((ilog = fWorkDir.Last('.')) != kNPOS) fWorkDir.Remove(ilog);
319 if (gDebug > 2)
320 Info("ParseBuffer", "workdir is: %s", fWorkDir.Data());
321 } else if (fProtocol > 31) {
322 Warning("ParseBuffer", "expected log path not found in received startup buffer!");
323 }
324 }
325 // Done
326 return;
327}
328
329////////////////////////////////////////////////////////////////////////////////
330/// Init a PROOF slave object. Called via the TXSlave ctor.
331/// The Init method is technology specific and is overwritten by derived
332/// classes.
333
335{
336 // Get back startup message of proofserv (we are now talking with
337 // the real proofserver and not anymore with the proofd front-end)
338 Int_t what;
339 char buf[512];
340 if (fSocket->Recv(buf, sizeof(buf), what) <= 0) {
341 Error("SetupServ", "failed to receive slave startup message");
342 Close("S");
344 fValid = kFALSE;
345 return -1;
346 }
347
348 if (what == kMESS_NOTOK) {
350 fValid = kFALSE;
351 return -1;
352 }
353
354 // protocols less than 4 are incompatible
355 if (fProtocol < 4) {
356 Error("SetupServ", "incompatible PROOF versions (remote version "
357 "must be >= 4, is %d)", fProtocol);
359 fValid = kFALSE;
360 return -1;
361 }
362
363 fProof->fProtocol = fProtocol; // protocol of last slave on master
364
365 // set some socket options
367
368 // We are done
369 return 0;
370}
371
372////////////////////////////////////////////////////////////////////////////////
373/// Destroy slave.
374
376{
377 Close();
378}
379
380////////////////////////////////////////////////////////////////////////////////
381/// Close slave socket.
382
384{
385 if (fSocket)
386 // Closing socket ...
387 fSocket->Close(opt);
388
391}
392
393////////////////////////////////////////////////////////////////////////////////
394/// Ping the remote master or slave servers.
395/// Returns 0 if ok, -1 if it did not ping or in case of error
396
398{
399 if (!IsValid()) return -1;
400
401 return (((TXSocket *)fSocket)->Ping(GetOrdinal()) ? 0 : -1);
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// Touch the client admin file to proof we are alive.
406
408{
409 if (!IsValid()) return;
410
411 ((TXSocket *)fSocket)->RemoteTouch();
412 return;
413}
414
415////////////////////////////////////////////////////////////////////////////////
416/// Send interrupt to master or slave servers.
417/// Returns 0 if ok, -1 in case of error
418
420{
421 if (!IsValid()) return;
422
424
425 // Deactivate and flush the local socket (we are not - yet - closing
426 // the session, so we do less things that in case of an error ...)
427 if (fProof) {
428
429 // Attach to the monitor instance, if any
431 if (mon && fSocket && mon->GetListOfActives()->FindObject(fSocket)) {
432 // Synchronous collection in TProof
433 if (gDebug > 2)
434 Info("Interrupt", "%p: deactivating from monitor %p", this, mon);
435 mon->DeActivate(fSocket);
436 }
437 } else {
438 Warning("Interrupt", "%p: reference to PROOF missing", this);
439 }
440
441 // Post semaphore to wake up anybody waiting
442 if (fSocket) ((TXSocket *)fSocket)->PostSemAll();
443
444 return;
445 }
446
447 if (fSocket) ((TXSocket *)fSocket)->SendInterrupt(type);
448 Info("Interrupt","Interrupt of type %d sent", type);
449}
450
451////////////////////////////////////////////////////////////////////////////////
452/// Sent stop/abort request to PROOF server. It will be
453/// processed asynchronously by a separate thread.
454
456{
457 if (!IsValid()) return;
458
459 ((TXSocket *)fSocket)->SendUrgent(TXSocket::kStopProcess, (Int_t)abort, timeout);
460 if (gDebug > 0)
461 Info("StopProcess", "Request of type %d sent over", abort);
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Find out the remote proofd protocol version.
466/// Returns -1 in case of error.
467
469{
470 Int_t rproto = -1;
471
472 UInt_t cproto = 0;
473 Int_t len = sizeof(cproto);
474 memcpy((char *)&cproto,
475 Form(" %d", TSocket::GetClientProtocol()),len);
476 Int_t ns = s->SendRaw(&cproto, len);
477 if (ns != len) {
478 ::Error("TXSlave::GetProofdProtocol",
479 "sending %d bytes to proofd server [%s:%d]",
480 len, (s->GetInetAddress()).GetHostName(), s->GetPort());
481 return -1;
482 }
483
484 // Get the remote protocol
485 Int_t ibuf[2] = {0};
486 len = sizeof(ibuf);
487 Int_t nr = s->RecvRaw(ibuf, len);
488 if (nr != len) {
489 ::Error("TXSlave::GetProofdProtocol",
490 "reading %d bytes from proofd server [%s:%d]",
491 len, (s->GetInetAddress()).GetHostName(), s->GetPort());
492 return -1;
493 }
494 Int_t kind = net2host(ibuf[0]);
495 if (kind == kROOTD_PROTOCOL) {
496 rproto = net2host(ibuf[1]);
497 } else {
498 kind = net2host(ibuf[1]);
499 if (kind == kROOTD_PROTOCOL) {
500 len = sizeof(rproto);
501 nr = s->RecvRaw(&rproto, len);
502 if (nr != len) {
503 ::Error("TXSlave::GetProofdProtocol",
504 "reading %d bytes from proofd server [%s:%d]",
505 len, (s->GetInetAddress()).GetHostName(), s->GetPort());
506 return -1;
507 }
508 rproto = net2host(rproto);
509 }
510 }
511 if (gDebug > 2)
512 ::Info("TXSlave::GetProofdProtocol",
513 "remote proofd: buf1: %d, buf2: %d rproto: %d",
514 net2host(ibuf[0]),net2host(ibuf[1]),rproto);
515
516 // We are done
517 return rproto;
518}
519
520////////////////////////////////////////////////////////////////////////////////
521/// Send message to intermediate coordinator.
522/// If any output is due, this is returned as a generic message
523
524TObjString *TXSlave::SendCoordinator(Int_t kind, const char *msg, Int_t int2)
525{
526 return ((TXSocket *)fSocket)->SendCoordinator(kind, msg, int2);
527}
528
529////////////////////////////////////////////////////////////////////////////////
530/// Set an alias for this session. If reconnection is supported, the alias
531/// will be communicated to the remote coordinator so that it can be recovered
532/// when reconnecting
533
534void TXSlave::SetAlias(const char *alias)
535{
536 // Nothing to do if not in contact with coordinator
537 if (!IsValid()) return;
538
539 ((TXSocket *)fSocket)->SendCoordinator(kSessionAlias, alias);
540
541 return;
542}
543
544////////////////////////////////////////////////////////////////////////////////
545/// Communicate to the coordinator the priprity of the group to which the
546/// user belongs
547/// Return 0 on success
548
549Int_t TXSlave::SendGroupPriority(const char *grp, Int_t priority)
550{
551 // Nothing to do if not in contact with coordinator
552 if (!IsValid()) return -1;
553
554 ((TXSocket *)fSocket)->SendCoordinator(kGroupProperties, grp, priority);
555
556 return 0;
557}
558
559////////////////////////////////////////////////////////////////////////////////
560/// Handle error on the input socket
561
563{
564 XHandleErr_t *herr = in ? (XHandleErr_t *)in : 0;
565
566 // Try reconnection
567 if (fSocket && herr && (herr->fOpt == 1)) {
568
569 ((TXSocket *)fSocket)->Reconnect();
570 if (fSocket && fSocket->IsValid()) {
571 if (gDebug > 0) {
572 if (!strcmp(GetOrdinal(), "0")) {
573 Printf("Proof: connection to master at %s:%d re-established",
574 GetName(), GetPort());
575 } else {
576 Printf("Proof: connection to node '%s' at %s:%d re-established",
577 GetOrdinal(), GetName(), GetPort());
578 }
579 }
580 return kFALSE;
581 }
582 }
583
584 // This seems a real error: notify the interested parties
585 Info("HandleError", "%p:%s:%s got called ... fProof: %p, fSocket: %p (valid: %d)",
586 this, fName.Data(), fOrdinal.Data(), fProof, fSocket,
587 (fSocket ? (Int_t)fSocket->IsValid() : -1));
588
589 // Remove interrupt handler (avoid affecting other clients of the underlying physical
590 // connection)
592
593 if (fProof) {
594
595 // Remove PROOF signal handler
596 if (fProof->fIntHandler)
598
599 Info("HandleError", "%p: proof: %p", this, fProof);
600
601 if (fSocket) {
602 // This is need to skip contacting the remote server upon close
603 ((TXSocket *)fSocket)->SetSessionID(-1);
604 // This is need to interrupt possible pickup waiting status
605 ((TXSocket *)fSocket)->SetInterrupt();
606 // Synchronous collection in TProof: post fatal message; this will
607 // mark the worker as bad and update the internal lists accordingly
608 ((TXSocket *)fSocket)->PostMsg(kPROOF_FATAL);
609 }
610
611 // On masters we notify clients of the problem occured
612 if (fProof->IsMaster()) {
613 TString msg(Form("Worker '%s-%s' has been removed from the active list",
614 fName.Data(), fOrdinal.Data()));
616 m << msg;
617 if (gProofServ)
619 else
620 Warning("HandleError", "%p: global reference to TProofServ missing", this);
621 }
622 } else {
623 Warning("HandleError", "%p: reference to PROOF missing", this);
624 }
625
626 Printf("TXSlave::HandleError: %p: DONE ... ", this);
627
628 // We are done
629 return kTRUE;
630}
631
632////////////////////////////////////////////////////////////////////////////////
633/// Handle asynchronous input on the socket
634
636{
637 if (fProof) {
638
639 // Attach to the monitor instance, if any
641
642 if (gDebug > 2)
643 Info("HandleInput", "%p: %s: proof: %p, mon: %p",
644 this, GetOrdinal(), fProof, mon);
645
646 if (mon && mon->IsActive(fSocket)) {
647 // Synchronous collection in TProof
648 if (gDebug > 2)
649 Info("HandleInput","%p: %s: posting monitor %p", this, GetOrdinal(), mon);
650 mon->SetReady(fSocket);
651 } else {
652 // Asynchronous collection in TProof
653 if (gDebug > 2) {
654 if (mon) {
655 Info("HandleInput", "%p: %s: not active in current monitor"
656 " - calling TProof::CollectInputFrom",
657 this, GetOrdinal());
658 } else {
659 Info("HandleInput", "%p: %s: calling TProof::CollectInputFrom",
660 this, GetOrdinal());
661 }
662 }
664 // Something wrong on the line: flush it
665 FlushSocket();
666 }
667 } else {
668 Warning("HandleInput", "%p: %s: reference to PROOF missing", this, GetOrdinal());
669 return kFALSE;
670 }
671
672 // We are done
673 return kTRUE;
674}
675
676////////////////////////////////////////////////////////////////////////////////
677/// Set/Unset the interrupt handler
678
680{
681 if (gDebug > 1)
682 Info("SetInterruptHandler", "enter: %d", on);
683
684 if (on) {
685 if (!fIntHandler)
686 fIntHandler = new TXSlaveInterruptHandler((TXSocket *)fSocket);
687 fIntHandler->Add();
688 } else {
689 if (fIntHandler)
691 }
692}
693
694////////////////////////////////////////////////////////////////////////////////
695/// Clean any input on the socket
696
698{
699 if (gDebug > 1)
700 Info("FlushSocket", "enter: %p", fSocket);
701
702 if (fSocket)
704}
UShort_t net2host(UShort_t x)
Definition: Bytes.h:577
@ kMESS_NOTOK
Definition: MessageTypes.h:33
@ kPROOF_FATAL
Definition: MessageTypes.h:43
@ kROOTD_PROTOCOL
Definition: MessageTypes.h:114
@ kPROOF_MESSAGE
Definition: MessageTypes.h:85
#define SafeDelete(p)
Definition: RConfig.hxx:529
const Ssiz_t kNPOS
Definition: RtypesCore.h:111
int Int_t
Definition: RtypesCore.h:41
int Ssiz_t
Definition: RtypesCore.h:63
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:363
R__EXTERN Int_t gDebug
Definition: Rtypes.h:90
#define R__ASSERT(e)
Definition: TError.h:96
void Info(const char *location, const char *msgfmt,...)
void ErrorHandler(int level, const char *location, const char *fmt, va_list va)
General error handler function. It calls the user set error handler.
Definition: TError.cxx:202
int type
Definition: TGX11.cxx:120
#define Printf
Definition: TGeoToOCC.h:18
#define PDB(mask, level)
Definition: TProofDebug.h:56
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:347
const Int_t kPROOF_Protocol
Definition: TProof.h:120
R__EXTERN TVirtualMutex * gROOTMutex
Definition: TROOT.h:57
#define gROOT
Definition: TROOT.h:410
@ kNoDelay
Definition: TSocket.h:43
char * Form(const char *fmt,...)
@ kSigInterrupt
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
#define R__LOCKGUARD(mutex)
TSlave * GetTXSlave(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: TXSlave.cxx:46
static XSlaveInit xslave_init
Definition: TXSlave.cxx:59
@ kGroupProperties
@ kSessionAlias
A doubly linked list.
Definition: TList.h:44
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
void SetReady(TSocket *sock)
Called by TSocketHandler::Notify() to signal which socket is ready to be read or written.
Definition: TMonitor.cxx:423
virtual void DeActivate(TSocket *sock)
De-activate a socket.
Definition: TMonitor.cxx:284
TList * GetListOfActives() const
Returns a list with all active sockets.
Definition: TMonitor.cxx:498
Bool_t IsActive(TSocket *s) const
Check if socket 's' is in the active list.
Definition: TMonitor.cxx:482
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Collectable string class.
Definition: TObjString.h:28
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:854
virtual Int_t GetRemoteProtocol() const
Definition: TProofMgr.h:90
@ kXProofd
Definition: TProofMgr.h:46
TSocket * GetSocket() const
Definition: TProofServ.h:257
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition: TProof.h:316
@ kLocalInterrupt
Definition: TProof.h:394
TMonitor * fCurrentMonitor
Definition: TProof.h:487
Int_t fSessionID
Definition: TProof.h:528
TUrl fUrl
Definition: TProof.h:567
void SetDataPoolUrl(const char *url)
Definition: TProof.h:1044
static void AddEnvVar(const char *name, const char *value)
Add an variable to the list of environment variables passed to proofserv on the master and slaves.
Definition: TProof.cxx:11732
TSignalHandler * fIntHandler
Definition: TProof.h:491
Int_t fProtocol
Definition: TProof.h:571
TString fConfFile
Definition: TProof.h:568
Int_t GetLogLevel() const
Definition: TProof.h:916
TProofMgr::EServType fServType
Definition: TProof.h:586
static const TList * GetEnvVars()
Get environemnt variables.
Definition: TProof.cxx:11723
static void DelEnvVar(const char *name)
Remove an variable from the list of environment variables passed to proofserv on the master and slave...
Definition: TProof.cxx:11754
Bool_t IsMaster() const
Definition: TProof.h:936
Int_t CollectInputFrom(TSocket *s, Int_t endtype=-1, Bool_t deactonfail=kFALSE)
Collect and analyze available input from socket s.
Definition: TProof.cxx:3032
TProofMgr * GetManager()
Definition: TProof.h:1037
virtual void Add()
Add signal handler to system signal handler list.
virtual Bool_t Notify()
Notify when signal occurs.
virtual void Remove()
Remove signal handler from system signal handler list.
Class describing a PROOF worker server.
Definition: TSlave.h:46
TString fImage
Definition: TSlave.h:80
TSocket * fSocket
Definition: TSlave.h:89
TProof * fProof
Definition: TSlave.h:90
ESlaveType fSlaveType
Definition: TSlave.h:95
TString fUser
Definition: TSlave.h:83
Int_t fPort
Definition: TSlave.h:85
friend class TXSlave
Definition: TSlave.h:51
Int_t GetPort() const
Definition: TSlave.h:130
ESlaveType
Definition: TSlave.h:55
@ kSlave
Definition: TSlave.h:55
@ kMaster
Definition: TSlave.h:55
TString fGroup
Definition: TSlave.h:84
TString fWorkDir
Definition: TSlave.h:82
TString fOrdinal
Definition: TSlave.h:86
TFileHandler * fInput
Definition: TSlave.h:91
static void SetTXSlaveHook(TSlave_t xslavehook)
Set hook to TXSlave ctor.
Definition: TSlave.cxx:666
TString fProofWorkDir
Definition: TSlave.h:81
Int_t fPerfIdx
Definition: TSlave.h:87
Int_t fProtocol
Definition: TSlave.h:88
const char * GetName() const
Returns name of object.
Definition: TSlave.h:124
TString fName
Definition: TSlave.h:79
virtual Bool_t IsValid() const
Definition: TSlave.h:150
const char * GetOrdinal() const
Definition: TSlave.h:131
TString fMsd
Definition: TSlave.h:98
virtual Int_t SetOption(ESockOptions opt, Int_t val)
Set socket options.
Definition: TSocket.cxx:1012
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Definition: TSocket.cxx:817
static Int_t GetClientProtocol()
Static method returning supported client protocol.
Definition: TSocket.cxx:1488
Int_t GetRemoteProtocol() const
Definition: TSocket.h:146
virtual void Close(Option_t *opt="")
Close the socket.
Definition: TSocket.cxx:389
virtual Bool_t IsValid() const
Definition: TSocket.h:152
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition: TSocket.cxx:522
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
Int_t Atoi() const
Return integer value of string.
Definition: TString.cxx:1896
const char * Data() const
Definition: TString.h:364
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition: TString.cxx:1738
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:876
Bool_t IsNull() const
Definition: TString.h:402
TString & Remove(Ssiz_t pos)
Definition: TString.h:668
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2264
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:634
virtual int GetServiceByName(const char *service)
Get port # of internet service.
Definition: TSystem.cxx:2361
virtual void AddFileHandler(TFileHandler *fh)
Add a file handler to the list of system file handlers.
Definition: TSystem.cxx:563
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1652
This class represents a WWW compatible URL.
Definition: TUrl.h:35
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Definition: TUrl.cxx:385
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
Definition: TUrl.cxx:518
const char * GetPasswd() const
Definition: TUrl.h:69
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
Definition: TUrl.cxx:467
const char * GetOptions() const
Definition: TUrl.h:74
const char * GetProtocol() const
Definition: TUrl.h:67
void SetPort(Int_t port)
Definition: TUrl.h:91
Int_t GetPort() const
Definition: TUrl.h:81
This is the version of TSlave for workers servers based on XProofD.
Definition: TXSlave.h:32
void StopProcess(Bool_t abort, Int_t timeout)
Sent stop/abort request to PROOF server.
Definition: TXSlave.cxx:455
void Touch()
Touch the client admin file to proof we are alive.
Definition: TXSlave.cxx:407
void SetAlias(const char *alias)
Set an alias for this session.
Definition: TXSlave.cxx:534
void Interrupt(Int_t type)
Send interrupt to master or slave servers.
Definition: TXSlave.cxx:419
Int_t SetupServ(Int_t stype, const char *conffile)
Init a PROOF slave object.
Definition: TXSlave.cxx:334
Bool_t HandleError(const void *in=0)
Handle error on the input socket.
Definition: TXSlave.cxx:562
void SetInterruptHandler(Bool_t on=kTRUE)
Set/Unset the interrupt handler.
Definition: TXSlave.cxx:679
virtual ~TXSlave()
Destroy slave.
Definition: TXSlave.cxx:375
Int_t fNWrks
Definition: TXSlave.h:39
static Int_t GetProofdProtocol(TSocket *s)
Find out the remote proofd protocol version.
Definition: TXSlave.cxx:468
Int_t Ping()
Ping the remote master or slave servers.
Definition: TXSlave.cxx:397
void Close(Option_t *opt="")
Close slave socket.
Definition: TXSlave.cxx:383
Bool_t HandleInput(const void *in=0)
Handle asynchronous input on the socket.
Definition: TXSlave.cxx:635
Bool_t fValid
Definition: TXSlave.h:38
TSignalHandler * fIntHandler
Definition: TXSlave.h:40
TObjString * SendCoordinator(Int_t kind, const char *msg=0, Int_t int2=0)
Send message to intermediate coordinator.
Definition: TXSlave.cxx:524
void ParseBuffer()
Parse fBuffer after a connection attempt.
Definition: TXSlave.cxx:303
void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
Definition: TXSlave.cxx:69
void Init(const char *host, Int_t stype)
Init a PROOF slave object.
Definition: TXSlave.cxx:133
void FlushSocket()
Clean any input on the socket.
Definition: TXSlave.cxx:697
Int_t SendGroupPriority(const char *grp, Int_t priority)
Communicate to the coordinator the priprity of the group to which the user belongs Return 0 on succes...
Definition: TXSlave.cxx:549
Int_t Flush(TSocket *s)
Remove any reference to socket 's' from the global pipe and ready-socket queue.
Definition: TXSocket.cxx:2344
Input handler for XProofD sockets.
static TXSocketHandler * GetSocketHandler(TFileHandler *h=0, TSocket *s=0)
Get an instance of the input socket handler with 'h' as handler, connected to socket 's'.
High level handler of connections to XProofD.
Definition: TXSocket.h:59
static void SetLocation(const char *loc="")
Set location string.
Definition: TXSocket.cxx:242
@ kStopProcess
Definition: TXSocket.h:139
static TXSockPipe fgPipe
Definition: TXSocket.h:111
static constexpr double s
static constexpr double ns
Int_t fOpt
Definition: TXSocket.h:55
auto * m
Definition: textangle.C:8