Project
Loading...
Searching...
No Matches
reader-driver-workflow.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
19
20using namespace o2::framework;
21
22// ------------------------------------------------------------------
23void customize(std::vector<o2::framework::CallbacksPolicy>& policies)
24{
26}
27
28// we need to add workflow options before including Framework/runDataProcessing
29void customize(std::vector<ConfigParamSpec>& workflowOptions)
30{
31 // option allowing to set parameters
32 std::vector<o2::framework::ConfigParamSpec> options{
33 {"timeframes-shm-limit", VariantType::String, "0", {"Minimum amount of SHM required in order to publish data"}},
34 {"metric-feedback-channel-format", VariantType::String, "name=metric-feedback,type=pull,method=connect,address=ipc://{}metric-feedback-{},transport=shmem,rateLogging=0", {"format for the metric-feedback channel for TF rate limiting"}},
35 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
36 o2::raw::HBFUtilsInitializer::addConfigOption(options, "o2_tfidinfo.root,upstream");
37 std::swap(workflowOptions, options);
38}
39
40// ------------------------------------------------------------------
41
43
45{
46 // Update the (declared) parameters if changed from the command line
47 o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
48
49 int rateLimitingIPCID = std::stoi(configcontext.options().get<std::string>("timeframes-rate-limit-ipcid"));
50 std::string chanFmt = configcontext.options().get<std::string>("metric-feedback-channel-format");
51 std::string metricChannel{};
52 if (rateLimitingIPCID > -1 && !chanFmt.empty()) {
53 metricChannel = fmt::format(fmt::runtime(chanFmt), o2::framework::ChannelSpecHelpers::defaultIPCFolder(), rateLimitingIPCID);
54 }
55 size_t minSHM = std::stoul(configcontext.options().get<std::string>("timeframes-shm-limit"));
56
57 WorkflowSpec specs;
58 specs.emplace_back(o2::globaltracking::getReaderDriverSpec(metricChannel, minSHM));
59
60 // configure dpl timer to inject correct firstTForbit: start from the 1st orbit of TF containing 1st sampled orbit
61 o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
62
63 return std::move(specs);
64}
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
framework::DataProcessorSpec getReaderDriverSpec(const std::string &metricChannel="", size_t minSHM=0)
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
void customize(std::vector< o2::framework::CallbacksPolicy > &policies)
static void addNewTimeSliceCallback(std::vector< o2::framework::CallbacksPolicy > &policies)
static void addConfigOption(std::vector< o2::framework::ConfigParamSpec > &opts, const std::string &defOpt=std::string(o2::base::NameConf::DIGITIZATIONCONFIGFILE))