Project
Loading...
Searching...
No Matches
o2DataQueryWorkflow.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.
16
17#include <chrono>
18#include <thread>
19#include <vector>
20#include <iostream>
21
22using namespace o2::framework;
23
24AlgorithmSpec simplePipe(std::string const& what, o2::header::DataHeader::SubSpecificationType subSpec, int minDelay)
25{
26 return AlgorithmSpec{[what, minDelay, subSpec](InitContext& ic) {
27 srand(getpid());
28 return [what, minDelay, subSpec](ProcessingContext& ctx) {
29 std::this_thread::sleep_for(std::chrono::seconds((rand() % 5) + minDelay));
30 auto& bData = ctx.outputs().make<int>(OutputRef{what, subSpec}, 1);
31 bData[0] = subSpec;
32 };
33 }};
34}
35
36// This demonstrates how to use the ``select'' helper to construct inputs for
37// you.
39{
40 return WorkflowSpec{
41 {"A",
42 select(),
43 {OutputSpec{{"a1"}, "TST", "A1"},
44 OutputSpec{{"a2"}, "TST", "A2"}},
46 [](ProcessingContext& ctx) {
47 std::this_thread::sleep_for(std::chrono::seconds(rand() % 2));
48 auto& aData = ctx.outputs().make<int>(OutputRef{"a1"}, 1);
49 auto& bData = ctx.outputs().make<int>(OutputRef{"a2"}, 1);
50 }}},
51 {"B",
52 select("x:TST/A1/0"), // This will match TST/A1/0 as <origin>/<description>/<subspec> and bind it to x
53 {OutputSpec{{"b1"}, "TST", "FORD", 0}},
54 simplePipe("b1", 0, 3)},
55 {"C",
56 select("x:TST/A2/0"),
57 Outputs{OutputSpec{{"c1"}, "TST", "FORD", 1}},
58 simplePipe("c1", 1, 2)},
59 {"D",
60 select("x:TST/FORD"),
61 Outputs{},
63 [](ProcessingContext& ctx) {
64 auto& x = ctx.inputs().get<int>("x");
65 std::cout << x << std::endl;
66 },
67 }}};
68}
GLint GLenum GLint x
Definition glcorearb.h:403
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< InputSpec > select(char const *matcher="")
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, o2::header::DataHeader::SubSpecificationType subSpec, int minDelay)
uint32_t SubSpecificationType
Definition DataHeader.h:620