Project
Loading...
Searching...
No Matches
test_CompletionPolicies.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.
11
12
#include "
Framework/CompletionPolicy.h
"
13
#include "
Framework/CompletionPolicyHelpers.h
"
14
#include "
Framework/DeviceSpec.h
"
15
16
#include <cassert>
17
#include <chrono>
18
#include <thread>
19
#include <vector>
20
21
using namespace
o2::framework
;
22
23
void
customize
(std::vector<CompletionPolicy>& policies)
24
{
25
std::vector<CompletionPolicy>
result
{
26
CompletionPolicyHelpers::defineByName
(
"discard"
, CompletionPolicy::CompletionOp::Discard),
27
CompletionPolicyHelpers::defineByName
(
"process"
, CompletionPolicy::CompletionOp::Process),
28
CompletionPolicyHelpers::defineByName
(
"wait"
, CompletionPolicy::CompletionOp::Wait),
29
CompletionPolicyHelpers::defineByName
(
"consume"
, CompletionPolicy::CompletionOp::Consume)};
30
policies.swap(
result
);
31
}
32
33
#include "
Framework/runDataProcessing.h
"
34
#include "
Framework/DataProcessorSpec.h
"
35
#include "
Framework/Logger.h
"
36
#include "
Framework/ParallelContext.h
"
37
#include "
Framework/ControlService.h
"
38
#include <vector>
39
40
// This is a simple consumer / producer workflow where both are
41
// stateful, i.e. they have context which comes from their initialization.
42
WorkflowSpec
defineDataProcessing
(
ConfigContext
const
& config)
43
{
44
return
WorkflowSpec
{
45
DataProcessorSpec
{
46
"hearthbeat"
,
47
{},
48
{
OutputSpec
{{
"out1"
},
"TST"
,
"TST"
, 0},
49
OutputSpec
{{
"out2"
},
"TST"
,
"TST"
, 1}},
50
AlgorithmSpec
{
51
[](
ProcessingContext
& ctx) {
52
// We deliberately make only out1 to test that
53
// the policies for the following dataprocessors are
54
// actually respected.
55
ctx.outputs().make<
int
>(
OutputRef
{
"out1"
}, 1);
56
std::this_thread::sleep_for(std::chrono::seconds(1));
57
}}},
58
DataProcessorSpec
{
59
"discard"
,
60
{
61
InputSpec
{
"in1"
,
"TST"
,
"TST"
, 0},
62
InputSpec
{
"in2"
,
"TST"
,
"TST"
, 1},
63
},
64
{},
65
AlgorithmSpec
{
66
[](
ProcessingContext
& ctx) {
67
LOG
(error) <<
"Should have not been invoked"
;
68
// We deliberately make only out1 to test that
69
// the policies for the following dataprocessors are
70
// actually respected.
71
}}},
72
DataProcessorSpec
{
73
"does-use"
,
74
{
InputSpec
{
"in1"
,
"TST"
,
"TST"
, 0}},
75
{},
76
AlgorithmSpec
{
77
[](
ProcessingContext
& ctx) {
78
// Since this shares a dependency with "discard",
79
// it should be forwarded the messages as soon as the former
80
// discards them.
81
}}},
82
};
83
}
CompletionPolicyHelpers.h
CompletionPolicy.h
ControlService.h
DataProcessorSpec.h
DeviceSpec.h
Logger.h
ParallelContext.h
o2::framework::ConfigContext
Definition
ConfigContext.h:24
o2::framework::ProcessingContext
Definition
ProcessingContext.h:27
result
GLuint64EXT * result
Definition
glcorearb.h:5662
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::framework::WorkflowSpec
std::vector< DataProcessorSpec > WorkflowSpec
Definition
HBFUtilsInitializer.h:39
runDataProcessing.h
o2::framework::AlgorithmSpec
Definition
AlgorithmSpec.h:43
o2::framework::CompletionPolicyHelpers::defineByName
static CompletionPolicy defineByName(std::string const &name, CompletionPolicy::CompletionOp op)
Definition
CompletionPolicyHelpers.cxx:76
o2::framework::DataProcessorSpec
Definition
DataProcessorSpec.h:41
o2::framework::InputSpec
Definition
InputSpec.h:31
o2::framework::OutputRef
Definition
OutputRef.h:29
o2::framework::OutputSpec
Definition
OutputSpec.h:33
customize
void customize(std::vector< CompletionPolicy > &policies)
Definition
test_CompletionPolicies.cxx:23
defineDataProcessing
WorkflowSpec defineDataProcessing(ConfigContext const &config)
This function hooks up the the workflow specifications into the DPL driver.
Definition
test_CompletionPolicies.cxx:42
LOG
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
Framework
TestWorkflows
src
test_CompletionPolicies.cxx
Generated on Tue Feb 25 2025 23:16:41 for Project by
1.9.8