QualityControl  1.5.1
O2 Data Quality Control Framework
PostProcessingRunner.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 QUALITYCONTROL_POSTPROCESSINGRUNNER_H
17 #define QUALITYCONTROL_POSTPROCESSINGRUNNER_H
18 
19 #include <memory>
20 #include <functional>
21 #include <Framework/ServiceRegistry.h>
22 #include <boost/property_tree/ptree_fwd.hpp>
29 
30 namespace o2::framework
31 {
32 class DataAllocator;
33 } // namespace o2::framework
34 
36 {
37 
38 using MOCPublicationCallback = std::function<void(const o2::quality_control::core::MonitorObjectCollection*, long from, long to)>;
39 
47 {
48  public:
49  PostProcessingRunner(std::string name);
50  ~PostProcessingRunner() = default;
51 
53  void init(const boost::property_tree::ptree& config);
55  bool run();
57  void start();
59  void stop();
61  void reset();
66  void runOverTimestamps(const std::vector<uint64_t>& t);
67 
71  void setPublicationCallback(MOCPublicationCallback callback);
72 
73  const std::string& getName();
74 
75  private:
76  void doInitialize(Trigger trigger);
77  void doUpdate(Trigger trigger);
78  void doFinalize(Trigger trigger);
79 
80  enum class TaskState {
81  INVALID,
82  Created,
83  Running,
84  Finished
85  };
86  TaskState mTaskState = TaskState::INVALID;
87  std::vector<TriggerFcn> mInitTriggers;
88  std::vector<TriggerFcn> mUpdateTriggers;
89  std::vector<TriggerFcn> mStopTriggers;
90 
91  std::unique_ptr<PostProcessingInterface> mTask;
92  framework::ServiceRegistry mServices;
93  std::shared_ptr<o2::quality_control::core::ObjectsManager> mObjectManager;
94  // TODO in a longer run, we should store from/to in the MonitorObject itself and use them.
95  std::function<void(const o2::quality_control::core::MonitorObjectCollection*, long /*from*/, long /*to*/)> mPublicationCallback = nullptr;
96 
97  std::string mName = "";
98  std::string mConfigPath = "";
99  PostProcessingConfig mConfig;
100  std::shared_ptr<o2::quality_control::repository::DatabaseInterface> mDatabase;
101 };
102 
103 MOCPublicationCallback publishToDPL(o2::framework::DataAllocator&, std::string outputBinding);
104 MOCPublicationCallback publishToRepository(o2::quality_control::repository::DatabaseInterface&);
105 
106 } // namespace o2::quality_control::postprocessing
107 
108 #endif //QUALITYCONTROL_POSTPROCESSINGRUNNER_H
Post-processing configuration structure.
Definition: PostProcessingConfig.h:29
Definition: MonitorObjectCollection.h:25
Definition: AggregatorRunner.h:27
The interface to the MonitorObject&#39;s repository.
Definition: DatabaseInterface.h:35
A class driving the execution of a post-processing task.
Definition: PostProcessingRunner.h:46
Definition: PostProcessingConfig.h:23