ROOT  6.06/09
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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TXSlave //
15 // //
16 // This is the version of TSlave for slave servers based on XRD. //
17 // See TSlave for details. //
18 // //
19 //////////////////////////////////////////////////////////////////////////
20 
21 #include "TXSlave.h"
22 #include "TProof.h"
23 #include "TProofServ.h"
24 #include "TSystem.h"
25 #include "TEnv.h"
26 #include "TROOT.h"
27 #include "TUrl.h"
28 #include "TMessage.h"
29 #include "TMonitor.h"
30 #include "TError.h"
31 #include "TSysEvtHandler.h"
32 #include "TVirtualMutex.h"
33 #include "TThread.h"
34 #include "TXSocket.h"
35 #include "TXSocketHandler.h"
36 #include "Varargs.h"
37 #include "XProofProtocol.h"
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. --------------------------------
46 TSlave *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 
54 class XSlaveInit {
55  public:
56  XSlaveInit() {
57  TSlave::SetTXSlaveHook(&GetTXSlave);
58 }};
59 static 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 
69 void 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 //
77 class TXSlaveInterruptHandler : public TSignalHandler {
78 private:
79  TXSocket *fSocket;
80 public:
81  TXSlaveInterruptHandler(TXSocket *s = 0)
82  : TSignalHandler(kSigInterrupt, kFALSE), fSocket(s) { }
83  Bool_t Notify();
84 };
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 /// TXSlave interrupt handler.
88 
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 
103 TXSlave::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;
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
121  gSystem->AddFileHandler(sh);
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 
133 void 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 
423  if (type == TProof::kLocalInterrupt) {
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; send as many posts as needed
442  if (fSocket) {
443  R__LOCKGUARD(((TXSocket *)fSocket)->fAMtx);
444  TSemaphore *sem = &(((TXSocket *)fSocket)->fASem);
445  while (sem->TryWait() != 1)
446  sem->Post();
447  }
448  return;
449  }
450 
451  ((TXSocket *)fSocket)->SendInterrupt(type);
452  Info("Interrupt","Interrupt of type %d sent", type);
453 }
454 
455 ////////////////////////////////////////////////////////////////////////////////
456 /// Sent stop/abort request to PROOF server. It will be
457 /// processed asynchronously by a separate thread.
458 
459 void TXSlave::StopProcess(Bool_t abort, Int_t timeout)
460 {
461  if (!IsValid()) return;
462 
463  ((TXSocket *)fSocket)->SendUrgent(TXSocket::kStopProcess, (Int_t)abort, timeout);
464  if (gDebug > 0)
465  Info("StopProcess", "Request of type %d sent over", abort);
466 }
467 
468 ////////////////////////////////////////////////////////////////////////////////
469 /// Find out the remote proofd protocol version.
470 /// Returns -1 in case of error.
471 
473 {
474  Int_t rproto = -1;
475 
476  UInt_t cproto = 0;
477  Int_t len = sizeof(cproto);
478  memcpy((char *)&cproto,
479  Form(" %d", TSocket::GetClientProtocol()),len);
480  Int_t ns = s->SendRaw(&cproto, len);
481  if (ns != len) {
482  ::Error("TXSlave::GetProofdProtocol",
483  "sending %d bytes to proofd server [%s:%d]",
484  len, (s->GetInetAddress()).GetHostName(), s->GetPort());
485  return -1;
486  }
487 
488  // Get the remote protocol
489  Int_t ibuf[2] = {0};
490  len = sizeof(ibuf);
491  Int_t nr = s->RecvRaw(ibuf, len);
492  if (nr != len) {
493  ::Error("TXSlave::GetProofdProtocol",
494  "reading %d bytes from proofd server [%s:%d]",
495  len, (s->GetInetAddress()).GetHostName(), s->GetPort());
496  return -1;
497  }
498  Int_t kind = net2host(ibuf[0]);
499  if (kind == kROOTD_PROTOCOL) {
500  rproto = net2host(ibuf[1]);
501  } else {
502  kind = net2host(ibuf[1]);
503  if (kind == kROOTD_PROTOCOL) {
504  len = sizeof(rproto);
505  nr = s->RecvRaw(&rproto, len);
506  if (nr != len) {
507  ::Error("TXSlave::GetProofdProtocol",
508  "reading %d bytes from proofd server [%s:%d]",
509  len, (s->GetInetAddress()).GetHostName(), s->GetPort());
510  return -1;
511  }
512  rproto = net2host(rproto);
513  }
514  }
515  if (gDebug > 2)
516  ::Info("TXSlave::GetProofdProtocol",
517  "remote proofd: buf1: %d, buf2: %d rproto: %d",
518  net2host(ibuf[0]),net2host(ibuf[1]),rproto);
519 
520  // We are done
521  return rproto;
522 }
523 
524 ////////////////////////////////////////////////////////////////////////////////
525 /// Send message to intermediate coordinator.
526 /// If any output is due, this is returned as a generic message
527 
528 TObjString *TXSlave::SendCoordinator(Int_t kind, const char *msg, Int_t int2)
529 {
530  return ((TXSocket *)fSocket)->SendCoordinator(kind, msg, int2);
531 }
532 
533 ////////////////////////////////////////////////////////////////////////////////
534 /// Set an alias for this session. If reconnection is supported, the alias
535 /// will be communicated to the remote coordinator so that it can be recovered
536 /// when reconnecting
537 
538 void TXSlave::SetAlias(const char *alias)
539 {
540  // Nothing to do if not in contact with coordinator
541  if (!IsValid()) return;
542 
543  ((TXSocket *)fSocket)->SendCoordinator(kSessionAlias, alias);
544 
545  return;
546 }
547 
548 ////////////////////////////////////////////////////////////////////////////////
549 /// Communicate to the coordinator the priprity of the group to which the
550 /// user belongs
551 /// Return 0 on success
552 
553 Int_t TXSlave::SendGroupPriority(const char *grp, Int_t priority)
554 {
555  // Nothing to do if not in contact with coordinator
556  if (!IsValid()) return -1;
557 
558  ((TXSocket *)fSocket)->SendCoordinator(kGroupProperties, grp, priority);
559 
560  return 0;
561 }
562 
563 ////////////////////////////////////////////////////////////////////////////////
564 /// Handle error on the input socket
565 
567 {
568  XHandleErr_t *herr = in ? (XHandleErr_t *)in : 0;
569 
570  // Try reconnection
571  if (fSocket && herr && (herr->fOpt == 1)) {
572 
573  ((TXSocket *)fSocket)->Reconnect();
574  if (fSocket && fSocket->IsValid()) {
575  if (gDebug > 0) {
576  if (!strcmp(GetOrdinal(), "0")) {
577  Printf("Proof: connection to master at %s:%d re-established",
578  GetName(), GetPort());
579  } else {
580  Printf("Proof: connection to node '%s' at %s:%d re-established",
581  GetOrdinal(), GetName(), GetPort());
582  }
583  }
584  return kFALSE;
585  }
586  }
587 
588  // This seems a real error: notify the interested parties
589  Info("HandleError", "%p:%s:%s got called ... fProof: %p, fSocket: %p (valid: %d)",
590  this, fName.Data(), fOrdinal.Data(), fProof, fSocket,
591  (fSocket ? (Int_t)fSocket->IsValid() : -1));
592 
593  // Remove interrupt handler (avoid affecting other clients of the underlying physical
594  // connection)
596 
597  if (fProof) {
598 
599  // Remove PROOF signal handler
600  if (fProof->fIntHandler)
602 
603  Info("HandleError", "%p: proof: %p", this, fProof);
604 
605  if (fSocket) {
606  // This is need to skip contacting the remote server upon close
607  ((TXSocket *)fSocket)->SetSessionID(-1);
608  // This is need to interrupt possible pickup waiting status
609  ((TXSocket *)fSocket)->SetInterrupt();
610  // Synchronous collection in TProof: post fatal message; this will
611  // mark the worker as bad and update the internal lists accordingly
612  ((TXSocket *)fSocket)->PostMsg(kPROOF_FATAL);
613  }
614 
615  // On masters we notify clients of the problem occured
616  if (fProof->IsMaster()) {
617  TString msg(Form("Worker '%s-%s' has been removed from the active list",
618  fName.Data(), fOrdinal.Data()));
620  m << msg;
621  if (gProofServ)
622  gProofServ->GetSocket()->Send(m);
623  else
624  Warning("HandleError", "%p: global reference to TProofServ missing", this);
625  }
626  } else {
627  Warning("HandleError", "%p: reference to PROOF missing", this);
628  }
629 
630  Printf("TXSlave::HandleError: %p: DONE ... ", this);
631 
632  // We are done
633  return kTRUE;
634 }
635 
636 ////////////////////////////////////////////////////////////////////////////////
637 /// Handle asynchronous input on the socket
638 
640 {
641  if (fProof) {
642 
643  // Attach to the monitor instance, if any
645 
646  if (gDebug > 2)
647  Info("HandleInput", "%p: %s: proof: %p, mon: %p",
648  this, GetOrdinal(), fProof, mon);
649 
650  if (mon && mon->IsActive(fSocket)) {
651  // Synchronous collection in TProof
652  if (gDebug > 2)
653  Info("HandleInput","%p: %s: posting monitor %p", this, GetOrdinal(), mon);
654  mon->SetReady(fSocket);
655  } else {
656  // Asynchronous collection in TProof
657  if (gDebug > 2) {
658  if (mon) {
659  Info("HandleInput", "%p: %s: not active in current monitor"
660  " - calling TProof::CollectInputFrom",
661  this, GetOrdinal());
662  } else {
663  Info("HandleInput", "%p: %s: calling TProof::CollectInputFrom",
664  this, GetOrdinal());
665  }
666  }
667  if (fProof->CollectInputFrom(fSocket) < 0)
668  // Something wrong on the line: flush it
669  FlushSocket();
670  }
671  } else {
672  Warning("HandleInput", "%p: %s: reference to PROOF missing", this, GetOrdinal());
673  return kFALSE;
674  }
675 
676  // We are done
677  return kTRUE;
678 }
679 
680 ////////////////////////////////////////////////////////////////////////////////
681 /// Set/Unset the interrupt handler
682 
684 {
685  if (gDebug > 1)
686  Info("SetInterruptHandler", "enter: %d", on);
687 
688  if (on) {
689  if (!fIntHandler)
690  fIntHandler = new TXSlaveInterruptHandler((TXSocket *)fSocket);
691  fIntHandler->Add();
692  } else {
693  if (fIntHandler)
694  fIntHandler->Remove();
695  }
696 }
697 
698 ////////////////////////////////////////////////////////////////////////////////
699 /// Clean any input on the socket
700 
702 {
703  if (gDebug > 1)
704  Info("FlushSocket", "enter: %p", fSocket);
705 
706  if (fSocket)
708 }
TString fUser
Definition: TSlave.h:87
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:864
static void SetLocation(const char *loc="")
Set location string.
Definition: TXSocket.cxx:254
const char * GetOrdinal() const
Definition: TSlave.h:135
void StopProcess(Bool_t abort, Int_t timeout)
Sent stop/abort request to PROOF server.
Definition: TXSlave.cxx:459
static Int_t GetProofdProtocol(TSocket *s)
Find out the remote proofd protocol version.
Definition: TXSlave.cxx:472
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:553
void SetPort(Int_t port)
Definition: TUrl.h:97
Int_t GetRemoteProtocol() const
Definition: TSocket.h:156
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
Definition: TUrl.cxx:518
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Ssiz_t Length() const
Definition: TString.h:390
const char Int_t const char TProof Int_t const char const char * msd
Definition: TXSlave.cxx:46
Collectable string class.
Definition: TObjString.h:32
const char Option_t
Definition: RtypesCore.h:62
virtual Bool_t IsValid() const
Definition: TSocket.h:162
static XSlaveInit xslave_init
Definition: TXSlave.cxx:59
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
Definition: TSocket.cxx:520
virtual Int_t SetOption(ESockOptions opt, Int_t val)
Set socket options.
Definition: TSocket.cxx:1017
This class represents a WWW compatible URL.
Definition: TUrl.h:41
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'...
const char Int_t perf
Definition: TXSlave.cxx:46
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
Definition: TSocket.cxx:818
TProofMgr * GetManager()
Definition: TProof.h:1070
Int_t TryWait()
If semaphore value is > 0 then decrement it and return 0.
Definition: TSemaphore.cxx:81
const char * GetProtocol() const
Definition: TUrl.h:73
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:892
static const TList * GetEnvVars()
Get environemnt variables.
Definition: TProof.cxx:12318
virtual void Add()
Add signal handler to system signal handler list.
Bool_t Notify()
Definition: TTimer.cxx:65
#define R__ASSERT(e)
Definition: TError.h:98
#define gROOT
Definition: TROOT.h:340
void ParseBuffer()
Parse fBuffer after a connection attempt.
Definition: TXSlave.cxx:303
Int_t GetPort() const
Definition: TSocket.h:145
Basic string class.
Definition: TString.h:137
TList * GetListOfActives() const
Returns a list with all active sockets.
Definition: TMonitor.cxx:498
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t Ping()
Ping the remote master or slave servers.
Definition: TXSlave.cxx:397
Bool_t HandleError(const void *in=0)
Handle error on the input socket.
Definition: TXSlave.cxx:566
R__EXTERN TVirtualMutex * gROOTMutex
Definition: TROOT.h:63
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
Int_t fNWrks
Definition: TXSlave.h:43
const char * GetOptions() const
Definition: TUrl.h:80
ClassImp(TXSlave) TSlave *GetTXSlave(const char *url
Int_t fOpt
Definition: TXSocket.h:70
void Init(const char *host, Int_t stype)
Init a PROOF slave object.
Definition: TXSlave.cxx:133
const char * Data() const
Definition: TString.h:349
TSignalHandler * fIntHandler
Definition: TProof.h:519
virtual ~TXSlave()
Destroy slave.
Definition: TXSlave.cxx:375
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
Definition: TSocket.cxx:620
virtual Bool_t Notify()
Notify when signal occurs.
#define SafeDelete(p)
Definition: RConfig.h:436
UShort_t net2host(UShort_t x)
Definition: Bytes.h:579
#define PDB(mask, level)
Definition: TProofDebug.h:58
const char Int_t const char TProof Int_t stype
Definition: TXSlave.cxx:46
const char * ord
Definition: TXSlave.cxx:46
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual void DeActivate(TSocket *sock)
De-activate a socket.
Definition: TMonitor.cxx:284
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
const char * GetPasswd() const
Definition: TUrl.h:75
static void SetTXSlaveHook(TSlave_t xslavehook)
Set hook to TXSlave ctor.
Definition: TSlave.cxx:673
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1627
void Info(const char *location, const char *msgfmt,...)
TString fConfFile
Definition: TProof.h:599
TString fOrdinal
Definition: TSlave.h:90
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
Int_t SetupServ(Int_t stype, const char *conffile)
Init a PROOF slave object.
Definition: TXSlave.cxx:334
TSignalHandler * fIntHandler
Definition: TXSlave.h:44
A doubly linked list.
Definition: TList.h:47
static const char * what
Definition: stlLoader.cc:6
void SetDataPoolUrl(const char *url)
Definition: TProof.h:1077
Int_t GetPort() const
Definition: TUrl.h:87
const char Int_t const char TProof Int_t const char * workdir
Definition: TXSlave.cxx:46
const char * GetName() const
Returns name of object.
Definition: TSlave.h:128
TSocket * GetSocket() const
Definition: TProofServ.h:269
virtual void Close(Option_t *opt="")
Close the socket.
Definition: TSocket.cxx:388
void SetInterruptHandler(Bool_t on=kTRUE)
Set/Unset the interrupt handler.
Definition: TXSlave.cxx:683
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
TString fWorkDir
Definition: TSlave.h:86
TMonitor * fCurrentMonitor
Definition: TProof.h:515
Int_t GetLogLevel() const
Definition: TProof.h:949
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
Definition: TUrl.cxx:467
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
void SetReady(TSocket *sock)
Called by TSocketHandler::Notify() to signal which socket is ready to be read or written.
Definition: TMonitor.cxx:423
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
char * Form(const char *fmt,...)
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
TSocket * fSocket
Definition: TSlave.h:93
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:12327
Int_t Post()
If any threads are blocked in Wait(), wake one of them up and increment the value of the semaphore...
Definition: TSemaphore.cxx:105
const Int_t kPROOF_Protocol
Definition: TProof.h:143
Int_t Flush(TSocket *s)
Remove any reference to socket 's' from the global pipe and ready-socket queue.
Definition: TXSocket.cxx:2288
Bool_t IsNull() const
Definition: TString.h:387
Bool_t HandleInput(const void *in=0)
Handle asynchronous input on the socket.
Definition: TXSlave.cxx:639
Int_t fProtocol
Definition: TProof.h:602
#define Printf
Definition: TGeoToOCC.h:18
TObjString * SendCoordinator(Int_t kind, const char *msg=0, Int_t int2=0)
Send message to intermediate coordinator.
Definition: TXSlave.cxx:528
Int_t fProtocol
Definition: TSlave.h:92
TFileHandler * fInput
Definition: TSlave.h:95
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
Definition: TUrl.cxx:385
void Close(Option_t *opt="")
Close slave socket.
Definition: TXSlave.cxx:383
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
int Ssiz_t
Definition: RtypesCore.h:63
TString fName
Definition: TSlave.h:83
void FlushSocket()
Clean any input on the socket.
Definition: TXSlave.cxx:701
TXSlave(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)
Create a PROOF slave object. Called via the TProof ctor.
Definition: TXSlave.cxx:103
TProof * fProof
Definition: TSlave.h:94
virtual void Remove()
Remove signal handler from system signal handler list.
TString fMsd
Definition: TSlave.h:102
int type
Definition: TGX11.cxx:120
Definition: TProof.h:339
Bool_t IsMaster() const
Definition: TProof.h:969
#define R__LOCKGUARD(mutex)
Bool_t fValid
Definition: TXSlave.h:42
virtual Int_t GetRemoteProtocol() const
Definition: TProofMgr.h:100
TString fImage
Definition: TSlave.h:84
Mother of all ROOT objects.
Definition: TObject.h:58
void Interrupt(Int_t type)
Send interrupt to master or slave servers.
Definition: TXSlave.cxx:419
const char Int_t const char TProof * proof
Definition: TXSlave.cxx:46
char Char_t
Definition: RtypesCore.h:29
Bool_t IsActive(TSocket *s) const
Check if socket 's' is in the active list.
Definition: TMonitor.cxx:482
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:359
virtual int GetServiceByName(const char *service)
Get port # of internet service.
Definition: TSystem.cxx:2272
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
const Ssiz_t kNPOS
Definition: Rtypes.h:115
Int_t fPort
Definition: TSlave.h:89
Int_t fSessionID
Definition: TProof.h:556
void DoError(int level, const char *location, const char *fmt, va_list va) const
Interface to ErrorHandler (protected).
Definition: TXSlave.cxx:69
static TXSockPipe fgPipe
Definition: TXSocket.h:126
R__EXTERN Int_t gDebug
Definition: Rtypes.h:128
static Int_t GetClientProtocol()
Static method returning supported client protocol.
Definition: TSocket.cxx:1494
Int_t GetPort() const
Definition: TSlave.h:134
virtual void AddFileHandler(TFileHandler *fh)
Add a file handler to the list of system file handlers.
Definition: TSystem.cxx:558
TProofMgr::EServType fServType
Definition: TProof.h:617
void SetAlias(const char *alias)
Set an alias for this session.
Definition: TXSlave.cxx:538
virtual Bool_t IsValid() const
Definition: TSlave.h:154
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:582
Definition: TSlave.h:50
virtual Int_t RecvRaw(void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Receive a raw buffer of specified length bytes.
Definition: TSocket.cxx:901
TInetAddress GetInetAddress() const
Definition: TSocket.h:143
const Bool_t kTRUE
Definition: Rtypes.h:91
ESlaveType
Definition: TSlave.h:59
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
TUrl fUrl
Definition: TProof.h:598
ESlaveType fSlaveType
Definition: TSlave.h:99
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:12349
TString fProofWorkDir
Definition: TSlave.h:85
TString fGroup
Definition: TSlave.h:88
Int_t CollectInputFrom(TSocket *s, Int_t endtype=-1, Bool_t deactonfail=kFALSE)
Collect and analyze available input from socket s.
Definition: TProof.cxx:3049
Int_t fPerfIdx
Definition: TSlave.h:91
const char Int_t const char * image
Definition: TXSlave.cxx:46
void Touch()
Touch the client admin file to proof we are alive.
Definition: TXSlave.cxx:407
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904