QualityControl  1.5.1
O2 Data Quality Control Framework
AggregatorRunner.h
Go to the documentation of this file.
1 // Copyright CERN and copyright holders of ALICE O2. This software is
2 // distributed under the terms of the GNU General Public License v3 (GPL
3 // Version 3), copied verbatim in the file "COPYING".
4 //
5 // See http://alice-o2.web.cern.ch/license for full licensing information.
6 //
7 // In applying this license CERN does not waive the privileges and immunities
8 // granted to it by virtue of its status as an Intergovernmental Organization
9 // or submit itself to any jurisdiction.
10 
15 
16 #ifndef QC_CHECKER_AGGREGATORRUNNER_H
17 #define QC_CHECKER_AGGREGATORRUNNER_H
18 
19 // O2
20 #include <Framework/Task.h>
21 #include <Framework/DataProcessorSpec.h>
22 #include <Common/Timer.h>
23 // QC
24 #include "QualityControl/QualityObject.h"
26 
27 namespace o2::framework
28 {
29 struct InputSpec;
30 struct OutputSpec;
31 class DataAllocator;
32 } // namespace o2::framework
33 
34 namespace o2::monitoring
35 {
36 class Monitoring;
37 }
38 
39 namespace o2::configuration
40 {
41 class ConfigurationInterface;
42 }
43 
44 namespace AliceO2::Common
45 {
46 class Timer;
47 }
48 
49 namespace o2::quality_control
50 {
51 namespace core
52 {
53 class ServiceDiscovery;
54 }
55 namespace checker
56 {
57 class Aggregator;
58 }
59 namespace repository
60 {
61 class DatabaseInterface;
62 }
63 } // namespace o2::quality_control
64 
65 class TClass;
66 
68 {
69 
80 class AggregatorRunner : public framework::Task
81 {
82  public:
84 
91  AggregatorRunner(const std::string& configurationSource, const vector<framework::OutputSpec> checkRunnerOutputs);
92 
94  ~AggregatorRunner() override;
95 
97  void init(framework::InitContext& ctx) override;
98 
100  void run(framework::ProcessingContext& ctx) override;
101 
102  framework::Inputs getInputs() { return mInputs; };
103  std::string getDeviceName() { return mDeviceName; };
104 
105  static std::string createAggregatorRunnerIdString() { return "QC-AGGREGATOR-RUNNER"; };
106  static std::string createAggregatorRunnerName();
107  static header::DataDescription createAggregatorRunnerDataDescription(const std::string& aggregatorName);
108 
109  private:
117  core::QualityObjectsType aggregate();
118 
124  void store(core::QualityObjectsType& qualityObjects);
125 
126  inline void initDatabase();
127  inline void initMonitoring();
128  inline void initServiceDiscovery();
129  inline void initAggregators();
130 
134  void sendPeriodicMonitoring();
135 
136  // General state
137  std::string mDeviceName;
138  std::map<std::string, std::shared_ptr<Aggregator>> mAggregatorsMap;
139  std::shared_ptr<o2::quality_control::repository::DatabaseInterface> mDatabase;
140  std::shared_ptr<o2::configuration::ConfigurationInterface> mConfigFile;
141  core::QualityObjectsMapType mQualityObjects; // where we cache the incoming quality objects and the output of the aggregators
142  UpdatePolicyManager updatePolicyManager;
143 
144  // DPL
145  o2::framework::Inputs mInputs;
146 
147  // monitoring
148  std::shared_ptr<o2::monitoring::Monitoring> mCollector;
149  AliceO2::Common::Timer mTimer;
150  int mTotalNumberObjectsReceived;
151  int mTotalNumberAggregatorExecuted;
152  int mTotalNumberObjectsProduced;
153 
154  // Service discovery
155  std::shared_ptr<core::ServiceDiscovery> mServiceDiscovery;
156 };
157 
158 } // namespace o2::quality_control::checker
159 
160 #endif // QC_CHECKER_AGGREGATORRUNNER_H
Definition: AggregatorRunner.h:44
Definition: Aggregator.h:32
Definition: AggregatorRunner.h:34
Definition: AggregatorRunner.h:27
Definition: Aggregator.h:27
Definition: UpdatePolicyManager.h:86
The class in charge of running the aggregators on the QualityObjects.
Definition: AggregatorRunner.h:80