Project
Loading...
Searching...
No Matches
test_Forwarding.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.
18
19#include <chrono>
20#include <vector>
21
22using namespace o2::framework;
23
24AlgorithmSpec simplePipe(std::string const& what, int minDelay)
25{
26 return AlgorithmSpec{[what, minDelay](InitContext& ic) {
27 srand(getpid());
28 return [what, minDelay](ProcessingContext& ctx) {
29 auto& bData = ctx.outputs().make<int>(OutputRef{what}, 1);
30 };
31 }};
32}
33
34// This is how you can define your processing in a declarative way
36{
37 return WorkflowSpec{
38 {"A",
39 Inputs{},
40 {OutputSpec{{"a1"}, "TST", "A1"}},
42 [](ProcessingContext& ctx) {
43 auto& aData = ctx.outputs().make<int>(OutputRef{"a1"}, 1);
44 ctx.services().get<ControlService>().endOfStream();
45 ctx.services().get<ControlService>().readyToQuit(QuitRequest::Me);
46 }}},
47 {"B",
48 {InputSpec{"x", "TST", "A1"}},
49 {OutputSpec{{"b1"}, "TST", "B1"}},
50 simplePipe("b1", 0)},
51 {"C",
52 Inputs{InputSpec{"x", "TST", "A1"}},
53 Outputs{OutputSpec{{"c1"}, "TST", "C1"}},
54 simplePipe("c1", 5)},
55 {"D",
56 Inputs{
57 InputSpec{"b", "TST", "B1"},
58 InputSpec{"c", "TST", "C1"}},
59 Outputs{},
61 adaptStateless([](CallbackService& callbacks) {
62 callbacks.set<CallbackService::Id::EndOfStream>([](EndOfStreamContext& context) {
63 context.services().get<ControlService>().readyToQuit(QuitRequest::All);
64 });
65 }),
66 }}};
67}
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
AlgorithmSpec::ProcessCallback adaptStateless(LAMBDA l)
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
WorkflowSpec defineDataProcessing(ConfigContext const &specs)
This function hooks up the the workflow specifications into the DPL driver.
AlgorithmSpec simplePipe(std::string const &what, int minDelay)