LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PathManager.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
11 #include "art/Framework/Core/fwd.h"
19 #include "art/Utilities/Globals.h"
27 #include "cetlib/HorizontalRule.h"
28 #include "cetlib/LibraryManager.h"
29 #include "cetlib/bold_fontify.h"
30 #include "cetlib/container_algorithms.h"
31 #include "cetlib/detail/wrapLibraryManagerException.h"
32 #include "cetlib/ostream_handle.h"
33 #include "fhiclcpp/ParameterSet.h"
37 #include "range/v3/action.hpp"
38 #include "range/v3/view.hpp"
39 
40 #include <algorithm>
41 #include <cassert>
42 #include <map>
43 #include <memory>
44 #include <regex>
45 #include <set>
46 #include <sstream>
47 #include <string>
48 #include <utility>
49 #include <vector>
50 
51 using namespace std;
52 
54 
55 namespace art {
56 
57  namespace {
58  std::vector<std::string>
59  sorted_module_labels(std::vector<WorkerInPath::ConfigInfo> const& wcis)
60  {
61  auto to_label = [](auto const& wci) {
62  return wci.moduleConfigInfo->modDescription.moduleLabel();
63  };
64  using namespace ::ranges;
65  return wcis | views::transform(to_label) | to<std::vector>() |
66  ::ranges::actions::sort;
67  }
68  } // anonymous namespace
69 
70  PathManager::PathManager(ParameterSet const& procPS,
71  UpdateOutputCallbacks& outputCallbacks,
72  ProductDescriptions& productsToProduce,
73  ActionTable const& exceptActions,
74  ActivityRegistry const& actReg,
75  detail::EnabledModules enabled_modules)
76  : outputCallbacks_{outputCallbacks}
77  , exceptActions_{exceptActions}
78  , actReg_{actReg}
79  , procPS_{procPS}
80  , triggerPathSpecs_{enabled_modules.trigger_path_specs()}
82  , endPathInfo_(Globals::instance()->nschedules())
83  , productsToProduce_{productsToProduce}
84  , processName_{procPS.get<string>("process_name", {})}
85  , allModules_{moduleInformation_(enabled_modules)}
87  {
88  // Trigger paths
89  auto const& trigger_path_specs = enabled_modules.trigger_path_specs();
90  protoTrigPathLabels_.reserve(trigger_path_specs.size());
91  std::set<std::string> recorded_path_name;
92  for (auto const& [path_spec, entries] : trigger_path_specs) {
93  if (not recorded_path_name.insert(path_spec.name).second)
94  continue;
95 
96  if (entries.empty())
97  continue;
98 
99  detail::configs_t worker_config_infos{};
100  for (auto const& [label, action] : entries) {
101  auto const& mci = allModules_.at(label);
102  auto const mci_p = cet::make_exempt_ptr(&mci);
103  worker_config_infos.emplace_back(mci_p, action);
104  }
105  protoTrigPathLabels_.emplace_back(path_spec,
106  std::move(worker_config_infos));
107  }
108 
109  // Finalize trigger path names and make available in Globals
111 
112  ParameterSet triggerPSet;
113  triggerPSet.put("trigger_paths", prependedTriggerPathNames_());
115  Globals::instance()->setTriggerPSet(triggerPSet);
117 
118  // End path(s)
119  auto const& end_paths = enabled_modules.end_paths();
120  protoEndPathLabels_.reserve(end_paths.size());
121  for (auto const& [path_spec, entries] : end_paths) {
122  if (not recorded_path_name.insert(path_spec.name).second)
123  continue;
124 
125  if (entries.empty())
126  continue;
127 
128  for (auto const& [label, action] : entries) {
129  assert(action == detail::FilterAction::Normal);
130  auto const& mci = allModules_.at(label);
131  auto const mci_p = cet::make_exempt_ptr(&mci);
132  protoEndPathLabels_.emplace_back(mci_p, action);
133  }
134  }
135 
136  if (size(end_paths) > 1u) {
137  mf::LogInfo("PathConfiguration")
138  << "Multiple end paths have been combined into one end path,\n"
139  << "\"end_path\" since order is irrelevant.";
140  }
141  }
142 
143  std::vector<PathSpec>
145  {
146  using namespace ::ranges;
147  return triggerPathSpecs_ | views::keys | to<std::vector>();
148  }
149 
150  std::vector<std::string>
152  {
153  using namespace ::ranges;
154  return triggerPathSpecs_ | views::keys |
155  views::transform([](auto const& spec) { return spec.name; }) |
156  to<std::vector>();
157  }
158 
159  std::vector<std::string>
161  {
162  using namespace ::ranges;
163  return triggerPathSpecs_ | views::keys |
164  views::transform([](auto const& spec) { return to_string(spec); }) |
165  to<std::vector>();
166  }
167 
168  void
170  GlobalTaskGroup& task_group,
171  detail::SharedResources& resources,
172  std::vector<std::string> const& producing_services)
173  {
174  // For each configured schedule, create the trigger paths and the
175  // workers on each path.
176  auto const nschedules =
178 
179  // The modules created are managed by shared_ptrs. Once the
180  // workers claim (co-)ownership of the modules, the 'modules'
181  // object can be destroyed.
182  modules_ = makeModules_(nschedules);
183 
184  // FIXME: THE PATHS INFO OBJECTS SHOULD BECOME OWNERS OF THE WORKERS
185  // I IMAGINE AN API LIKE:
186  //
187  // pinfo.fillWorkers(pc, worker_config_infos, task_group, resources);
188  // pinfo.add_path(...);
189  //
190  // PERHAPS WOULD BE BETTER SOMETHING LIKE:
191  //
192  // Paths;
193  // wp.add_path(....);
194 
195  for (ScheduleID::size_type i = 0; i != nschedules; ++i) {
196  ScheduleID const sid{i};
197  auto& pinfo = triggerPathsInfo_[sid];
198  ScheduleContext const sc{sid};
199  for (auto const& [path_spec, worker_config_infos] :
201 
202  PathContext const pc{
203  sc, path_spec, sorted_module_labels(worker_config_infos)};
204  auto wips = fillWorkers_(
205  pc, worker_config_infos, pinfo.workers(), task_group, resources);
206  pinfo.add_path(
207  exceptActions_, actReg_, pc, std::move(wips), task_group);
208  }
209 
210  if (protoEndPathLabels_.empty()) {
211  continue;
212  }
213 
214  // Create the end path and the workers on it.
215  auto& einfo = endPathInfo_[sid];
216  PathContext const pc{sc,
218  sorted_module_labels(protoEndPathLabels_)};
219  auto wips = fillWorkers_(
220  pc, protoEndPathLabels_, einfo.workers(), task_group, resources);
221  einfo.add_path(exceptActions_, actReg_, pc, std::move(wips), task_group);
222  }
223 
224  // Create trigger-results inserters
226  nschedules);
227  for (ScheduleID::size_type i = 0; i != nschedules; ++i) {
228  ScheduleID const sid{i};
229  auto results_inserter = makeTriggerResultsInserter_(sid);
230  if (!results_inserter)
231  continue;
232 
235  actReg_,
237  sid,
238  task_group.native_group(),
239  resources};
240  triggerResultsWorkers_[sid] = results_inserter->makeWorker(wp);
241  trigger_results[sid] = std::move(results_inserter);
242  }
243 
244  modules_.replicated.emplace("TriggerResults", std::move(trigger_results));
245 
246  using namespace detail;
247  auto const graph_info_collection =
248  getModuleGraphInfoCollection_(producing_services);
249  ModuleGraphInfoMap const modInfos{graph_info_collection};
250  auto const module_graph =
252  auto const graph_filename =
253  procPS_.get<string>("services.scheduler.dataDependencyGraph", {});
254  if (!graph_filename.empty()) {
255  cet::ostream_handle osh{graph_filename};
256  print_module_graph(osh, modInfos, module_graph.first);
257  cerr << "Generated data-dependency graph file: " << graph_filename
258  << '\n';
259  }
260  auto const& err = module_graph.second;
261  if (!err.empty()) {
262  throw Exception{errors::Configuration} << err << '\n';
263  }
264 
265  // No longer need worker/module config objects.
266  protoTrigPathLabels_.clear();
267  protoEndPathLabels_.clear();
268  allModules_.clear();
269  }
270 
271  PathsInfo&
273  {
274  return triggerPathsInfo_.at(sid);
275  }
276 
279  {
280  return triggerPathsInfo_;
281  }
282 
283  PathsInfo&
285  {
286  return endPathInfo_.at(sid);
287  }
288 
291  {
292  return endPathInfo_;
293  }
294 
295  std::map<std::string, detail::ModuleConfigInfo>
297  detail::EnabledModules const& enabled_modules) const
298  {
299  std::map<std::string, detail::ModuleConfigInfo> result{};
300  ostringstream es;
301  for (auto const& [module_label, key_and_type] : enabled_modules.modules()) {
302  try {
303  auto const& [key, module_type] = key_and_type;
304  auto const module_pset = procPS_.get<fhicl::ParameterSet>(key);
305  auto const lib_spec = module_pset.get<string>("module_type");
306  if (auto const actual_mod_type = loadModuleType_(lib_spec);
307  actual_mod_type != module_type) {
308  es << " ERROR: Module with label " << module_label << " of type "
309  << lib_spec << " is configured as a " << to_string(module_type)
310  << " but defined in code as a " << to_string(actual_mod_type)
311  << ".\n";
312  continue;
313  }
314 
315  ModuleDescription const md{module_pset.id(),
316  lib_spec,
317  module_label,
318  loadModuleThreadingType_(lib_spec),
320  procPS_.id(),
321  getReleaseVersion()}};
322  detail::ModuleConfigInfo mci{md, std::move(module_pset), module_type};
323  result.try_emplace(module_label, std::move(mci));
324  }
325  catch (exception const& e) {
326  es << " ERROR: Configuration of module with label " << module_label
327  << " encountered the following error:\n"
328  << e.what();
329  }
330  }
331  if (auto err_msg = es.str(); not empty(err_msg)) {
333  << "The following were encountered while processing the module "
334  "configurations:\n"
335  << err_msg;
336  }
337  return result;
338  }
339 
342  {
343  ModulesByThreadingType modules{};
344  vector<string> configErrMsgs;
345  for (auto const& [module_label, mci] : allModules_) {
346  auto const& modPS = mci.modPS;
347  auto const& md = mci.modDescription;
348  auto const module_type = md.moduleName();
349  auto const module_threading_type = md.moduleThreadingType();
350 
351  // FIXME: provide context information?
352  actReg_.sPreModuleConstruction.invoke(md);
353 
354  auto sid = ScheduleID::first();
355  auto mod = makeModule_(modPS, md, sid);
356  if (auto err_msg = get_if<std::string>(&mod)) {
357  configErrMsgs.push_back(*err_msg);
358  continue;
359  }
360 
361  assert(std::holds_alternative<ModuleBase*>(mod));
362  auto module = std::get<ModuleBase*>(mod);
363 
364  if (module_threading_type == ModuleThreadingType::shared ||
365  module_threading_type == ModuleThreadingType::legacy) {
366  modules.shared.emplace(module_label,
367  std::unique_ptr<ModuleBase>{module});
368  } else {
370  nschedules);
371  replicated_modules[sid].reset(module);
372  ScheduleIteration schedule_iteration{sid.next(),
373  ScheduleID(nschedules)};
374 
375  auto fill_replicated_module = [&, this](ScheduleID const sid) {
376  auto repl_mod = makeModule_(modPS, md, sid);
377  if (auto mod_ptr = get_if<ModuleBase*>(&repl_mod)) {
378  replicated_modules[sid].reset(*mod_ptr);
379  }
380  };
381  schedule_iteration.for_each_schedule(fill_replicated_module);
382  modules.replicated.emplace(module_label, std::move(replicated_modules));
383  }
384 
385  actReg_.sPostModuleConstruction.invoke(md);
386 
387  // Since we store consumes information per module label, we only
388  // sort and collect it for one of the replicated-module copies.
389  // The only way this would be a problem is if someone decided to
390  // provided conditional consumes calls based on the ScheduleID
391  // presented to the replicated-module constructor.
392  module->sortConsumables(processName_);
393  ConsumesInfo::instance()->collectConsumes(module_label,
394  module->getConsumables());
395  }
396 
397  if (!configErrMsgs.empty()) {
398  constexpr cet::HorizontalRule rule{100};
399  ostringstream msg;
400  msg << '\n'
401  << rule('=') << "\n\n"
402  << "!! The following modules have been misconfigured: !!" << '\n';
403  for (auto const& err : configErrMsgs) {
404  msg << '\n' << rule('-') << '\n' << err;
405  }
406  msg << '\n' << rule('=') << '\n';
407  throw Exception(errors::Configuration) << msg.str();
408  }
409  return modules;
410  }
411 
414  ModuleDescription const& md,
415  ScheduleID const sid) const
416  try {
417  auto const& module_type = md.moduleName();
418  detail::ModuleMaker_t* module_factory_func{nullptr};
419  try {
420  lm_.getSymbolByLibspec(module_type, "make_module", module_factory_func);
421  }
422  catch (Exception& e) {
423  cet::detail::wrapLibraryManagerException(
424  e, "Module", module_type, getReleaseVersion());
425  }
426  if (module_factory_func == nullptr) {
427  throw Exception(errors::Configuration, "BadPluginLibrary: ")
428  << "Module " << module_type << " with version " << getReleaseVersion()
429  << " has internal symbol definition problems: consult an "
430  "expert.";
431  }
432  auto mod = module_factory_func(modPS, ProcessingFrame{sid});
433  mod->setModuleDescription(md);
434  return mod;
435  }
436  catch (fhicl::detail::validationException const& e) {
437  ostringstream es;
438  es << "\n\nModule label: " << cet::bold_fontify(md.moduleLabel())
439  << "\nmodule_type : " << cet::bold_fontify(md.moduleName()) << "\n\n"
440  << e.what();
441  return es.str();
442  }
443 
444  std::unique_ptr<ReplicatedProducer>
446  {
447  auto& pathsInfo = triggerPathsInfo_.at(scheduleID);
448  if (pathsInfo.paths().empty()) {
449  return nullptr;
450  }
451 
452  auto const& trig_pset = Globals::instance()->triggerPSet();
454  trig_pset.id(),
455  "TriggerResultInserter",
456  "TriggerResults",
459  actReg_.sPreModuleConstruction.invoke(md);
460  auto producer = std::make_unique<TriggerResultInserter>(
461  trig_pset, scheduleID, pathsInfo.pathResults());
462  producer->setModuleDescription(md);
463  actReg_.sPostModuleConstruction.invoke(md);
464  return producer;
465  }
466 
467  std::unique_ptr<Worker>
469  {
470  return std::move(triggerResultsWorkers_.at(scheduleID));
471  }
472 
473  vector<WorkerInPath>
475  vector<WorkerInPath::ConfigInfo> const& wci_list,
476  map<string, std::shared_ptr<Worker>>& workers,
477  GlobalTaskGroup& task_group,
478  detail::SharedResources& resources)
479  {
480  auto const sid = pc.scheduleID();
481  auto const pi = pc.pathID();
482  vector<WorkerInPath> wips;
483  for (auto const& wci : wci_list) {
484  auto const& mci = *wci.moduleConfigInfo;
485  auto const filterAction = wci.filterAction;
486  auto const& module_label = mci.modDescription.moduleLabel();
487 
488  auto const& md = mci.modDescription;
489  std::shared_ptr<Worker> worker{nullptr};
490  // Workers present on multiple paths are shared so that their
491  // work is only done once per schedule.
492  if (auto it = workers.find(module_label); it != workers.end()) {
493  TDEBUG_FUNC_SI(5, sid)
494  << "Reusing worker " << hex << it->second << dec
495  << " path: " << to_string(pi) << " type: " << md.moduleName()
496  << " label: " << module_label;
497  worker = it->second;
498  } else {
501  actReg_,
503  sid,
504  task_group.native_group(),
505  resources};
506  worker = makeWorker_(mci.modDescription, wp);
507  TDEBUG(5) << "Made worker " << hex << worker << dec << " (" << sid
508  << ") path: " << to_string(pi) << " type: " << md.moduleName()
509  << " label: " << module_label << '\n';
510  }
511 
512  assert(worker);
513  workers.emplace(module_label, worker);
514  wips.emplace_back(
515  cet::make_exempt_ptr(worker.get()), filterAction, pc, task_group);
516  }
517  return wips;
518  }
519 
520  std::shared_ptr<Worker>
522  {
523  auto get_module = [this](std::string const& module_label,
524  ModuleThreadingType const module_threading_type,
525  ScheduleID const sid) -> auto&
526  {
527  if (module_threading_type == ModuleThreadingType::shared ||
528  module_threading_type == ModuleThreadingType::legacy) {
529  return modules_.shared.at(module_label);
530  }
531  return modules_.replicated.at(module_label)[sid];
532  };
533 
534  auto& module =
535  get_module(md.moduleLabel(), md.moduleThreadingType(), wp.scheduleID_);
536  return module->makeWorker(wp);
537  }
538 
539  ModuleType
540  PathManager::loadModuleType_(string const& lib_spec) const
541  {
542  detail::ModuleTypeFunc_t* mod_type_func{nullptr};
543  try {
544  lm_.getSymbolByLibspec(lib_spec, "moduleType", mod_type_func);
545  }
546  catch (Exception& e) {
547  cet::detail::wrapLibraryManagerException(
548  e, "Module", lib_spec, getReleaseVersion());
549  }
550  if (mod_type_func == nullptr) {
551  throw Exception(errors::Configuration, "BadPluginLibrary")
552  << "Module " << lib_spec << " with version " << getReleaseVersion()
553  << " has internal symbol definition problems: consult an expert.";
554  }
555  return mod_type_func();
556  }
557 
559  PathManager::loadModuleThreadingType_(string const& lib_spec) const
560  {
561  detail::ModuleThreadingTypeFunc_t* mod_threading_type_func{nullptr};
562  try {
563  lm_.getSymbolByLibspec(
564  lib_spec, "moduleThreadingType", mod_threading_type_func);
565  }
566  catch (Exception& e) {
567  cet::detail::wrapLibraryManagerException(
568  e, "Module", lib_spec, getReleaseVersion());
569  }
570  if (mod_threading_type_func == nullptr) {
571  throw Exception(errors::Configuration, "BadPluginLibrary")
572  << "Module " << lib_spec << " with version " << getReleaseVersion()
573  << " has internal symbol definition problems: consult an expert.";
574  }
575  return mod_threading_type_func();
576  }
577 
578  // Module-graph implementation below
579  using namespace detail;
580 
583  std::vector<std::string> const& producing_services)
584  {
585  collection_map_t result{};
586  auto& source_info = result["input_source"];
587  if (!protoTrigPathLabels_.empty()) {
588  set<string> path_names;
589  for (auto const& spec : triggerPathSpecs_ | ::ranges::views::keys) {
590  path_names.insert(spec.name);
591  }
592  source_info.paths = path_names;
593  result["TriggerResults"] = ModuleGraphInfo{ModuleType::producer};
594  } else if (!protoEndPathLabels_.empty()) {
595  source_info.paths = {"end_path"};
596  }
597 
598  // Prepare information for produced and viewable products
599  std::map<std::string, std::set<ProductInfo>> produced_products_per_module;
600  std::map<std::string, std::set<std::string>> viewable_products_per_module;
601  for (auto const& pd : productsToProduce_) {
602  auto const& module_name = pd.moduleLabel();
603  produced_products_per_module[module_name].emplace(
605  pd.friendlyClassName(),
606  pd.moduleLabel(),
607  pd.productInstanceName(),
608  ProcessTag{pd.processName(), pd.processName()});
609  if (pd.supportsView()) {
610  // We do not do any type-checking here due to lack of
611  // introspection abilities. That will be performed during the
612  // actual product lookup.
613  viewable_products_per_module[module_name].insert(
614  pd.productInstanceName());
615  }
616  }
617 
618  // Handle producing services, which do not currently support 'consumes'.
619  for (auto const& service_name : producing_services) {
620  auto& graph_info = result[service_name];
621  graph_info.module_type = ModuleType::producing_service;
622 
623  auto found = produced_products_per_module.find(service_name);
624  if (found == cend(produced_products_per_module)) {
625  continue;
626  }
627 
628  graph_info.produced_products = found->second;
629  }
630 
631  for (auto const& [path_spec, module_labels] : protoTrigPathLabels_) {
633  module_labels,
634  produced_products_per_module,
635  viewable_products_per_module,
636  result);
637  }
640  produced_products_per_module,
641  viewable_products_per_module,
642  result);
644  return result;
645  }
646 
647  void
649  string const& path_name,
650  configs_t const& worker_configs,
651  std::map<std::string, std::set<ProductInfo>> const& produced_products,
652  std::map<std::string, std::set<std::string>> const& viewable_products,
653  collection_map_t& info_collection) const
654  {
655  auto const worker_config_begin = cbegin(worker_configs);
656 
657  for (auto it = worker_config_begin, end = cend(worker_configs); it != end;
658  ++it) {
659  auto const& mci = *it->moduleConfigInfo;
660  auto const& module_name = mci.modDescription.moduleLabel();
661  auto& graph_info = info_collection[module_name];
662  graph_info.paths.insert(path_name);
663  graph_info.module_type = mci.moduleType;
664 
665  auto found = produced_products.find(module_name);
666  if (found != cend(produced_products)) {
667  graph_info.produced_products = found->second;
668  }
669 
670  auto const& consumables =
671  ConsumesInfo::instance()->consumables(module_name);
672  graph_info.consumed_products =
674  consumables,
675  produced_products,
676  viewable_products,
677  worker_config_begin,
678  it);
679  }
680  }
681 
682  namespace {
683  // The allowed path-specification is more restricted than what we
684  // formulate here--i.e. a path name cannot begin with a digit.
685  // However, because the FHiCL language does not allow parameter
686  // names to begin with a digit, we do not worry about the overly
687  // permissive regex below.
688  string const allowed_path_spec{R"([\w\*\?]+)"};
689  regex const regex{"(\\w+:)?(!|exception@)?(" + allowed_path_spec +
690  ")(&noexception)?"};
691  }
692 
693  void
695  collection_map_t& info_collection) const
696  {
697  for (auto const& worker_config : worker_configs) {
698  auto const& mci = *worker_config.moduleConfigInfo;
699  auto const& module_name = mci.modDescription.moduleLabel();
700  auto const& ps = mci.modPS;
701  auto& graph_info = info_collection[module_name];
702  assert(is_observer(graph_info.module_type));
703  auto path_specs = ps.get<vector<string>>("SelectEvents", {});
704  for (auto& path_spec : path_specs) {
706 
707  smatch matches;
708  regex_match(path_spec, matches, regex);
709  // By the time we have gotten here, all modules have been
710  // constructed, and it is guaranteed that the specified paths
711  // are in accord with the above regex.
712  // 0: Full match
713  // 1: Optional process name
714  // 2: Optional '!' or 'exception@'
715  // 3: Required path specification
716  // 4: Optional '&noexception'
717  assert(matches.size() == 5);
718  graph_info.select_events.insert(matches[3]);
719  }
720  }
721  }
722 
723 } // namespace art
consumables_t::mapped_type const & consumables(std::string const &module_label) const
Definition: ConsumesInfo.h:110
void collectConsumes(std::string const &module_label, consumables_t::mapped_type const &consumables)
ProductDescriptions & productsToProduce_
Definition: PathManager.h:130
void setProcessName(std::string const &)
Definition: Globals.cc:54
static std::string end_path()
Definition: PathContext.h:14
static ParameterSetID const & put(ParameterSet const &ps)
ModuleBase *(fhicl::ParameterSet const &, ProcessingFrame const &) ModuleMaker_t
Definition: ModuleMacros.h:33
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:93
keytype_for_name_t const & modules() const noexcept
static ConsumesInfo * instance()
Definition: ConsumesInfo.cc:27
std::map< module_label_t, PerScheduleContainer< std::unique_ptr< ModuleBase > > > replicated
Definition: PathManager.h:81
void fillModuleOnlyDeps_(std::string const &path_name, detail::configs_t const &worker_configs, std::map< std::string, std::set< ProductInfo >> const &produced_products, std::map< std::string, std::set< std::string >> const &viewable_products, detail::collection_map_t &info_collection) const
Definition: PathManager.cc:648
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
GlobalSignal< detail::SignalResponseType::FIFO, void(ModuleDescription const &)> sPreModuleConstruction
std::unique_ptr< Worker > releaseTriggerResultsInserter(ScheduleID)
Definition: PathManager.cc:468
std::string const & moduleLabel() const
std::map< module_name_t, ModuleGraphInfo > collection_map_t
std::vector< std::string > triggerPathNames_() const
Definition: PathManager.cc:151
PerScheduleContainer< std::unique_ptr< Worker > > triggerResultsWorkers_
Definition: PathManager.h:142
static constexpr ScheduleID first()
Definition: ScheduleID.h:50
STL namespace.
art::detail::paths_to_modules_t protoTrigPathLabels_
Definition: PathManager.h:139
void setTriggerPSet(fhicl::ParameterSet const &)
Definition: Globals.cc:66
std::string processName_
Definition: PathManager.h:137
std::vector< BranchDescription > ProductDescriptions
ModuleType module_type(std::string const &full_key)
fhicl::ParameterSet const & triggerPSet() const
Definition: Globals.cc:60
GlobalSignal< detail::SignalResponseType::LIFO, void(ModuleDescription const &)> sPostModuleConstruction
auto scheduleID() const
Definition: PathContext.h:52
maybe_module_t makeModule_(fhicl::ParameterSet const &module_pset, ModuleDescription const &md, ScheduleID) const
Definition: PathManager.cc:413
std::shared_ptr< Worker > makeWorker_(ModuleDescription const &md, WorkerParams const &wp)
Definition: PathManager.cc:521
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
PerScheduleContainer< PathsInfo > triggerPathsInfo_
Definition: PathManager.h:128
std::vector< WorkerInPath::ConfigInfo > configs_t
std::vector< PathSpec > path_specs(std::vector< std::string > const &path_spec_strs)
Definition: PathSpec.cc:34
std::variant< ModuleBase *, std::string > maybe_module_t
Definition: PathManager.h:91
ScheduleID::size_type nschedules() const
Definition: Globals.cc:24
std::vector< std::string > prependedTriggerPathNames_() const
Definition: PathManager.cc:160
T get(std::string const &key) const
Definition: ParameterSet.h:314
PerScheduleContainer< PathsInfo > const & endPathInfo()
Definition: PathManager.cc:290
PerScheduleContainer< PathsInfo > endPathInfo_
Definition: PathManager.h:129
ScheduleID scheduleID_
Definition: WorkerParams.h:29
std::vector< WorkerInPath > fillWorkers_(PathContext const &pc, std::vector< WorkerInPath::ConfigInfo > const &wci_list, std::map< std::string, std::shared_ptr< Worker >> &workers, GlobalTaskGroup &task_group, detail::SharedResources &resources)
Definition: PathManager.cc:474
ModuleThreadingType loadModuleThreadingType_(std::string const &lib_spec) const
Definition: PathManager.cc:559
std::map< std::string, detail::ModuleConfigInfo > allModules_
Definition: PathManager.h:138
#define TDEBUG_FUNC_SI(LEVEL, SI)
void print_module_graph(std::ostream &os, ModuleGraphInfoMap const &modInfos, ModuleGraph const &graph)
std::string const & getReleaseVersion()
ModulesByThreadingType makeModules_(ScheduleID::size_type n)
Definition: PathManager.cc:341
ModuleType( ModuleTypeFunc_t)
Definition: ModuleMacros.h:34
std::string name
Definition: PathSpec.h:48
static auto end_path_spec()
Definition: PathContext.h:20
void fillSelectEventsDeps_(detail::configs_t const &worker_configs, detail::collection_map_t &info_collection) const
Definition: PathManager.cc:694
cet::LibraryManager lm_
Definition: PathManager.h:132
ParameterSetID id() const
std::vector< PathSpec > triggerPathSpecs() const
Definition: PathManager.cc:144
ModuleThreadingType moduleThreadingType() const
std::map< std::string, detail::ModuleConfigInfo > moduleInformation_(detail::EnabledModules const &enabled_modules) const
Definition: PathManager.cc:296
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
#define TDEBUG(LEVEL)
UpdateOutputCallbacks & outputCallbacks_
Definition: PathManager.h:123
ActionTable const & exceptActions_
Definition: PathManager.h:124
char const * what() const noexcept override
id_type size_type
Definition: ScheduleID.h:25
PathID pathID() const noexcept
Definition: PathContext.h:68
Float_t sc
Definition: plot.C:23
ModuleThreadingType
Definition: ModuleType.h:19
void remove_whitespace(std::string &str)
detail::collection_map_t getModuleGraphInfoCollection_(std::vector< std::string > const &producing_services)
Definition: PathManager.cc:582
std::map< module_label_t, std::unique_ptr< ModuleBase > > shared
Definition: PathManager.h:78
art::detail::module_entries_for_ordered_path_t triggerPathSpecs_
Definition: PathManager.h:127
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
void setTriggerPathNames(std::vector< std::string > const &)
Definition: Globals.cc:78
tbb::task_group & native_group()
PerScheduleContainer< PathsInfo > const & triggerPathsInfo()
Definition: PathManager.cc:278
std::set< ProductInfo > consumed_products_for_module(std::string const &current_process, ConsumesInfo::consumables_t::mapped_type const &consumables, std::map< std::string, std::set< ProductInfo >> const &produced_products, std::map< std::string, std::set< std::string >> const &viewable_products, config_const_iterator const config_begin, config_const_iterator const config_it)
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:85
void createModulesAndWorkers(GlobalTaskGroup &task_group, detail::SharedResources &resources, std::vector< std::string > const &producing_services)
Definition: PathManager.cc:169
ModuleThreadingType( ModuleThreadingTypeFunc_t)
Definition: ModuleMacros.h:35
Definition: MVAAlg.h:12
PathSpec path_spec(std::string const &path_spec)
Definition: PathSpec.cc:22
bool is_observer(ModuleType const mt)
Definition: ModuleType.h:28
art::detail::configs_t protoEndPathLabels_
Definition: PathManager.h:140
static Globals * instance()
Definition: Globals.cc:17
ModulesByThreadingType modules_
Definition: PathManager.h:141
Float_t e
Definition: plot.C:35
ActivityRegistry const & actReg_
Definition: PathManager.h:125
std::unique_ptr< ReplicatedProducer > makeTriggerResultsInserter_(ScheduleID scheduleID)
Definition: PathManager.cc:445
ModuleType loadModuleType_(std::string const &lib_spec) const
Definition: PathManager.cc:540
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
fhicl::ParameterSet procPS_
Definition: PathManager.h:126
void put(std::string const &key)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:109
ModuleType
Definition: ModuleType.h:11
std::pair< ModuleGraph, std::string > make_module_graph(ModuleGraphInfoMap const &modInfos, paths_to_modules_t const &trigger_paths, configs_t const &end_path)