Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TVirtualPacketizer.h
Go to the documentation of this file.
1// @(#)root/proofplayer:$Id$
2// Author: Maarten Ballintijn 9/7/2002
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, 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_TVirtualPacketizer
13#define ROOT_TVirtualPacketizer
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TVirtualPacketizer //
18// //
19// Packetizer is a load balancing object created for each query. //
20// It generates packets to be processed on PROOF worker servers. //
21// A packet is an event range (begin entry and number of entries) or //
22// object range (first object and number of objects) in a TTree //
23// (entries) or a directory (objects) in a file. //
24// Packets are generated taking into account the performance of the //
25// remote machine, the time it took to process a previous packet on //
26// the remote machine, the locality of the database files, etc. //
27// //
28// TVirtualPacketizer includes common parts of PROOF packetizers. //
29// Look in subclasses for details. //
30// The default packetizer is TPacketizerAdaptive. //
31// To use an alternative one, for instance - the TPacketizer, call: //
32// proof->SetParameter("PROOF_Packetizer", "TPacketizer"); //
33// //
34//////////////////////////////////////////////////////////////////////////
35
36#include "TObject.h"
37#include "TSlave.h"
39#include "TTime.h"
40
41
42class TDSet;
43class TDSetElement;
44class TList;
45class TMap;
46class TMessage;
47class TNtuple;
48class TNtupleD;
50class TSlave;
51
52
54
55public: // public because of Sun CC bug
57
58protected:
59 enum EUseEstOpt { // Option for usage of estimated values
62 kEstAverage = 2
63 };
64
65 // General configuration parameters
66 Double_t fMinPacketTime; // minimum packet time
67 Double_t fMaxPacketTime; // maximum packet time
68 TList *fConfigParams; // List of configuration parameters
69
70 TMap *fSlaveStats; // slave status, keyed by correspondig TSlave
71
72 TProofProgressStatus *fProgressStatus; // pointer to status in the player.
73 TTimer *fProgress; // progress updates timer
74
75 Long64_t fTotalEntries; // total number of entries to be distributed;
76 // not used in the progressive packetizer
77 TList *fFailedPackets;// a list of packets that failed while processing
78
79 // Members for progress info
80 TTime fStartTime; // time offset
81 Float_t fInitTime; // time before processing
82 Float_t fProcTime; // time since start of processing
83 Float_t fTimeUpdt; // time between updates
84 TNtupleD *fCircProg; // Keeps circular info for "instantenous"
85 // rate calculations
86 Long_t fCircN; // Circularity
87
88 TNtuple *fProgressPerf; // {Active workers, evt rate, MBs read} as a function of processing time
89 Float_t fProcTimeLast; // Time of the last measurement
90 Int_t fActWrksLast; // Active workers at fProcTimeLast
91 Float_t fEvtRateLast; // Evt rate at fProcTimeLast
92 Float_t fMBsReadLast; // MBs read at fProcTimeLast
93 Float_t fEffSessLast; // Number of effective sessions at fProcTimeLast
94 Bool_t fAWLastFill; // Whether to fill the last measurement
95 Float_t fReportPeriod; // Time between reports if nothing changes (estimated proc time / 100)
96
97 EUseEstOpt fUseEstOpt; // Control usage of estimated values for the progress info
98
99 Bool_t fValid; // Constructed properly?
100 Bool_t fStop; // Termination of Process() requested?
101
102 TString fDataSet; // Name of the dataset being processed (for dataset-driven runs)
103
104 TList *fInput; // Input list
105
107 TVirtualPacketizer(const TVirtualPacketizer &); // no implementation, will generate
108 void operator=(const TVirtualPacketizer &); // error on accidental usage
109
111 Long64_t GetEntries(Bool_t tree, TDSetElement *e); // Num of entries or objects
112 Bool_t HandleTimer(TTimer *timer) override;
113
114public:
115 enum EStatusBits { kIsInitializing = BIT(16), kIsDone = BIT(17), kIsTree = BIT(18) };
116 ~TVirtualPacketizer() override;
117
118 virtual Int_t AssignWork(TDSet* /*dset*/, Long64_t /*first*/, Long64_t /*num*/) { return -1; }
119 Bool_t IsValid() const { return fValid; }
122 { ent = GetEntriesProcessed(); bytes = GetBytesRead(); calls = GetReadCalls(); return 0; }
126 virtual void SetInitTime();
127 virtual void StopProcess(Bool_t abort, Bool_t stoptimer = kFALSE);
129 void SetFailedPackets(TList *list) { fFailedPackets = list; }
130 virtual Int_t AddWorkers(TList *workers);
131
135 Float_t GetInitTime() const { return fInitTime; }
136 Float_t GetProcTime() const { return fProcTime; }
137 TNtuple *GetProgressPerf(Bool_t steal = kFALSE) { if (steal) { TNtuple *n = fProgressPerf; fProgressPerf = 0; return n;
138 } else { return fProgressPerf;} }
139 TList *GetConfigParams(Bool_t steal = kFALSE) { if (steal) { TList *l = fConfigParams; fConfigParams = 0; return l;
140 } else { return fConfigParams;} }
141 virtual void MarkBad(TSlave * /*s*/, TProofProgressStatus * /*status*/, TList ** /*missingFiles*/) { return; }
142 virtual Int_t AddProcessed(TSlave * /*sl*/, TProofProgressStatus * /*st*/,
143 Double_t /*lat*/, TList ** /*missingFiles*/) { return 0; }
147
148 TMap *GetSlaveStats() const { return fSlaveStats; }
149
150 virtual Int_t GetActiveWorkers() { return -1; }
151
152 ClassDefOverride(TVirtualPacketizer,0) //Generate work packets for parallel processing
153};
154
155//------------------------------------------------------------------------------
156
158
160friend class TPacketizer;
161
162protected:
163 TString fWrkFQDN; // Worker FQDN
164 TSlave *fSlave; // corresponding TSlave record
165 TProofProgressStatus *fStatus; // status as of the last finished packet
166
167public:
168 const char *GetName() const override { return fWrkFQDN.Data(); }
169 const char *GetOrdinal() const { return fSlave->GetOrdinal(); }
175};
176
177#endif
#define e(i)
Definition RSha256.hxx:103
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long Long_t
Definition RtypesCore.h:54
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
long long Long64_t
Definition RtypesCore.h:69
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
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 r
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 bytes
Manages an element of a TDSet.
Definition TDSet.h:66
This class implements a data set to be used for PROOF processing.
Definition TDSet.h:153
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
A simple TTree restricted to a list of double variables only.
Definition TNtupleD.h:28
A simple TTree restricted to a list of float variables only.
Definition TNtuple.h:28
Mother of all ROOT objects.
Definition TObject.h:41
This packetizer is based on TPacketizer but uses different load-balancing algorithms and data structu...
This class generates packets to be processed on PROOF worker servers.
Definition TPacketizer.h:39
Container class for processing statistics.
Double_t GetProcTime() const
Long64_t GetReadCalls() const
Long64_t GetEntries() const
Double_t GetCurrentRate() const
Get current rate. Rteunr the average rate if the current is not defined.
Long64_t GetBytesRead() const
Class describing a PROOF worker server.
Definition TSlave.h:46
const char * GetOrdinal() const
Definition TSlave.h:131
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
Basic time type with millisecond precision.
Definition TTime.h:27
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
virtual TProofProgressStatus * AddProcessed(TProofProgressStatus *st)=0
const char * GetName() const override
Returns name of object.
The packetizer is a load balancing object created for each query.
Long64_t GetEntries(Bool_t tree, TDSetElement *e)
Get entries.
TProofProgressStatus * GetStatus()
Float_t GetProcTime() const
void SetProgressStatus(TProofProgressStatus *st)
virtual Int_t GetEstEntriesProcessed(Float_t, Long64_t &ent, Long64_t &bytes, Long64_t &calls)
virtual Int_t AddWorkers(TList *workers)
Adds new workers.
~TVirtualPacketizer() override
Destructor.
TVirtualPacketizer(const TVirtualPacketizer &)
TProofProgressStatus * fProgressStatus
TNtuple * GetProgressPerf(Bool_t steal=kFALSE)
void SetFailedPackets(TList *list)
virtual Int_t AddProcessed(TSlave *, TProofProgressStatus *, Double_t, TList **)
TMap * GetSlaveStats() const
Long64_t GetReadCalls() const
virtual Float_t GetCurrentRate(Bool_t &all)
virtual void MarkBad(TSlave *, TProofProgressStatus *, TList **)
Long64_t GetEntriesProcessed() const
Long64_t GetTotalEntries() const
Double_t GetCumProcTime() const
virtual void StopProcess(Bool_t abort, Bool_t stoptimer=kFALSE)
Stop process.
Bool_t HandleTimer(TTimer *timer) override
Send progress message to client.
Float_t GetInitTime() const
virtual void SetInitTime()
Set the initialization time.
void operator=(const TVirtualPacketizer &)
virtual Int_t AssignWork(TDSet *, Long64_t, Long64_t)
virtual Int_t GetActiveWorkers()
Long64_t GetBytesRead() const
TDSetElement * CreateNewPacket(TDSetElement *base, Long64_t first, Long64_t num)
Creates a new TDSetElement from from base packet starting from the first entry with num entries.
TList * GetConfigParams(Bool_t steal=kFALSE)
virtual TDSetElement * GetNextPacket(TSlave *sl, TMessage *r)
Get next packet.
void SetTotalEntries(Long64_t ent)
const Int_t n
Definition legend1.C:16
TLine l
Definition textangle.C:4