Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TProofLite.h
Go to the documentation of this file.
1// @(#)root/proof:$Id$
2// Author: G. Ganis March 2008
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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_TProofLite
13#define ROOT_TProofLite
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TProofLite //
19// //
20// This class starts a PROOF session on the local machine: no daemons, //
21// client and master merged, communications via UNIX-like sockets. //
22// By default the number of workers started is NumberOfCores+1; a //
23// different number can be forced on construction. //
24// //
25//////////////////////////////////////////////////////////////////////////
26
27#include "TProof.h"
28
29class TDSet;
30class TList;
32class TDataSetManager;
33class TProofLockPath;
34class TProofMgr;
36class TServerSocket;
37class TSelector;
38class TPMERegexp;
39
40class TProofLite : public TProof {
41
42friend class TProofPlayerLite;
43
44private:
45 Int_t fNWorkers; // Number of workers
46 TString fSandbox; // PROOF sandbox root dir
47 TString fCacheDir; // Directory containing cache of user files
48 TString fQueryDir; // Directory containing query results and status
49 TString fDataSetDir; // Directory containing info about known data sets
50 TString fSockPath; // UNIX socket path for communication with workers
51 TServerSocket *fServSock; // Server socket to accept call backs
52 Bool_t fForkStartup; // Startup N-1 workers forking the first worker
53
54 Int_t fDynamicStartupStep; // Dyn Startup simulation: increment at each call
55 Int_t fDynamicStartupNMax; // Dyn Startup simulation: max number of workers
56
57 TString fVarExp; // Internal variable to pass drawing options
58 TString fSelection; // Internal variable to pass drawing options
59
60 TProofLockPath *fCacheLock; // Cache dir locker
61 TProofLockPath *fQueryLock; // Query dir locker
62 TQueryResultManager *fQMgr; // Query-result manager
63
64 TDataSetManager *fDataSetManager; // Dataset manager
65 TDataSetManagerFile *fDataSetStgRepo; // Dataset manager for staging requests
66
67 TPMERegexp *fReInvalid; // Regular expression matching invalid dataset URIs
68
69 static Int_t fgWrksMax; // Max number of workers
70
71 TProofLite(const TProofLite &); // not implemented
72 void operator=(const TProofLite &); // idem
73
76 void FindUniqueSlaves() override;
77 void NotifyStartUp(const char *action, Int_t done, Int_t tot);
78 Int_t SetProofServEnv(const char *ord);
80
81 void ResolveKeywords(TString &s, const char *ord, const char *logfile);
82
83 void SendInputDataFile() override;
84 void ShowDataDir(const char *dirname);
85
86protected:
87 TProofLite() : TProof() { } // For derived classes to use
88
89 Int_t Init(const char *masterurl, const char *conffile,
90 const char *confdir, Int_t loglevel,
91 const char *alias = 0);
92 TProofQueryResult *MakeQueryResult(Long64_t nent, const char *opt,
93 Long64_t fst, TDSet *dset,
94 const char *selec);
96 Int_t SetupWorkers(Int_t opt = 0, TList *wrks = 0);
97 Int_t CopyMacroToCache(const char *macro, Int_t headerRequired = 0,
98 TSelector **selector = 0, Int_t opt = 0, TList *wrks = 0);
99
100 Int_t PollForNewWorkers() override;
101
102public:
103 TProofLite(const char *masterurl, const char *conffile = kPROOF_ConfFile,
104 const char *confdir = kPROOF_ConfDir, Int_t loglevel = 0,
105 const char *alias = 0, TProofMgr *mgr = 0);
106 ~TProofLite() override;
107
108 void Print(Option_t *option="") const override;
109
110 Long64_t DrawSelect(TDSet *dset, const char *varexp,
111 const char *selection = "",
112 Option_t *option = "", Long64_t nentries = -1,
113 Long64_t firstentry = 0) override;
114 Long64_t Process(TDSet *dset, const char *sel, Option_t *o = "",
115 Long64_t nent = -1, Long64_t fst = 0) override;
116 Long64_t Process(TFileCollection *fc, const char *sel, Option_t *o = "",
117 Long64_t nent = -1, Long64_t fst = 0) override
118 { return TProof::Process(fc, sel, o, nent, fst); }
119 Long64_t Process(const char *dsname, const char *sel, Option_t *o = "",
120 Long64_t nent = -1, Long64_t fst = 0, TObject *enl = 0) override
121 { return TProof::Process(dsname, sel, o, nent, fst, enl); }
122 Long64_t Process(const char *sel, Long64_t nent, Option_t *o = "") override
123 { return TProof::Process(sel, nent, o); }
124 // Process via TSelector
126 Long64_t nent = -1, Long64_t fst = 0) override
127 { return TProof::Process(dset, sel, o, nent, fst); }
129 Long64_t nent = -1, Long64_t fst = 0) override
130 { return TProof::Process(fc, sel, o, nent, fst); }
131 Long64_t Process(const char *dsname, TSelector *sel, Option_t *o = "",
132 Long64_t nent = -1, Long64_t fst = 0, TObject *enl = 0) override
133 { return TProof::Process(dsname, sel, o, nent, fst, enl); }
134 Long64_t Process(TSelector* sel, Long64_t nent, Option_t *o = "") override
135 { return TProof::Process(sel, nent, o); }
136
137 // Cache management
138 void ShowCache(Bool_t all = kFALSE) override;
139 void ClearCache(const char *file = 0) override;
140 Int_t Load(const char *macro, Bool_t notOnClient = kFALSE, Bool_t uniqueOnly = kTRUE,
141 TList *wrks = 0) override;
142
143 // Data management
144 void ShowData() override;
145
146 // Query management
147 TList *GetListOfQueries(Option_t *opt = "") override;
148 Int_t Remove(const char *ref, Bool_t all);
149
150 // Dataset handling
151 Bool_t RegisterDataSet(const char *dsName, TFileCollection *ds, const char *opt = "") override;
152 Bool_t ExistsDataSet(const char *uri) override;
153 TMap *GetDataSets(const char *uri = "", const char * = 0) override;
154 void ShowDataSets(const char *uri = "", const char * = 0) override;
155 TFileCollection *GetDataSet(const char *uri, const char * = 0) override;
156 Int_t RemoveDataSet(const char *uri, const char * = 0) override;
157 Bool_t RequestStagingDataSet(const char *dataset) override;
158 Bool_t CancelStagingDataSet(const char *dataset) override;
159 TFileCollection *GetStagingStatusDataSet(const char *dataset) override;
160 Int_t VerifyDataSet(const char *uri, const char * = 0) override;
161 Int_t SetDataSetTreeName( const char *dataset, const char *treename) override;
162 void ShowDataSetCache(const char *dataset = 0) override;
163 void ClearDataSetCache(const char *dataset = 0) override;
164
165 // Browsing
166 TTree *GetTreeHeader(TDSet *tdset) override;
167
168 static Int_t GetNumberOfWorkers(const char *url = 0);
169
170 ClassDefOverride(TProofLite,0) //PROOF-Lite control class
171};
172
173#endif
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
int nentries
const char *const kPROOF_ConfFile
Definition TProof.h:122
const char *const kPROOF_ConfDir
Definition TProof.h:123
This class implements a data set to be used for PROOF processing.
Definition TDSet.h:153
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
A doubly linked list.
Definition TList.h:38
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition TMap.h:40
Mother of all ROOT objects.
Definition TObject.h:41
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition TPRegexp.h:97
This class starts a PROOF session on the local machine: no daemons, client and master merged,...
Definition TProofLite.h:40
void FindUniqueSlaves() override
Add to the fUniqueSlave list the active slaves that have a unique (user) file system image.
Bool_t fForkStartup
Definition TProofLite.h:52
TProofLite(const TProofLite &)
Int_t VerifyDataSet(const char *uri, const char *=0) override
Verify if all files in the specified dataset are available.
TProofLockPath * fQueryLock
Definition TProofLite.h:61
Long64_t Process(TDSet *dset, const char *sel, Option_t *o="", Long64_t nent=-1, Long64_t fst=0) override
Process a data set (TDSet) using the specified selector (.C) file.
static Int_t GetNumberOfWorkers(const char *url=0)
Static method to determine the number of workers giving priority to users request.
Int_t PollForNewWorkers() override
Simulate dynamic addition, for test purposes.
TString fVarExp
Definition TProofLite.h:57
TFileCollection * GetDataSet(const char *uri, const char *=0) override
Get a list of TFileInfo objects describing the files of the specified dataset.
Int_t SetDataSetTreeName(const char *dataset, const char *treename) override
Set/Change the name of the default tree.
Int_t CreateSandbox()
Create the sandbox for this session.
Int_t Load(const char *macro, Bool_t notOnClient=kFALSE, Bool_t uniqueOnly=kTRUE, TList *wrks=0) override
Copy the specified macro in the cache directory.
TString fSockPath
Definition TProofLite.h:50
TQueryResultManager * fQMgr
Definition TProofLite.h:62
Int_t InitDataSetManager()
Initialize the dataset manager from directives or from defaults Return 0 on success,...
TServerSocket * fServSock
Definition TProofLite.h:51
TString fCacheDir
Definition TProofLite.h:47
TDataSetManagerFile * fDataSetStgRepo
Definition TProofLite.h:65
Int_t SetProofServEnv(const char *ord)
Create environment files for worker 'ord'.
TPMERegexp * fReInvalid
Definition TProofLite.h:67
void ClearDataSetCache(const char *dataset=0) override
Clear the content of the dataset cache, if any (matching 'dataset', if defined).
Int_t RemoveDataSet(const char *uri, const char *=0) override
Remove the specified dataset from the PROOF cluster.
void ShowData() override
List contents of the data directory in the sandbox.
void NotifyStartUp(const char *action, Int_t done, Int_t tot)
Notify setting-up operation message.
void ShowDataSets(const char *uri="", const char *=0) override
Shows datasets in locations that match the uri By default shows the user's datasets and global ones.
void SetQueryRunning(TProofQueryResult *pq)
Set query in running state.
Int_t CleanupSandbox()
Remove old sessions dirs keep at most 'Proof.MaxOldSessions' (default 10)
Long64_t Process(const char *dsname, TSelector *sel, Option_t *o="", Long64_t nent=-1, Long64_t fst=0, TObject *enl=0) override
Process with name of dataset and TSelector object.
Definition TProofLite.h:131
Int_t fNWorkers
Definition TProofLite.h:45
static Int_t fgWrksMax
Definition TProofLite.h:69
Long64_t Process(TDSet *dset, TSelector *sel, Option_t *o="", Long64_t nent=-1, Long64_t fst=0) override
Process a data set (TDSet) using the specified selector object.
Definition TProofLite.h:125
Long64_t Process(TFileCollection *fc, const char *sel, Option_t *o="", Long64_t nent=-1, Long64_t fst=0) override
Process a data set (TFileCollection) using the specified selector (.C) file or TSelector object.
Definition TProofLite.h:116
TDataSetManager * fDataSetManager
Definition TProofLite.h:64
void ClearCache(const char *file=0) override
Remove files from all file caches.
Int_t Remove(const char *ref, Bool_t all)
Handle remove request.
Int_t Init(const char *masterurl, const char *conffile, const char *confdir, Int_t loglevel, const char *alias=0)
Start the PROOF environment.
Long64_t Process(TSelector *sel, Long64_t nent, Option_t *o="") override
Generic (non-data based) selector processing: the Process() method of the specified selector is calle...
Definition TProofLite.h:134
void operator=(const TProofLite &)
void ShowCache(Bool_t all=kFALSE) override
List contents of file cache.
TString fSelection
Definition TProofLite.h:58
Bool_t RequestStagingDataSet(const char *dataset) override
Allows users to request staging of a particular dataset.
TList * GetListOfQueries(Option_t *opt="") override
Get the list of queries.
void ShowDataDir(const char *dirname)
List contents of the data directory 'dirname'.
void ResolveKeywords(TString &s, const char *ord, const char *logfile)
Resolve some keywords in 's' <logfilewrk>, <user>, <rootsys>, <cpupin>
TTree * GetTreeHeader(TDSet *tdset) override
Creates a tree header (a tree with nonexisting files) object for the DataSet.
void Print(Option_t *option="") const override
Print status of PROOF-Lite cluster.
TMap * GetDataSets(const char *uri="", const char *=0) override
lists all datasets that match given uri
Bool_t CancelStagingDataSet(const char *dataset) override
Cancels a dataset staging request.
Long64_t Process(const char *dsname, const char *sel, Option_t *o="", Long64_t nent=-1, Long64_t fst=0, TObject *enl=0) override
Process a dataset which is stored on the master with name 'dsetname'.
Definition TProofLite.h:119
Int_t fDynamicStartupNMax
Definition TProofLite.h:55
void SendInputDataFile() override
Make sure that the input data objects are available to the workers in a dedicated file in the cache; ...
TString fSandbox
Definition TProofLite.h:46
Int_t CopyMacroToCache(const char *macro, Int_t headerRequired=0, TSelector **selector=0, Int_t opt=0, TList *wrks=0)
Copy a macro, and its possible associated .h[h] file, to the cache directory, from where the workers ...
Long64_t Process(TFileCollection *fc, TSelector *sel, Option_t *o="", Long64_t nent=-1, Long64_t fst=0) override
Process a data set (TFileCollection) using the specified selector object The default tree is analyzed...
Definition TProofLite.h:128
Int_t fDynamicStartupStep
Definition TProofLite.h:54
Bool_t RegisterDataSet(const char *dsName, TFileCollection *ds, const char *opt="") override
Register the 'dataSet' on the cluster under the current user, group and the given 'dataSetName'.
TString fQueryDir
Definition TProofLite.h:48
Bool_t ExistsDataSet(const char *uri) override
Returns kTRUE if 'dataset' described by 'uri' exists, kFALSE otherwise.
Long64_t Process(const char *sel, Long64_t nent, Option_t *o="") override
Generic (non-data based) selector processing: the Process() method of the specified selector (....
Definition TProofLite.h:122
TProofQueryResult * MakeQueryResult(Long64_t nent, const char *opt, Long64_t fst, TDSet *dset, const char *selec)
Create a TProofQueryResult instance for this query.
TFileCollection * GetStagingStatusDataSet(const char *dataset) override
Obtains a TFileCollection showing the staging status of the specified dataset.
~TProofLite() override
Destructor.
Int_t SetupWorkers(Int_t opt=0, TList *wrks=0)
Start up PROOF workers.
TString fDataSetDir
Definition TProofLite.h:49
Long64_t DrawSelect(TDSet *dset, const char *varexp, const char *selection="", Option_t *option="", Long64_t nentries=-1, Long64_t firstentry=0) override
Execute the specified drawing action on a data set (TDSet).
TProofLockPath * fCacheLock
Definition TProofLite.h:60
void ShowDataSetCache(const char *dataset=0) override
Display the content of the dataset cache, if any (matching 'dataset', if defined).
The PROOF manager interacts with the PROOF server coordinator to create or destroy a PROOF session,...
Definition TProofMgr.h:43
Version of TProofPlayerRemote merges the functionality needed by clients and masters.
TQueryResult version adapted to PROOF neeeds.
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition TProof.h:316
virtual Long64_t Process(TDSet *dset, const char *selector, Option_t *option="", Long64_t nentries=-1, Long64_t firstentry=0)
Process a data set (TDSet) using the specified selector (.C) file or Tselector object Entry- or event...
Definition TProof.cxx:5303
Class managing the query-result area.
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
Basic string class.
Definition TString.h:139
A TTree represents a columnar dataset.
Definition TTree.h:79