ScheduleThreadChecker_module.cc
Go to the documentation of this file.
6 #include "fhiclcpp/types/Atom.h"
7 
8 namespace {
9  class ScheduleThreadChecker : public art::EDAnalyzer {
10  public:
11  struct Config {
12  fhicl::Atom<unsigned> expected_schedules{fhicl::Name{"num_schedules"}};
13  fhicl::Atom<unsigned> expected_threads{fhicl::Name{"num_threads"}};
14  };
15  using Parameters = Table<Config>;
16  explicit ScheduleThreadChecker(Parameters const& p);
17 
18  private:
19  void
20  analyze(art::Event const&) override
21  {}
22  };
23 
24  ScheduleThreadChecker::ScheduleThreadChecker(Parameters const& p)
25  : EDAnalyzer{p}
26  {
27  auto const* globals = art::Globals::instance();
28  auto const nschedules = globals->nschedules();
29  auto const nthreads = globals->nthreads();
30  if (p().expected_schedules() != nschedules or
31  p().expected_threads() != nthreads) {
32  throw art::Exception{
34  "The expected number of threads and schedules does not match those "
35  "that are actually configured for this job.\n"}
36  << "Expected: " << p().expected_threads() << " threads and "
37  << p().expected_schedules() << " schedules\n"
38  << "Actual : " << nthreads << " threads and " << nschedules
39  << " schedules\n";
40  }
41  }
42 }
43 
44 DEFINE_ART_MODULE(ScheduleThreadChecker)
def analyze(root, level, gtrees, gbranches, doprint)
Definition: rootstat.py:69
typename config_impl< T >::type Config
Definition: ModuleMacros.h:52
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
p
Definition: test.py:223
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
static Globals * instance()
Definition: Globals.cc:17