Project
Loading...
Searching...
No Matches
test_DanglingInputs.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.
15
16#include <thread>
17#include <vector>
18
19using namespace o2::framework;
20
21AlgorithmSpec simplePipe(std::string const& what, int minDelay)
22{
23 return AlgorithmSpec{[what, minDelay](InitContext& ic) {
24 srand(getpid());
25 return [what, minDelay](ProcessingContext& ctx) {
26 auto& bData = ctx.outputs().make<int>(OutputRef{what}, 1);
27 };
28 }};
29}
30
31// This is how you can define your processing in a declarative way
33{
34 return WorkflowSpec{
35 {"A",
36 Inputs{},
37 {OutputSpec{{"a1"}, "TST", "A1"},
38 OutputSpec{{"a2"}, "TST", "A2"}},
40 [](ProcessingContext& ctx) {
41 std::this_thread::sleep_for(std::chrono::milliseconds((rand() % 2 + 1) * 1000));
42 auto& aData = ctx.outputs().make<int>(OutputRef{"a1"}, 1);
43 auto& bData = ctx.outputs().make<int>(OutputRef{"a2"}, 1);
44 }}},
45 {"B",
46 {InputSpec{"x", "TST", "A1"}},
47 {OutputSpec{{"b1"}, "TST", "B1"}},
48 simplePipe("b1", 0)},
49 {"C",
50 Inputs{InputSpec{"x", "TST", "A2"}},
51 Outputs{OutputSpec{{"c1"}, "TST", "C1"}},
52 simplePipe("c1", 5)},
53 {"D",
54 Inputs{
55 InputSpec{"b", "TST", "B1"},
56 InputSpec{"c", "TST", "C1"},
57 InputSpec{"timer", "TST", "TIMER", 0, Lifetime::Timer}},
58 Outputs{},
60 [](ProcessingContext& ctx) {
61 ctx.services().get<ControlService>().readyToQuit(QuitRequest::All);
62 },
63 }}};
64}
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
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)