Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
art
art
Framework
Services
Registry
detail
ensure_only_one_thread.cc
Go to the documentation of this file.
1
#include "
art/Framework/Services/Registry/detail/ensure_only_one_thread.h
"
2
#include "
art/Utilities/Globals.h
"
3
#include "
canvas/Utilities/Exception.h
"
4
#include "
fhiclcpp/ParameterSet.h
"
5
6
namespace
{
7
std::string
8
maybe_s(
unsigned
const
i,
std::string
const
&
word
)
9
{
10
return
i == 1u ? word : word +
"s"
;
11
}
12
}
13
14
void
15
art::detail::ensure_only_one_thread
(
fhicl::ParameterSet
const
& service_pset)
16
{
17
auto
const
& globals = *
Globals::instance
();
18
auto
const
nschedules = globals.nschedules();
19
auto
const
nthreads = globals.nthreads();
20
if
(nschedules == 1u && nthreads == 1u)
21
return
;
22
23
auto
const
service_type = service_pset.
get
<
std::string
>(
"service_type"
);
24
Exception
e
{
errors::Configuration
};
25
e
<<
"The service '"
<< service_type <<
'\''
;
26
std::string
provider
;
27
if
(service_pset.
get_if_present
(
"service_provider"
, provider)) {
28
e
<<
" (provider: '"
<< provider <<
"')"
;
29
}
30
e
<<
" is a legacy service,\n"
31
<<
"which can be used with only one schedule and one thread.\n"
32
<<
"This job uses "
<< nschedules << maybe_s(nschedules,
" schedule"
)
33
<<
" and "
<< nthreads << maybe_s(nthreads,
" thread"
) <<
".\n"
34
<<
"Please reconfigure your job to use only one schedule/thread.\n"
;
35
throw
e
;
36
}
string
std::string string
Definition:
nybbler.cc:12
RunHistoryService::provider
virtual const provider_type * provider() const override
Definition:
RunHistoryServiceStandard.h:30
instance
const std::string instance
Definition:
BlipMaker_module.cc:35
Exception.h
art::errors::Configuration
Definition:
Exception.h:32
ParameterSet.h
ensure_only_one_thread.h
e
const double e
Definition:
gUpMuFluxGen.cxx:165
Globals.h
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
art::detail::ensure_only_one_thread
void ensure_only_one_thread(fhicl::ParameterSet const &service_pset)
Definition:
ensure_only_one_thread.cc:15
art::Exception
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition:
Exception.h:66
fhicl::ParameterSet::get_if_present
std::optional< T > get_if_present(std::string const &key) const
Definition:
ParameterSet.h:224
ptb::content::word::word
union ptb::content::word::word word
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11