PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/root-5.34.01/proof/proof/inc/TSlave.h

#
C Header | 171 lines | 113 code | 35 blank | 23 comment | 0 complexity | fbf89213e05564fd46f27929517fa8b8 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, LGPL-2.0, JSON, GPL-2.0, BSD-3-Clause
  1. // @(#)root/proof:$Id: TSlave.h 37976 2011-02-04 11:43:16Z ganis $
  2. // Author: Fons Rademakers 14/02/97
  3. /*************************************************************************
  4. * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
  5. * All rights reserved. *
  6. * *
  7. * For the licensing terms see $ROOTSYS/LICENSE. *
  8. * For the list of contributors see $ROOTSYS/README/CREDITS. *
  9. *************************************************************************/
  10. #ifndef ROOT_TSlave
  11. #define ROOT_TSlave
  12. //////////////////////////////////////////////////////////////////////////
  13. // //
  14. // TSlave //
  15. // //
  16. // This class describes a PROOF slave server. //
  17. // It contains information like the slaves host name, ordinal number, //
  18. // performance index, socket, etc. Objects of this class can only be //
  19. // created via TProof member functions. //
  20. // //
  21. //////////////////////////////////////////////////////////////////////////
  22. #ifndef ROOT_TObject
  23. #include "TObject.h"
  24. #endif
  25. #ifndef ROOT_TString
  26. #include "TString.h"
  27. #endif
  28. class TFileHandler;
  29. class TObjString;
  30. class TProof;
  31. class TSlave;
  32. class TSocket;
  33. // Special type for the hook to external function setting up authentication
  34. // related stuff for old versions. For backward compatibility.
  35. typedef Int_t (*OldSlaveAuthSetup_t)(TSocket *, Bool_t, TString, TString);
  36. // Special type for the hook to the TSlave constructor, needed to avoid
  37. // using the plugin manager
  38. typedef TSlave *(*TSlave_t)(const char *url, const char *ord, Int_t perf,
  39. const char *image, TProof *proof, Int_t stype,
  40. const char *workdir, const char *msd);
  41. class TSlave : public TObject {
  42. friend class TProof;
  43. friend class TProofLite;
  44. friend class TSlaveLite;
  45. friend class TXSlave;
  46. public:
  47. enum ESlaveType { kMaster, kSlave };
  48. enum ESlaveStatus { kInvalid, kActive, kInactive };
  49. private:
  50. static TSlave_t fgTXSlaveHook;
  51. TSlave(const TSlave &s) : TObject(s) { }
  52. TSlave(const char *host, const char *ord, Int_t perf,
  53. const char *image, TProof *proof, Int_t stype,
  54. const char *workdir, const char *msd);
  55. Int_t OldAuthSetup(Bool_t master, TString wconf);
  56. void Init(const char *host, Int_t port, Int_t stype);
  57. void operator=(const TSlave &) { }
  58. static TSlave *Create(const char *url, const char *ord, Int_t perf,
  59. const char *image, TProof *proof, Int_t stype,
  60. const char *workdir, const char *msd);
  61. protected:
  62. TString fName; //slave's hostname
  63. TString fImage; //slave's image name
  64. TString fProofWorkDir; //base proofserv working directory (info obtained from slave)
  65. TString fWorkDir; //slave's working directory (info obtained from slave)
  66. TString fUser; //slave's user id
  67. TString fGroup; //slave's group id
  68. Int_t fPort; //slave's port number
  69. TString fOrdinal; //slave's ordinal number
  70. Int_t fPerfIdx; //relative CPU performance index
  71. Int_t fProtocol; //slave's protocol level
  72. TSocket *fSocket; //socket to slave
  73. TProof *fProof; //proof cluster to which slave belongs
  74. TFileHandler *fInput; //input handler related to this slave
  75. Long64_t fBytesRead; //bytes read by slave (info is obtained from slave)
  76. Float_t fRealTime; //real time spent executing commands (info obtained from slave)
  77. Float_t fCpuTime; //CPU time spent executing commands (info obtained from slave)
  78. ESlaveType fSlaveType; //type of slave (either kMaster or kSlave)
  79. Int_t fStatus; //remote return status
  80. Int_t fParallel; //number of active slaves
  81. TString fMsd; //mass storage domain of slave
  82. TString fSessionTag;//unique tag for ths worker process
  83. TString fROOTVers; //ROOT version run by worker
  84. TString fArchComp; //Build architecture, compiler on worker (e.g. linux-gcc345)
  85. TSlave();
  86. virtual void FlushSocket() { }
  87. void Init(TSocket *s, Int_t stype);
  88. virtual void Interrupt(Int_t type);
  89. virtual Int_t Ping();
  90. virtual TObjString *SendCoordinator(Int_t kind, const char *msg = 0, Int_t int2 = 0);
  91. virtual Int_t SendGroupPriority(const char * /*grp*/, Int_t /*priority*/) { return 0; }
  92. virtual void SetAlias(const char *alias);
  93. void SetSocket(TSocket *s) { fSocket = s; }
  94. virtual void SetStatus(Int_t st) { fStatus = st; }
  95. virtual void StopProcess(Bool_t abort, Int_t timeout);
  96. public:
  97. virtual ~TSlave();
  98. virtual void Close(Option_t *opt = "");
  99. Int_t Compare(const TObject *obj) const;
  100. Bool_t IsSortable() const { return kTRUE; }
  101. const char *GetName() const { return fName; }
  102. const char *GetImage() const { return fImage; }
  103. const char *GetProofWorkDir() const { return fProofWorkDir; }
  104. const char *GetWorkDir() const { return fWorkDir; }
  105. const char *GetUser() const { return fUser; }
  106. const char *GetGroup() const { return fGroup; }
  107. Int_t GetPort() const { return fPort; }
  108. const char *GetOrdinal() const { return fOrdinal; }
  109. Int_t GetPerfIdx() const { return fPerfIdx; }
  110. Int_t GetProtocol() const { return fProtocol; }
  111. TSocket *GetSocket() const { return fSocket; }
  112. TProof *GetProof() const { return fProof; }
  113. Long64_t GetBytesRead() const { return fBytesRead; }
  114. Float_t GetRealTime() const { return fRealTime; }
  115. Float_t GetCpuTime() const { return fCpuTime; }
  116. Int_t GetSlaveType() const { return (Int_t)fSlaveType; }
  117. Int_t GetStatus() const { return fStatus; }
  118. Int_t GetParallel() const { return fParallel; }
  119. const char *GetMsd() const { return fMsd; }
  120. const char *GetSessionTag() const { return fSessionTag; }
  121. TFileHandler *GetInputHandler() const { return fInput; }
  122. void SetInputHandler(TFileHandler *ih);
  123. const char *GetArchCompiler() const { return fArchComp; }
  124. const char *GetROOTVersion() const { return fROOTVers; }
  125. virtual Bool_t IsValid() const { return fSocket ? kTRUE : kFALSE; }
  126. virtual void Print(Option_t *option="") const;
  127. virtual Int_t SetupServ(Int_t stype, const char *conffile);
  128. virtual void SetInterruptHandler(Bool_t /* on */) { }
  129. void SetArchCompiler(const char *ac) { fArchComp = ac; }
  130. void SetROOTVersion(const char *rv) { fROOTVers = rv; }
  131. void SetSessionTag(const char *st) { fSessionTag = st; }
  132. static void SetTXSlaveHook(TSlave_t xslavehook);
  133. virtual void Touch() { }
  134. ClassDef(TSlave,0) //PROOF slave server
  135. };
  136. #endif