Project
Loading...
Searching...
No Matches
data-generator-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
13#include "DataGeneratorSpec.h"
14
15using namespace o2::framework;
16
17// we need to add workflow options before including Framework/runDataProcessing
18void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
19{
20 // option allowing to set parameters
21 workflowOptions.push_back(ConfigParamSpec{"lanes", o2::framework::VariantType::Int, 2, {"number of data generator lanes"}});
22 workflowOptions.push_back(ConfigParamSpec{"gen-norm", o2::framework::VariantType::Int, 1, {"nominal number of expected generators"}});
23 workflowOptions.push_back(ConfigParamSpec{"gen-slot", o2::framework::VariantType::Int, 0, {"generate TFs of slot in [0 : gen-norm) range"}});
24 workflowOptions.push_back(ConfigParamSpec{"pressure", o2::framework::VariantType::Float, 1.f, {"generation / processing rate factor"}});
25 workflowOptions.push_back(ConfigParamSpec{"mean-latency", o2::framework::VariantType::Int, 1000, {"mean latency of the processor in microseconds"}});
26 workflowOptions.push_back(ConfigParamSpec{"latency-spread", o2::framework::VariantType::Int, 100, {"latency gaussian RMS of the processor in microseconds"}});
27}
28
29// ------------------------------------------------------------------
30
32
34{
35 WorkflowSpec specs;
36 auto nlanes = std::max(1, configcontext.options().get<int>("lanes"));
37 auto ngen = std::max(1, configcontext.options().get<int>("gen-norm"));
38 auto slot = std::max(0, configcontext.options().get<int>("gen-slot"));
39 auto latency = std::max(1, configcontext.options().get<int>("mean-latency"));
40 auto latencyRMS = std::max(1, configcontext.options().get<int>("latency-spread"));
41 auto pressure = std::max(0.001f, configcontext.options().get<float>("pressure"));
42 if (slot >= ngen) {
43 slot = 0;
44 ngen = 1;
45 }
46 specs.emplace_back(getTFDispatcherSpec(slot, ngen, nlanes, std::max(1, int(float(latency) / nlanes / pressure))));
47 specs.emplace_back(timePipeline(getTFProcessorSpec(latency, latencyRMS), nlanes));
48 return specs;
49}
Dummy data generator.
void customize(std::vector< o2::framework::ConfigParamSpec > &workflowOptions)
WorkflowSpec defineDataProcessing(ConfigContext const &configcontext)
This function hooks up the the workflow specifications into the DPL driver.
ConfigParamRegistry & options() const
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
DataProcessorSpec timePipeline(DataProcessorSpec original, size_t count)