#include "FileCatalogOptionsHandler.h"
Definition at line 14 of file FileCatalogOptionsHandler.h.
art::FileCatalogOptionsHandler::FileCatalogOptionsHandler |
( |
bpo::options_description & |
desc | ) |
|
|
explicit |
Definition at line 179 of file FileCatalogOptionsHandler.cc.
References art::add_opt(), appFamily_, appVersion_, and fhicl::detail::atom::value().
183 bpo::options_description sam_options{
"SAM options"};
184 auto options = sam_options.add_options();
186 options,
"sam-web-uri", bpo::value<string>(),
"URI for SAM web service.");
187 add_opt(options,
"sam-process-id", bpo::value<string>(),
"SAM process ID.");
189 "sam-application-family",
191 "SAM application family.");
195 "SAM application family.");
197 "sam-application-version",
199 "SAM application version.");
203 "SAM application version.");
204 add_opt(options,
"sam-group", bpo::value<string>(),
"SAM group.");
207 bpo::value<string>(),
208 "File type for SAM metadata.");
212 "SAM data tier (<spec-label>:<tier-spec>).");
215 bpo::value<string>(),
216 "Global run-type for SAM metadata.");
220 "SAM stream name (<module-label>:<stream-name>).");
222 "sam-inherit-metadata",
223 "Input file provides the file type and run type.");
225 options,
"sam-inherit-file-type",
"Input file provides the file type.");
226 add_opt(options,
"sam-inherit-run-type",
"Input file provides the run type.");
227 desc.add(sam_options);
void add_opt(T &t, Args &&...args)
std::string value(boost::any const &)
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::FileCatalogOptionsHandler::doCheckOptions |
( |
bpo::variables_map const & |
vm | ) |
|
|
overrideprivatevirtual |
int art::FileCatalogOptionsHandler::doProcessOptions |
( |
bpo::variables_map const & |
vm, |
|
|
fhicl::intermediate_table & |
raw_config |
|
) |
| |
|
overrideprivatevirtual |
Implements art::OptionsHandler.
Definition at line 238 of file FileCatalogOptionsHandler.cc.
References appFamily_, appVersion_, art::errors::Configuration, art::ensureTable(), fhicl::intermediate_table::erase(), art::detail::exists_outside_prolog(), art::detail::fhicl_key(), fhicl::intermediate_table::get(), and fhicl::intermediate_table::put().
242 std::string
const services{
"services"};
243 auto const& ciLocation =
fhicl_key(services,
"CatalogInterface");
244 auto const& ftLocation =
fhicl_key(services,
"FileTransfer");
245 auto const& fcmdLocation =
fhicl_key(services,
"FileCatalogMetadata");
251 if (vm.count(
"sam-web-uri") > 0) {
253 vm[
"sam-web-uri"].as<string>());
255 if (vm.count(
"sam-process-id") > 0) {
257 raw_config.
put(
"source.fileNames",
258 vector<string>{vm[
"sam-process-id"].as<
string>()});
261 vm[
"sam-process-id"].as<string>());
265 raw_config,
fhicl_key(fcmdLocation,
"processID"))) {
267 <<
"configurations " <<
fhicl_key(ciLocation,
"webURI")
268 <<
" (--sam-web-uri) and\n" 270 <<
" (--sam-process-id) must be specified\n" 271 <<
"together or not at all.\n";
273 bool const wantSAMweb{
280 if (vm.count(
"sam-group") > 0) {
282 vm[
"sam-group"].as<string>());
288 check_metadata_options(vm);
290 string const mdFromInput{
"metadataFromInput"};
291 bool specifyDataTier{
false};
295 if (vm.count(
"sam-inherit-metadata") > 0) {
297 vector<string>{
"fileType",
"runType"});
298 specifyDataTier =
true;
303 if (vm.count(
"sam-inherit-file-type") > 0) {
304 md.emplace_back(
"fileType");
305 specifyDataTier =
true;
308 if (vm.count(
"sam-inherit-run-type") > 0) {
309 md.emplace_back(
"runType");
313 raw_config.
put(
fhicl_key(fcmdLocation, mdFromInput), md);
317 if (vm.count(
"sam-run-type") > 0) {
319 vm[
"sam-run-type"].as<string>());
321 if (vm.count(
"sam-file-type") > 0) {
323 vm[
"sam-file-type"].as<string>());
325 bool const requireMetadata =
326 have_outputs(raw_config) &&
329 fhicl_key(fcmdLocation,
"applicationFamily")) ||
331 fhicl_key(fcmdLocation,
"applicationVersion")) ||
336 if (requireMetadata) {
337 fill_tiers_streams(vm, raw_config);
338 maybeThrowOnMissingMetadata(raw_config);
343 process_name = raw_config.
get<
string>(
"process_name");
345 if (requireMetadata && process_name.empty()) {
347 <<
"Non-empty / default process_name required for SAM metadata.\n";
350 raw_config.
put(
fhicl_key(ciLocation,
"service_provider"),
351 "IFCatalogInterface");
352 raw_config.
put(
fhicl_key(ftLocation,
"service_provider"),
"IFFileTransfer");
bool exists_outside_prolog(fhicl::intermediate_table const &config, std::string const &key)
void ensureTable(fhicl::intermediate_table &table, std::string const &fhicl_spec)
std::enable_if_t< std::is_convertible< T, std::string >::value, std::string > fhicl_key(T const &name)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
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
std::string art::FileCatalogOptionsHandler::appFamily_ |
|
private |
std::string art::FileCatalogOptionsHandler::appVersion_ |
|
private |
The documentation for this class was generated from the following files: