Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Utilities/DataSampling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ std::vector<DataProcessorSpec> defineDataProcessing(ConfigContext &ctx)
```

Sampled data can be subscribed to by adding `InputSpecs` provided by `std::vector<InputSpec> DataSampling::InputSpecsForPolicy(const std::string& policiesSource, const std::string& policyName)` to a chosen data processor. Then, they can be accessed by the bindings specified in the configuration file. Dispatcher adds a `DataSamplingHeader` to the header stack, which contains statistics like total number of evaluated/accepted messages for a given Policy or the sampling time since epoch.
If no sampling policies are specified, Dispatcher will not be spawned.

The [o2-datasampling-pod-and-root](https://github.com/AliceO2Group/AliceO2/blob/dev/Utilities/DataSampling/test/dataSamplingPodAndRoot.cxx) workflow can serve as a usage example.

Expand Down
2 changes: 2 additions & 0 deletions Utilities/DataSampling/include/DataSampling/Dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class Dispatcher : public framework::Task

/// \brief Register a Data Sampling Policy
void registerPolicy(std::unique_ptr<DataSamplingPolicy>&&);
/// \brief Returns the number of registered policies.
size_t numberOfPolicies();

const std::string& getName();
/// \brief Assembles InputSpecs of all registered policies in a single vector, removing overlapping entries.
Expand Down
2 changes: 1 addition & 1 deletion Utilities/DataSampling/src/DataSampling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void DataSampling::DoGenerateInfrastructure(Dispatcher& dispatcher, WorkflowSpec
}
}

if (dispatcher.getInputSpecs().size() > 0) {
if (dispatcher.numberOfPolicies() > 0) {
DataProcessorSpec spec;
spec.name = dispatcher.getName();
spec.inputs = dispatcher.getInputSpecs();
Expand Down
4 changes: 4 additions & 0 deletions Utilities/DataSampling/src/Dispatcher.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,9 @@ framework::Options Dispatcher::getOptions()

return options;
}
size_t Dispatcher::numberOfPolicies()
{
return mPolicies.size();
}

} // namespace o2::utilities