-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathMergerConfig.h
More file actions
106 lines (89 loc) · 4.35 KB
/
MergerConfig.h
File metadata and controls
106 lines (89 loc) · 4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICEO2_MERGERCONFIG_H
#define ALICEO2_MERGERCONFIG_H
/// \file MergerConfig.h
/// \brief Definition of O2 MergerConfig, v0.1
///
/// \author Piotr Konopka, piotr.jan.konopka@cern.ch
#include <string>
#include <vector>
#include <variant>
#include "Framework/DataProcessorLabel.h"
namespace o2::mergers
{
// This is a set of Mergers' options that user can choose from.
enum class InputObjectsTimespan {
FullHistory, // Mergers expect objects with all data accumulated so far each time.
LastDifference // Mergers expect objects' differences (what has changed since the previous were sent).
};
enum class MergedObjectTimespan {
// Merged object should be an sum of differences received since the beginning
// or a sum of latest versions of objects received on each input.
FullHistory,
// Merged object should be an sum of differences received after last publication.
// Merged object is reset after published. It won't produce meaningful results
// when InputObjectsTimespan::FullHistory is set.
LastDifference,
// Generalisation of the two above. Resets all objects in Mergers after n cycles (0 - infinite).
// The above will be removed once we switch to NCycles in QC.
NCycles
};
enum class PublishMovingWindow {
// Publishes an object containing data points from the last cycle if it has one.
Yes,
No
};
enum class PublicationDecision {
EachNSeconds, // Merged object is published each N seconds. This can evolve over time, thus we expect pairs specifying N:duration1, M:duration2...
EachNArrivals, // Merged object is published whenever we receive N new input objects.
};
enum class TopologySize {
NumberOfLayers, // User specifies the number of layers in topology.
ReductionFactor, // User specifies how many sources should be handled by one merger (by maximum).
MergersPerLayer // User specifies how many Mergers should be spawned in each layer.
};
enum class ParallelismType {
SplitInputs, // Splits the provided vector of InputSpecs evenly among Mergers.
RoundRobin // Mergers receive their input messages in round robin order. Useful when there is one InputSpec with a wildcard.
};
// fixme: this way of configuring mergers should be refactored, it does not make sense that we share `param`s across for different enum values.
template <typename V, typename P = double>
struct ConfigEntry {
V value;
P param = P();
};
/**
* This class just serves the purpose of allowing for both the old and the new way of specifying the
* cycles duration.
*/
class PublicationDecisionParameter
{
public:
PublicationDecisionParameter(size_t param) : decision({{param, 1}}) {}
PublicationDecisionParameter(const std::vector<std::pair<size_t, size_t>>& decision) : decision(decision) {}
std::vector<std::pair<size_t /* cycle duration seconds */, size_t /* validity seconds */>> decision;
};
// todo rework configuration in a way that user cannot create an invalid configuration
// \brief MergerAlgorithm configuration structure. Default configuration should work in most cases, out of the box.
struct MergerConfig {
ConfigEntry<InputObjectsTimespan> inputObjectTimespan = {InputObjectsTimespan::FullHistory};
ConfigEntry<MergedObjectTimespan, int> mergedObjectTimespan = {MergedObjectTimespan::FullHistory};
ConfigEntry<PublicationDecision, PublicationDecisionParameter> publicationDecision = {PublicationDecision::EachNSeconds, {10}};
ConfigEntry<TopologySize, std::variant<int, std::vector<size_t>>> topologySize = {TopologySize::NumberOfLayers, 1};
ConfigEntry<PublishMovingWindow> publishMovingWindow = {PublishMovingWindow::No};
std::string monitoringUrl = "infologger:///debug?qc";
std::string detectorName = "TST";
ConfigEntry<ParallelismType> parallelismType = {ParallelismType::SplitInputs};
std::vector<o2::framework::DataProcessorLabel> labels;
};
} // namespace o2::mergers
#endif //ALICEO2_MERGERCONFIG_H