Skip to content

Commit f13634e

Browse files
committed
DPL: add o2-dpl-null-sink workflow
This workflow can be configured to terminate any other workflow by providing the appropriate --inputs option.
1 parent 1533f53 commit f13634e

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

Framework/Core/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ foreach(t
198198
PUBLIC_LINK_LIBRARIES O2::Framework)
199199
endforeach()
200200

201+
o2_add_executable(dpl-null-sink
202+
SOURCES src/o2NullSink.cxx
203+
PUBLIC_LINK_LIBRARIES O2::Framework
204+
)
205+
201206
o2_add_executable(dpl-run
202207
SOURCES src/dplRun.cxx
203208
PUBLIC_LINK_LIBRARIES O2::Framework

Framework/Core/src/o2NullSink.cxx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
#include "Framework/ConfigContext.h"
11+
#include "Framework/ControlService.h"
12+
#include "Framework/DataProcessorSpec.h"
13+
#include "Framework/DataSpecUtils.h"
14+
#include "Framework/Logger.h"
15+
#include "Framework/ParallelContext.h"
16+
#include "Framework/DataDescriptorQueryBuilder.h"
17+
18+
#include <chrono>
19+
#include <thread>
20+
#include <vector>
21+
22+
/// A DataProcessor which terminates a provided set of
23+
/// inputs.
24+
using namespace o2::framework;
25+
26+
void customize(std::vector<ConfigParamSpec>& options)
27+
{
28+
options.push_back(o2::framework::ConfigParamSpec{"inputs", VariantType::String, "", {"inputs for the dataprocessor"}});
29+
};
30+
31+
#include "Framework/runDataProcessing.h"
32+
33+
// This is a simple consumer / producer workflow where both are
34+
// stateful, i.e. they have context which comes from their initialization.
35+
WorkflowSpec defineDataProcessing(ConfigContext const& context)
36+
{
37+
WorkflowSpec workflow;
38+
// This is an example of how we can parallelize by subSpec.
39+
// templatedProducer will be instanciated 32 times and the lambda function
40+
// passed to the parallel statement will be applied to each one of the
41+
// instances in order to modify it. Parallel will also make sure the name of
42+
// the instance is amended from "some-producer" to "some-producer-<index>".
43+
auto inputsDesc = context.options().get<std::string>("inputs");
44+
auto inputs = DataDescriptorQueryBuilder::parse(inputsDesc.c_str());
45+
46+
workflow.push_back(DataProcessorSpec{
47+
"null",
48+
inputs,
49+
{},
50+
AlgorithmSpec{[](ProcessingContext& ctx) {}}});
51+
52+
return workflow;
53+
}

0 commit comments

Comments
 (0)