Project
Loading...
Searching...
No Matches
test_TopologyPolicies.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 "Mocking.h"
13#include <catch_amalgamated.hpp>
15#include "../src/DeviceSpecHelpers.h"
16#include "../src/GraphvizHelpers.h"
17#include "../src/WorkflowHelpers.h"
21#include "../src/SimpleResourceManager.h"
22#include "../src/ComputingResourceHelpers.h"
23#include "test_HelperMacros.h"
25
26using namespace o2::framework;
27
28// This is how you can define your processing in a declarative way
30{
31 return {
32 {.name = "input-proxy", .outputs = {OutputSpec{"QEMC", "CELL", 1}, OutputSpec{"CTF", "DONE", 0}}},
33 {.name = "EMC-Cell-proxy", .inputs = Inputs{InputSpec{"a", "QEMC", "CELL", 1, Lifetime::Sporadic}}},
34 {.name = "calib-output-proxy-barrel-tf", .inputs = {InputSpec{"a", "CTF", "DONE", 0}}}};
35}
36
37TEST_CASE("TestBrokenSporadic")
38{
39 auto workflow = defineDataProcessingWithSporadic();
40 auto configContext = makeEmptyConfigContext();
41 auto channelPolicies = ChannelConfigurationPolicy::createDefaultPolicies(*configContext);
42 auto completionPolicies = CompletionPolicy::createDefaultPolicies();
43 auto callbacksPolicies = CallbacksPolicy::createDefaultPolicies();
44 REQUIRE(channelPolicies.empty() == false);
45 REQUIRE(completionPolicies.empty() == false);
46 std::vector<DeviceSpec> devices;
47
48 std::vector<ComputingResource> resources{ComputingResourceHelpers::getLocalhostResource()};
49 REQUIRE(resources.size() == 1);
50 REQUIRE(resources[0].startPort == 22000);
51 SimpleResourceManager rm(resources);
52 auto offers = rm.getAvailableOffers();
53 REQUIRE(offers.size() == 1);
54 REQUIRE(offers[0].startPort == 22000);
55 REQUIRE(offers[0].rangeSize == 5000);
56
57 DeviceSpecHelpers::dataProcessorSpecs2DeviceSpecs(workflow, channelPolicies, completionPolicies, callbacksPolicies, devices, rm, "workflow-id", *configContext);
59}
std::unique_ptr< ConfigContext > makeEmptyConfigContext()
std::vector< ComputingOffer > getAvailableOffers() override
Get the available resources for a device to run on.
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
TEST_CASE("test_prepareArguments")
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< InputSpec > Inputs
static std::vector< CallbacksPolicy > createDefaultPolicies()
static std::vector< ChannelConfigurationPolicy > createDefaultPolicies(ConfigContext const &configContext)
Default policies to use, based on the contents of the @configContex content.
static std::vector< CompletionPolicy > createDefaultPolicies()
Helper to create the default configuration.
static void dataProcessorSpecs2DeviceSpecs(const WorkflowSpec &workflow, std::vector< ChannelConfigurationPolicy > const &channelPolicies, std::vector< CompletionPolicy > const &completionPolicies, std::vector< DispatchPolicy > const &dispatchPolicies, std::vector< ResourcePolicy > const &resourcePolicies, std::vector< CallbacksPolicy > const &callbacksPolicies, std::vector< SendingPolicy > const &sendingPolicy, std::vector< ForwardingPolicy > const &forwardingPolicies, std::vector< DeviceSpec > &devices, ResourceManager &resourceManager, std::string const &uniqueWorkflowId, ConfigContext const &configContext, bool optimizeTopology=false, unsigned short resourcesMonitoringInterval=0, std::string const &channelPrefix="", OverrideServiceSpecs const &overrideServices={})
static auto buildEdges(WorkflowSpec &physicalWorkflow) -> std::vector< std::pair< int, int > >
WorkflowSpec defineDataProcessingWithSporadic()