Logo ROOT   6.08/07
Reference Guide
TXProofMgr.h
Go to the documentation of this file.
1 // @(#)root/proofx:$Id$
2 // Author: G. Ganis, Nov 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 #ifndef ROOT_TXProofMgr
13 #define ROOT_TXProofMgr
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TXProofMgr //
19 // //
20 // The PROOF manager interacts with the PROOF server coordinator to //
21 // create or destroy a PROOF session, attach to or detach from //
22 // existing one, and to monitor any client activity on the cluster. //
23 // At most one manager instance per server is allowed. //
24 // //
25 //////////////////////////////////////////////////////////////////////////
26 
27 #ifndef ROOT_TProofMgr
28 #include "TProofMgr.h"
29 #endif
30 #ifndef ROOT_TUrl
31 #include "TUrl.h"
32 #endif
33 #ifndef ROOT_TXHandler
34 #include "TXHandler.h"
35 #endif
36 
37 //
38 // XPROOF client version: increase whenever a non backward compatible
39 // change occur
40 // ->1 first version being tested by ALICE
42 
43 class TStopwatch;
44 class TXSocket;
45 
46 class TXProofMgr : public TProofMgr, public TXHandler {
47 
48 private:
49 
50  TXSocket *fSocket; // Connection to XRD
51 
52  Int_t Init(Int_t loglevel = -1);
53 
54  void CpProgress(const char *pfx, Long64_t bytes,
55  Long64_t size, TStopwatch *watch, Bool_t cr = kFALSE);
56  TObjString *Exec(Int_t action,
57  const char *what, const char *how, const char *where);
58 
59 public:
60  TXProofMgr(const char *url, Int_t loglevel = -1, const char *alias = "");
61  virtual ~TXProofMgr();
62 
63  Bool_t HandleInput(const void *);
64  Bool_t HandleError(const void *in = 0);
65 
66  Bool_t IsValid() const { return fSocket; }
67  void SetInvalid();
68 
70  { return TProofMgr::AttachSession(id, gui); }
72  void DetachSession(Int_t, Option_t * = "");
73  void DetachSession(TProof *, Option_t * = "");
74  const char *GetMssUrl(Bool_t = kFALSE);
75  TProofLog *GetSessionLogs(Int_t ridx = 0, const char *stag = 0,
76  const char *pattern = "-v \"| SvcMsg\"",
77  Bool_t rescan = kFALSE);
78  Bool_t MatchUrl(const char *url);
79  void ShowROOTVersions();
80  TList *QuerySessions(Option_t *opt = "S");
81  TObjString *ReadBuffer(const char *file, Long64_t ofs, Int_t len);
82  TObjString *ReadBuffer(const char *file, const char *pattern);
83  Int_t Reset(Bool_t hard = kFALSE, const char *usr = 0);
84  Int_t SendMsgToUsers(const char *msg, const char *usr = 0);
85  Int_t SetROOTVersion(const char *tag);
86  void ShowWorkers();
87 
88  // Remote file system actions
89  Int_t Cp(const char *src, const char *dst = 0, const char *opts = 0);
90  void Find(const char *what = "~/", const char *how = "-type f", const char *where = 0);
91  void Grep(const char *what, const char *how = 0, const char *where = 0);
92  void Ls(const char *what = "~/", const char *how = 0, const char *where = 0);
93  void More(const char *what, const char *how = 0, const char *where = 0);
94  Int_t Rm(const char *what, const char *how = 0, const char *where = 0);
95  void Tail(const char *what, const char *how = 0, const char *where = 0);
96  Int_t Md5sum(const char *what, TString &sum, const char *where = 0);
97  Int_t Stat(const char *what, FileStat_t &st, const char *where = 0);
98 
99  Int_t GetFile(const char *remote, const char *local, const char *opt = 0);
100  Int_t PutFile(const char *local, const char *remote, const char *opt = 0);
101 
102  ClassDef(TXProofMgr,0) // XrdProofd PROOF manager interface
103 };
104 
105 #endif
void ShowWorkers()
Show available workers.
Definition: TXProofMgr.cxx:343
TObjString * ReadBuffer(const char *file, Long64_t ofs, Int_t len)
Read, via the coordinator, 'len' bytes from offset 'ofs' of 'file'.
Definition: TXProofMgr.cxx:680
static long int sum(long int i)
Definition: Factory.cxx:1786
void CpProgress(const char *pfx, Long64_t bytes, Long64_t size, TStopwatch *watch, Bool_t cr=kFALSE)
Print file copy progress.
long long Long64_t
Definition: RtypesCore.h:69
Int_t Stat(const char *what, FileStat_t &st, const char *where=0)
Run 'stat' on one of the nodes.
Int_t Md5sum(const char *what, TString &sum, const char *where=0)
Run 'md5sum' on one of the nodes.
void DetachSession(Int_t, Option_t *="")
Detach session with 'id' from its proofserv.
Definition: TXProofMgr.cxx:236
Bool_t HandleError(const void *in=0)
Handle error on the input socket.
Definition: TXProofMgr.cxx:513
Int_t Cp(const char *src, const char *dst=0, const char *opts=0)
Copy files in/out of the sandbox.
Collectable string class.
Definition: TObjString.h:32
const char Option_t
Definition: RtypesCore.h:62
The PROOF manager interacts with the PROOF server coordinator to create or destroy a PROOF session...
Definition: TProofMgr.h:53
void SetInvalid()
Invalidate this manager by closing the connection.
Definition: TXProofMgr.cxx:167
void More(const char *what, const char *how=0, const char *where=0)
Run 'more' on the nodes.
Definition: TXProofMgr.cxx:962
Basic string class.
Definition: TString.h:137
void Grep(const char *what, const char *how=0, const char *where=0)
Run 'grep' on the nodes.
Definition: TXProofMgr.cxx:883
Int_t GetFile(const char *remote, const char *local, const char *opt=0)
Get file 'remote' into 'local' from the master.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
const char * GetMssUrl(Bool_t=kFALSE)
Gets the URL to be prepended to paths when accessing the MSS associated with the connected cluster...
Definition: TXProofMgr.cxx:369
TList * QuerySessions(Option_t *opt="S")
Get list of sessions accessible to this manager.
Definition: TXProofMgr.cxx:403
TXProofMgr(const char *url, Int_t loglevel=-1, const char *alias="")
Create a PROOF manager for the standard (old) environment.
Definition: TXProofMgr.cxx:101
Int_t SendMsgToUsers(const char *msg, const char *usr=0)
Send a message to connected users.
Definition: TXProofMgr.cxx:780
TProofLog * GetSessionLogs(Int_t ridx=0, const char *stag=0, const char *pattern="-v \ SvcMsg\, Bool_t rescan=kFALSE)
Get logs or log tails from last session associated with this manager instance.
Definition: TXProofMgr.cxx:592
Bool_t MatchUrl(const char *url)
Checks if 'url' refers to the same 'user:port' entity as the URL in memory.
Definition: TXProofMgr.cxx:308
Int_t Reset(Bool_t hard=kFALSE, const char *usr=0)
Send a cleanup request for the sessions associated with the current user.
Definition: TXProofMgr.cxx:557
#define ClassDef(name, id)
Definition: Rtypes.h:254
void Ls(const char *what="~/", const char *how=0, const char *where=0)
Run 'ls' on the nodes.
Definition: TXProofMgr.cxx:936
virtual ~TXProofMgr()
Destructor: close the connection.
Definition: TXProofMgr.cxx:159
static const std::string pattern("pattern")
virtual TProof * AttachSession(Int_t, Bool_t=kFALSE)
Dummy version provided for completeness.
Definition: TProofMgr.cxx:123
A doubly linked list.
Definition: TList.h:47
static const char * what
Definition: stlLoader.cc:6
Bool_t IsValid() const
Definition: TXProofMgr.h:66
void ShowROOTVersions()
Display what ROOT versions are available on the cluster.
Definition: TXProofMgr.cxx:731
Handler of asynchronous events for XProofD sockets.
Definition: TXHandler.h:30
High level handler of connections to XProofD.
Definition: TXSocket.h:73
Int_t PutFile(const char *local, const char *remote, const char *opt=0)
Put file 'local'to 'remote' to the master If opt is "force", the file, if it exists remotely...
TObjString * Exec(Int_t action, const char *what, const char *how, const char *where)
Execute 'action' (see EAdminExecType in 'XProofProtocol.h') at 'where' (default master), with options 'how', on 'what'.
Implementation of the functionality provided by TProofMgr in the case of a xproofd-based session...
Definition: TXProofMgr.h:46
Int_t Rm(const char *what, const char *how=0, const char *where=0)
Run 'rm' on the nodes.
Definition: TXProofMgr.cxx:990
TProof * AttachSession(Int_t id, Bool_t gui=kFALSE)
Dummy version provided for completeness.
Definition: TXProofMgr.h:69
const Int_t kXPROOF_Protocol
Definition: TXProofMgr.h:41
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition: TProof.h:346
Bool_t HandleInput(const void *)
Handle asynchronous input on the socket.
Definition: TXProofMgr.cxx:485
void Find(const char *what="~/", const char *how="-type f", const char *where=0)
Run 'find' on the nodes.
Definition: TXProofMgr.cxx:909
Int_t SetROOTVersion(const char *tag)
Set the default ROOT version to be used.
Definition: TXProofMgr.cxx:757
Definition: file.py:1
Int_t Init(Int_t loglevel=-1)
Do real initialization: open the connection and set the relevant variables.
Definition: TXProofMgr.cxx:122
TXSocket * fSocket
Definition: TXProofMgr.h:50
void Tail(const char *what, const char *how=0, const char *where=0)
Run 'tail' on the nodes.
Implementation of the PROOF session log handler.
Definition: TProofLog.h:38
Stopwatch class.
Definition: TStopwatch.h:30