Project
Loading...
Searching...
No Matches
retrieveFromCCDB.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// executable to retrieve objects from CCDB emulating the rates that we expect for
13// Run 3, as read (in terms of size and rate) from an external file
14
15#include "retrieveFromCCDB.C"
16#include <TRandom.h>
17#include <boost/program_options.hpp>
18#include <iostream>
19
20namespace bpo = boost::program_options;
21
22bool initOptionsAndParse(bpo::options_description& options, int argc, char* argv[], bpo::variables_map& vm)
23{
24 options.add_options()(
25 "TFs-in-parallel,m", bpo::value<int>()->default_value(8), "Number of TFs to simulate that access the CCDB in parallel")(
26 "TF-processing-time,t", bpo::value<float>()->default_value(10.), "Seconds supposed to be needed to process a TF")(
27 "ccdb-sercer,s", bpo::value<std::string>()->default_value("http://ccdb-test.cern.ch:8080"), "CCDB server")(
28 "in-file-name,n", bpo::value<std::string>()->default_value("cdbSizeV0.txt"), "File name with list of CCDB entries to upload")(
29 "disable-caching,d", bpo::value<bool>()->default_value(false)->implicit_value(true), "Disable CCDB caching")(
30 "help,h", "Produce help message.");
31
32 try {
33 bpo::store(parse_command_line(argc, argv, options), vm);
34
35 // help
36 if (vm.count("help")) {
37 std::cout << options << std::endl;
38 return false;
39 }
40
41 bpo::notify(vm);
42 } catch (const bpo::error& e) {
43 std::cerr << e.what() << "\n\n";
44 std::cerr << "Error parsing command line arguments; Available options:\n";
45
46 std::cerr << options << std::endl;
47 return false;
48 }
49 return true;
50}
51
52int main(int argc, char* argv[])
53{
54 bpo::options_description options("Allowed options");
55 bpo::variables_map vm;
56 if (!initOptionsAndParse(options, argc, argv, vm)) {
57 return -1;
58 }
59
60 // call populate "macro"
61 auto nTFs = vm["TFs-in-parallel"].as<int>();
62 auto tTF = vm["TF-processing-time"].as<float>();
63 auto& inputFile = vm["in-file-name"].as<std::string>();
64 auto& ccdbHost = vm["ccdb-sercer"].as<std::string>();
65 auto disableCaching = vm["disable-caching"].as<bool>();
66 retrieveFromCCDB(nTFs, tTF, inputFile, ccdbHost, !disableCaching);
67
68 return (0);
69}
bool initOptionsAndParse(bpo::options_description &options, int argc, char *argv[], bpo::variables_map &vm)
#define main