|
12 | 12 | #define FRAMEWORK_DATASAMPLING_H |
13 | 13 |
|
14 | 14 | /// \file DataSampling.h |
15 | | -/// \brief Definition of O2 Data Sampling, v0.1 |
| 15 | +/// \brief Definition of O2 Data Sampling, v1.0 |
16 | 16 | /// |
17 | 17 | /// \author Piotr Konopka, piotr.jan.konopka@cern.ch |
18 | 18 |
|
19 | | -#include <functional> |
20 | | -#include <random> |
21 | 19 | #include <string> |
22 | | -#include <vector> |
23 | 20 |
|
24 | | -#include "Framework/AlgorithmSpec.h" |
25 | | -#include "Framework/DataChunk.h" |
26 | | -#include "Framework/DataProcessorSpec.h" |
27 | 21 | #include "Framework/WorkflowSpec.h" |
28 | | - |
29 | | -#include "Framework/Dispatcher.h" |
30 | | -#include "Framework/DispatcherDPL.h" |
31 | | -#include "Framework/DispatcherFairMQ.h" |
32 | | -#include "Framework/DispatcherFlpProto.h" |
33 | | -#include "Framework/DataSamplingConfig.h" |
| 22 | +#include "Framework/CompletionPolicy.h" |
| 23 | +#include "Framework/DataSamplingPolicy.h" |
| 24 | +#include "Framework/ChannelConfigurationPolicy.h" |
34 | 25 |
|
35 | 26 | namespace o2 |
36 | 27 | { |
37 | 28 | namespace framework |
38 | 29 | { |
39 | 30 |
|
40 | | -using namespace o2::framework::DataSamplingConfig; |
41 | | - |
42 | 31 | /// A class responsible for providing data from main processing flow to QC tasks. |
43 | 32 | /// |
44 | | -/// This class generates message-passing infrastructure to provide desired amount of data to Quality Control tasks. |
45 | | -/// QC tasks input data should be declared in config file (e.g. O2/Framework/Core/test/exampleDataSamplerConfig.ini ). |
46 | | -/// Data Sampling is based on Data Processing Layer, but supports also standard FairMQ devices by declaring external |
47 | | -/// inputs/outputs in configuration file. |
| 33 | +/// This class generates message-passing infrastructure to provide desired amount of data to Quality Control tasks or |
| 34 | +/// any other clients. Data to be sampled is declared in DataSamplingPolicy'ies configuration file - an example can be |
| 35 | +/// found in O2/Framework/TestWorkflows/exampleDataSamplingConfig.json). |
48 | 36 | /// |
49 | 37 | /// In-code usage: |
50 | 38 | /// \code{.cxx} |
51 | | -/// std::vector<DataProcessorSpec> defineDataProcessing(ConfigContext &ctx) |
| 39 | +/// void customize(std::vector<CompletionPolicy>& policies) |
| 40 | +/// { |
| 41 | +/// DataSampling::CustomizeInfrastructure(policies); |
| 42 | +/// } |
| 43 | +/// |
| 44 | +/// void customize(std::vector<ChannelConfigurationPolicy>& policies) |
52 | 45 | /// { |
| 46 | +/// DataSampling::CustomizeInfrastructure(policies); |
| 47 | +/// } |
| 48 | +/// |
| 49 | +/// #include "Framework/runDataProcessing.h" |
53 | 50 | /// |
| 51 | +/// std::vector<DataProcessorSpec> defineDataProcessing(ConfigContext &ctx) |
| 52 | +/// { |
| 53 | +/// WorkflowSpec workflow; |
54 | 54 | /// // <declaration of other DPL processors> |
55 | 55 | /// |
56 | | -/// const std::string configurationFilePath = <absolute file path>; |
57 | | -/// DataSampling::GenerateInfrastructure(workflow, configurationFilePath); |
| 56 | +/// const std::string configurationFilePath = <absolute file path>; |
| 57 | +/// DataSampling::GenerateInfrastructure(workflow, configurationFilePath); |
58 | 58 | /// |
| 59 | +/// return workflow; |
59 | 60 | /// } |
60 | 61 | /// \endcode |
61 | 62 |
|
| 63 | +//todo: update docu |
| 64 | +//todo: clean header mess |
| 65 | + |
62 | 66 | class DataSampling |
63 | 67 | { |
64 | 68 | public: |
65 | | - /// Deleted default constructor. This class is stateless. |
| 69 | + /// \brief Deleted default constructor. This class is stateless. |
66 | 70 | DataSampling() = delete; |
67 | | - /// Generates data sampling infrastructure. |
| 71 | + /// \brief Generates data sampling infrastructure. |
68 | 72 | /// \param workflow DPL workflow with already declared data processors which provide data desired by |
69 | 73 | /// QC tasks. |
70 | | - /// \param configurationSource Path to configuration file. |
71 | | - static void GenerateInfrastructure(WorkflowSpec& workflow, const std::string& configurationSource); |
| 74 | + /// \param policiesSource Path to configuration file. |
| 75 | + /// \param threads Number of dispatcher threads, that will handle the data |
| 76 | + static void GenerateInfrastructure(WorkflowSpec& workflow, const std::string& policiesSource, size_t threads = 1); |
| 77 | + /// \brief Configures dispatcher to consume any data immediately. |
| 78 | + static void CustomizeInfrastructure(std::vector<CompletionPolicy>&); |
| 79 | + /// \brief Applies blocking/nonblocking data sampling configuration to the workflow. |
| 80 | + static void CustomizeInfrastructure(std::vector<ChannelConfigurationPolicy>&); |
72 | 81 |
|
73 | 82 | private: |
74 | | - using SubSpecificationType = o2::header::DataHeader::SubSpecificationType; |
75 | | - |
76 | 83 | // Internal functions, used by GenerateInfrastructure() |
77 | | - static auto getEdgeMatcher(const QcTaskConfiguration& taskCfg); |
78 | | - static std::unique_ptr<Dispatcher> createDispatcher(SubSpecificationType subSpec, const QcTaskConfiguration& taskCfg, |
79 | | - InfrastructureConfig infCfg); |
80 | | - static QcTaskConfigurations readQcTasksConfiguration(const std::string& configurationSource); |
81 | | - static InfrastructureConfig readInfrastructureConfiguration(const std::string& configurationSource); |
| 84 | + static std::string dispatcherName(); |
82 | 85 | }; |
83 | 86 |
|
84 | 87 | } // namespace framework |
|
0 commit comments