Project
Loading...
Searching...
No Matches
DefaultsHelpers.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
15#include <fairmq/ProgOptions.h>
16
17#include <cstdlib>
18#include <cstring>
19#include <stdexcept>
20
21namespace o2::framework
22{
23
24unsigned int DefaultsHelpers::pipelineLength(unsigned int minLength)
25{
26 static bool override = getenv("DPL_DEFAULT_PIPELINE_LENGTH");
27 if (override) {
28 static unsigned int retval = atoi(getenv("DPL_DEFAULT_PIPELINE_LENGTH"));
29 return std::max(minLength, retval);
30 }
32 // just some reasonable numers
33 // The number should really be tuned at runtime for each processor.
35 return std::max(minLength, 512u);
36 } else {
37 return std::max(minLength, 64u);
38 }
39}
40
42{
43 static unsigned int minLength = dc.options.count("timeframes-rate-limit") ? std::max(0, atoi(dc.options["timeframes-rate-limit"].as<std::string>().c_str())) : 0;
44 return pipelineLength(minLength);
45}
46
47unsigned int DefaultsHelpers::pipelineLength(const fair::mq::ProgOptions& options)
48{
49 static unsigned int minLength = options.Count("timeframes-rate-limit") ? std::max(0, atoi(options.GetValue<std::string>("timeframes-rate-limit").c_str())) : 0;
50 return pipelineLength(minLength);
51}
52
53static DeploymentMode getDeploymentMode_internal()
54{
55 char* explicitMode = getenv("O2_DPL_DEPLOYMENT_MODE");
56 if (explicitMode != nullptr) {
57 if (strcmp(explicitMode, "OnlineDDS") == 0) {
59 } else if (strcmp(explicitMode, "OnlineECS") == 0) {
61 } else if (strcmp(explicitMode, "OnlineAUX") == 0) {
63 } else if (strcmp(explicitMode, "Local") == 0) {
65 } else if (strcmp(explicitMode, "Grid") == 0) {
67 } else if (strcmp(explicitMode, "FST") == 0) {
69 } else {
70 throw std::runtime_error("Invalid deployment mode");
71 }
72 }
73 return getenv("DDS_SESSION_ID") != nullptr ? DeploymentMode::OnlineDDS : (getenv("OCC_CONTROL_PORT") != nullptr ? DeploymentMode::OnlineECS : (getenv("ALIEN_PROC_ID") != nullptr ? DeploymentMode::Grid : (getenv("ALICE_O2_FST") ? DeploymentMode::FST : (DeploymentMode::Local))));
74}
75
77{
78 static DeploymentMode retVal = getDeploymentMode_internal();
79 return retVal;
80}
81
83{
88 return true;
89 default:
90 return false;
91 }
92}
93
94} // namespace o2::framework
int32_t retVal
Defining PrimaryVertex explicitly as messageable.
static DeploymentMode deploymentMode()
static unsigned int pipelineLength(unsigned int minLength)
get max number of timeslices in the queue
static bool onlineDeploymentMode()
@true if running online
boost::program_options::variables_map options