Project
Loading...
Searching...
No Matches
o2OutputWildcardWorkflow.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.
14#include "Headers/DataHeader.h"
16#include "Framework/Logger.h"
17
18#include <chrono>
19#include <thread>
20#include <vector>
21
23
24using namespace o2::framework;
25
26// This allows defining a workflow where the subSpecification
27// for the inputs and the outputs are left unspecified.
28// The source will produce one message at the time with random
29// subspecification and the receiver will match the any message
30// with origin "TST" and description "A1" regardless of the subspec.
32{
33 return WorkflowSpec{
34 {"A",
35 Inputs{},
36 {OutputSpec{{"a1"}, {"TST", "A1"}}},
38 [](DataAllocator& outputs) {
39 auto rn = rand() % 5;
40 std::this_thread::sleep_for(std::chrono::seconds(rn));
41 auto& aData = outputs.make<int>(OutputRef{"a1", static_cast<DataAllocator::SubSpecificationType>(rn)});
42 LOGP(info, "A random subspec:{}", rn);
43 })}},
44 {"B",
45 {InputSpec{"x", {"TST", "A1"}}},
46 {},
48 [](InputRecord& inputs) {
49 DataRef ref = inputs.getByPos(0);
50 auto const* header = DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
51 LOGP(info, "A random subspec:{}", header->subSpecification);
52 })}},
53 };
54}
o2::header::DataHeader::SubSpecificationType SubSpecificationType
decltype(auto) make(const Output &spec, Args... args)
The input API of the Data Processing Layer This class holds the inputs which are valid for processing...
static DataRef getByPos(std::vector< InputRoute > const &routes, InputSpan const &span, int pos, int part=0)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
AlgorithmSpec::ProcessCallback adaptStateless(LAMBDA l)
std::vector< InputSpec > Inputs
WorkflowSpec defineDataProcessing(ConfigContext const &specs)
This function hooks up the the workflow specifications into the DPL driver.