32void validate(boost::any&
v,
const std::vector<std::string>& values, severity_level*,
int)
35 static const std::unordered_map<std::string, severity_level> levels{
36 {
"trace", severity_level::trace}, {
"debug", severity_level::debug}, {
"status", severity_level::status},
37 {
"info", severity_level::info}, {
"warning", severity_level::warning}, {
"error", severity_level::error},
38 {
"fatal", severity_level::fatal}};
40 po::validators::check_first_occurrence(
v);
42 const std::string& s = po::validators::get_single_string(values);
44 auto it = levels.find(s);
46 if (it == levels.end())
throw po::validation_error(po::validation_error::invalid_option_value);
55 po::options_description required(
"Required options");
57 required.add_options()
58 (
"config,p", po::value(&
fMainConfigPath)->value_name(
"<file>")->required(),
59 "Path to the configuration file")
60 (
"input-locator,i", po::value(&
fInputLocator)->value_name(
"<locator>")->required(),
61 "URI specifying input timeslice source")
65 po::options_description
generic(
"Other options");
68 (
"output,o", po::value(&
fOutputFile)->default_value(
"")->value_name(
"<template>"),
"write results to file(s)")
69 (
"output-max-size", po::value(&
fOutputMaxSize)->default_value(0)->value_name(
"<size>"),
"max size of a single output file (bytes)")
70 (
"output-max-items", po::value(&
fOutputMaxItems)->default_value(0)->value_name(
"<num>"),
"max number of output items in a single file")
71 (
"batch-qa-output", po::value(&
fBatchQaOutput)->default_value(
"")->value_name(
"<file>"),
"writes QA histogram to <file>, IF THE HISTOGRAM SERVER IS NOT AVAILABLE")
72 (
"device,d", po::value(&
fDevice)->default_value(
"cpu")->value_name(
"<device>"),
73 "select device (cpu, cuda0, cuda1, hip0, ...)")
75 (
"log-level,l", po::value(&
fLogLevel)->default_value(info)->value_name(
"<level>"),
76 "set log level (debug, info, warning, error, fatal)")
78 (
"monitor,m", po::value(&
fMonitorUri)->value_name(
"<uri>")->implicit_value(
"file:cout"),
79 "URI specifying monitor output (e.g. file:/tmp/monitor.txt, influx1:login:8086:cbmreco_status). Prints to cout when no argument is given. Monitor is disabled when flag is not set.")
80 (
"histogram", po::value(&
fHistogramUri)->value_name(
"<uri>"),
"URI to specify histogram server")
81 (
"histoshwm", po::value(&
fHistogramHwm)->default_value(1)->value_name(
"<num>"),
82 "High-Water Mark for ZMQ socket to histogram server in messages:\n"
83 " 0 = no buffering, num = nb updates kept in buffer if not pulled by server \n"
84 " Tune to avoid too high memory usage but also adapt to server load!")
85 (
"aux-data", po::value(&
fCollectAuxData)->implicit_value(
true),
"Enables collecting of auxiliary data from algorithms")
87 "space separated list of QA Steps to enable (BeamBmon, UnpackSts, EventBuilding, Tracking, ...)")
88#ifdef BOOST_IOS_HAS_ZSTD
90 "enables ZSTD compression of the outgoing histograms stream (decompression needed in target server!)")
92 (
"log-file,L", po::value(&
fLogFile)->value_name(
"<file>"),
93 "write log messages to file")
94 (
"output-types,O", po::value(&
fOutputTypes)->multitoken()->value_name(
"<types>"),
95 "space separated list of reconstruction output types (Hit, Tracks, DigiTimeslice, DigiEvent, ...)")
96 (
"compress-archive", po::bool_switch(&
fCompressArchive)->default_value(
false),
"Enable compression for output archives")
98 "space separated list of reconstruction steps (unpack, digitrigger, localreco, ...)")
99 (
"event-reco", po::bool_switch(&
fReconstructDigiEvents)->default_value(
false),
"runs digi event reconstruction (local reco, tracking, trigger)")
100 (
"systems,s", po::value(&
fDetectors)->multitoken()->default_value({Subsystem::STS, Subsystem::TOF, Subsystem::BMON, Subsystem::MUCH, Subsystem::RICH, Subsystem::TRD, Subsystem::TRD2D})->value_name(
"<detectors>"),
101 "space separated list of detectors to process (sts, mvd, ...)")
102 (
"child-id,c", po::value(&
fChildId)->default_value(
"00")->value_name(
"<id>"),
"online process id on node")
103 (
"run-id,r", po::value(&
fRunId)->default_value(2391)->value_name(
"<RunId>"),
"Run ID, for now flesctl run index, later run start time")
104 (
"run-start", po::value(&
fRunStartTime)->default_value(0)->value_name(
"<RunStart >"),
"Run start time in ns, can be fles start or online start")
105 (
"num-ts,n", po::value(&
fNumTimeslices)->default_value(-1)->value_name(
"<num>"),
106 "Stop after <num> timeslices (-1 = all)")
107 (
"skip-ts", po::value(&
fSkipTimeslices)->default_value(0)->value_name(
"<num>"),
108 "Skip first <num> timeslices")
109 (
"omp", po::value(&
fNumOMPThreads)->default_value(-1)->value_name(
"<num>"),
110 "Set number of OpenMP threads (-1 = use OMP_NUM_THREADS environment variable)")
112 "Print kernel times (Can opt. be given a value: Use none to disable or summary to only print aggregated times.)")
113 (
"timings-file", po::value(&
fTimingsFile)->value_name(
"<file>"),
114 "Write profiling times to yaml file (only when '-t' is set)")
115 (
"dump-archive", po::bool_switch(&
fDumpArchive)->default_value(
false),
116 "Dump archive content to stdout and exit. Provide archive with '-i'. (This is a hack to quick check archive content until we have proper tooling.)")
117 (
"release-mode,R",po::value<bool>(&
fReleaseMode)->implicit_value(
true),
118 "Copy and release each timeslice immediately after receiving it")
120 "produce help message")
124 po::options_description cmdline_options;
125 cmdline_options.add(required).add(generic);
127 po::variables_map vm;
128 po::command_line_parser parser{argc, argv};
129 parser.options(cmdline_options);
131 auto result = parser.run();
132 po::store(result, vm);
134 catch (
const std::exception& e) {
135 std::cerr <<
"Error: " << e.what() << std::endl;
136 std::cerr <<
"Use '-h' to display all valid options." << std::endl;
137 std::exit(EXIT_FAILURE);
140 if (vm.count(
"help") > 0) {
141 std::cout << cmdline_options << std::endl;
142 std::exit(EXIT_SUCCESS);
148 catch (
const po::required_option& e) {
149 std::cerr <<
"Error: " << e.what() << std::endl;
150 std::cerr <<
"Use '-h' to display all valid options." << std::endl;
151 std::exit(EXIT_FAILURE);
157 L_(info) <<
"!!! dir(fMainConfigPath)=" << dir.string();