Logo ROOT   6.14/05
Reference Guide
TPacketizer.h
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: Maarten Ballintijn 18/03/02
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_TPacketizer
13 #define ROOT_TPacketizer
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TPacketizer //
18 // //
19 // This class generates packets to be processed on PROOF slave servers. //
20 // A packet is an event range (begin entry and number of entries) or //
21 // object range (first object and number of objects) in a TTree //
22 // (entries) or a directory (objects) in a file. //
23 // Packets are generated taking into account the performance of the //
24 // remote machine, the time it took to process a previous packet on //
25 // the remote machine, the locality of the database files, etc. //
26 // //
27 //////////////////////////////////////////////////////////////////////////
28 
29 #include "TVirtualPacketizer.h"
30 
31 
32 class TMessage;
33 class TTimer;
34 class TTree;
35 class TMap;
37 class TProofStats;
38 
40 
41 public: // public because of Sun CC bug
42  class TFileNode;
43  class TFileStat;
44  class TSlaveStat;
45 
46 private:
47  TList *fPackets; // all processed packets
48 
49  TList *fFileNodes; // nodes with files
50  TList *fUnAllocated; // nodes with unallocated files
51  TList *fActive; // nodes with unfinished files
52 
53  Long64_t fPacketSize; // global base packet size
54  // It can be set with PROOF_PacketSize
55  // parameter, in the input list.
56  Int_t fMaxPerfIdx; // maximum of our slaves' performance index
57 
58  Long_t fMaxSlaveCnt; // maximum number of workers per filenode (Long_t to avoid
59  // warnings from backward compatibility support)
60  Int_t fPacketAsAFraction; // used to calculate the packet size
61  // fPacketSize = fTotalEntries / (fPacketAsAFraction * nslaves)
62  // fPacketAsAFraction can be interpreted as follows:
63  // assuming all slaves have equal processing rate, packet size
64  // is (#events processed by 1 slave) / fPacketSizeAsAFraction.
65  // It can be set with PROOF_PacketAsAFraction in input list.
66 
67  // Add workers controls
68  Bool_t fHeuristicPSiz; // Whether the packet size is calculated heuristically
69  Bool_t fDefMaxWrkNode; // Whether the default is used for the max workers per node
70 
71  TPacketizer();
72  TPacketizer(const TPacketizer&); // no implementation, will generate
73  void operator=(const TPacketizer&); // error on accidental usage
74 
75  TFileNode *NextUnAllocNode();
76  void RemoveUnAllocNode(TFileNode *);
77 
78  TFileNode *NextActiveNode();
79  void RemoveActiveNode(TFileNode *);
80 
81  TFileStat *GetNextUnAlloc(TFileNode *node = 0);
82  TFileStat *GetNextActive();
83  void RemoveActive(TFileStat *file);
84 
85  void Reset();
86  void ValidateFiles(TDSet *dset, TList *slaves, Long64_t maxent = -1, Bool_t byfile = kFALSE);
87 
88 public:
89  TPacketizer(TDSet *dset, TList *slaves, Long64_t first, Long64_t num,
90  TList *input, TProofProgressStatus *st);
91  virtual ~TPacketizer();
92 
93  Int_t AddWorkers(TList *workers);
96 
99 
100  ClassDef(TPacketizer,0) //Generate work packets for parallel processing
101 };
102 
103 #endif
long long Long64_t
Definition: RtypesCore.h:69
Int_t fPacketAsAFraction
Definition: TPacketizer.h:60
float Float_t
Definition: RtypesCore.h:53
Int_t GetActiveWorkers()
Return the number of workers still processing.
void operator=(const TPacketizer &)
This class implements a data set to be used for PROOF processing.
Definition: TDSet.h:153
TList * fPackets
Definition: TPacketizer.h:44
Float_t GetCurrentRate(Bool_t &all)
Get Estimation of the current rate; just summing the current rates of the active workers.
void RemoveActiveNode(TFileNode *)
Remove node from the list of actives.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual ~TPacketizer()
Destructor.
This class generates packets to be processed on PROOF worker servers.
Definition: TPacketizer.h:39
Manages an element of a TDSet.
Definition: TDSet.h:66
TDSetElement * GetNextPacket(TSlave *sl, TMessage *r)
Get next packet.
#define ClassDef(name, id)
Definition: Rtypes.h:320
Long64_t fPacketSize
Definition: TPacketizer.h:53
TList * fFileNodes
Definition: TPacketizer.h:49
void Reset()
Reset the internal datastructure for packet distribution.
A doubly linked list.
Definition: TList.h:44
TList * fUnAllocated
Definition: TPacketizer.h:50
void RemoveUnAllocNode(TFileNode *)
Remove unallocated node.
void RemoveActive(TFileStat *file)
Remove file from the list of actives.
ROOT::R::TRInterface & r
Definition: Object.C:4
Int_t fMaxPerfIdx
Definition: TPacketizer.h:56
TFileNode * NextUnAllocNode()
Get next unallocated node.
TFileStat * GetNextUnAlloc(TFileNode *node=0)
Get next unallocated file.
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
Long_t fMaxSlaveCnt
Definition: TPacketizer.h:58
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
The packetizer is a load balancing object created for each query.
Int_t AddWorkers(TList *workers)
Adds new workers. Returns the number of workers added, or -1 on failure.
Bool_t fHeuristicPSiz
Definition: TPacketizer.h:68
Long64_t GetEntriesProcessed() const
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
void ValidateFiles(TDSet *dset, TList *slaves, Long64_t maxent=-1, Bool_t byfile=kFALSE)
Check existence of file/dir/tree an get number of entries.
Definition: file.py:1
TList * fActive
Definition: TPacketizer.h:51
A TTree object has a header with a name and a title.
Definition: TTree.h:70
Definition: first.py:1
Class describing a PROOF worker server.
Definition: TSlave.h:46
TFileStat * GetNextActive()
Get next active file.
Container class for processing statistics.
Bool_t fDefMaxWrkNode
Definition: TPacketizer.h:69
TFileNode * NextActiveNode()
Get next active node.