#include "ProcessingOptionsHandler.h"
Definition at line 10 of file ProcessingOptionsHandler.h.
art::ProcessingOptionsHandler::ProcessingOptionsHandler |
( |
bpo::options_description & |
desc, |
|
|
bool |
rethrowDefault |
|
) |
| |
|
explicit |
Definition at line 51 of file ProcessingOptionsHandler.cc.
References art::add_opt().
57 bpo::options_description processing_options{
"Processing options"};
58 auto options = processing_options.add_options();
62 bpo::value<int>()->default_value(1),
63 "Number of threads to use for event processing (default = 1, 0 = all " 67 "Some exceptions may be handled differently by default (e.g. " 69 add_opt(options,
"rethrow-default",
"All exceptions default to rethrow.");
72 "All exceptions overridden to rethrow (cf rethrow-default).");
75 "errorOnFailureToPut",
76 bpo::value<bool>()->implicit_value(
true,
"true"),
77 "Global flag that controls the behavior upon failure to 'put' a " 78 "product (declared by 'produces') onto the Event. If 'true', per-module " 79 "flags can override the value of the global flag.");
82 "errorOnMissingConsumes",
83 bpo::value<bool>()->implicit_value(
true,
"true"),
84 "If 'true', then an exception will be thrown if any module attempts " 85 "to retrieve a product via the 'getBy*' interface without specifying " 86 "the appropriate 'consumes<T>(...)' statement in the module constructor.");
90 bpo::value<bool>()->implicit_value(
true,
"true"),
91 "If 'true', a signal received from the user yields an art return code " 92 "corresponding to an error; otherwise return 0.");
93 desc.add(processing_options);
void add_opt(T &t, Args &&...args)
int art::OptionsHandler::checkOptions |
( |
bpo::variables_map const & |
vm | ) |
|
|
inherited |
Definition at line 51 of file OptionsHandler.cc.
53 std::string
const thisClass(cet::demangle_symbol(
typeid(*this).name()));
54 return exceptionCatcher([&vm,
this] {
return doCheckOptions(vm); },
55 thisClass +
"::doCheckOptions()",
virtual int doCheckOptions(bpo::variables_map const &vm)=0
int art::ProcessingOptionsHandler::doCheckOptions |
( |
bpo::variables_map const & |
vm | ) |
|
|
overrideprivatevirtual |
Implements art::OptionsHandler.
Definition at line 97 of file ProcessingOptionsHandler.cc.
References art::errors::Configuration.
99 if ((vm.count(
"rethrow-all") + vm.count(
"rethrow-default") +
100 vm.count(
"no-rethrow-default")) > 1) {
102 <<
"Options --default-exceptions, --rethrow-all, and --rethrow-default " 104 <<
"are mutually incompatible.\n";
109 if (vm[
"nthreads"].as<int>() < 0) {
111 <<
"Option --nthreads must greater than or equal to 0.";
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
int art::ProcessingOptionsHandler::doProcessOptions |
( |
bpo::variables_map const & |
vm, |
|
|
fhicl::intermediate_table & |
raw_config |
|
) |
| |
|
overrideprivatevirtual |
Implements art::OptionsHandler.
Definition at line 117 of file ProcessingOptionsHandler.cc.
References art::detail::fhicl_key(), fhicl::intermediate_table::put(), fhicl::intermediate_table::putEmptySequence(), and rethrowDefault_.
121 std::string
const scheduler_key{
"services.scheduler"};
123 if (vm.count(
"rethrow-all") == 1 || vm.count(
"rethrow-default") == 1 ||
125 raw_config.
put(
fhicl_key(scheduler_key,
"defaultExceptions"),
false);
126 if (vm.count(
"rethrow-all") == 1) {
134 fillTable(
"errorOnFailureToPut",
135 fhicl_key(scheduler_key,
"errorOnFailureToPut"),
139 fillTable(
"errorOnMissingConsumes",
140 fhicl_key(scheduler_key,
"errorOnMissingConsumes"),
144 fillTable(
"errorOnSIGINT",
145 fhicl_key(scheduler_key,
"errorOnSIGINT"),
150 auto const nt = vm[
"nthreads"].as<
int>();
151 auto const nthreads =
152 (nt == 0) ? tbb::task_scheduler_init::default_num_threads() : nt;
153 raw_config.
put(
fhicl_key(scheduler_key,
"num_threads"), nthreads);
std::enable_if_t< std::is_convertible< T, std::string >::value, std::string > fhicl_key(T const &name)
Definition at line 60 of file OptionsHandler.cc.
Referenced by art::run_art_string_config().
63 std::string
const thisClass(cet::demangle_symbol(
typeid(*this).name()));
64 return exceptionCatcher(
66 thisClass +
"::doProcessOptions()",
virtual int doProcessOptions(bpo::variables_map const &vm, fhicl::intermediate_table &raw_config)=0
bool art::ProcessingOptionsHandler::rethrowDefault_ |
|
private |
The documentation for this class was generated from the following files: