Project

General

Profile

Feature #13917

New plugin to facilitate dynamic loading of user-defined utilities

Added by Kyle Knoepfel about 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Infrastructure
Target version:
Start date:
09/23/2016
Due date:
% Done:

100%

Estimated time:
40.00 h
Spent time:
Scope:
Internal
Experiment:
-
SSI Package:
art
Duration:

Description

art dynamically loads modules, services, sources, and other plugins based on a user's specified configuration. Among other benefits, this allows users to define arbitrary workflows without having to recompile their source code each time a different workflow is desired. However, there are also cases where users may want to specify different implementations of a given algorithm for a given (e.g.) module without having to recompile the module. In such cases, simply factoring out the algorithm into its own module (so that it can be configured separately from the rest of the module) may not be feasible due to memory constraints.

To allow users to dynamically load their own utilities within a module, we propose introducing a new plugin (with plugin-suffix 'tool' for now) such that users can do something similar to:

MyProducer::MyProducer(fhicl::ParameterSet const& pset) : ...
{
  std::unique_ptr<MyAlg> myAlg1 = art::make_tool<MyAlg>(pset);
  std::function<RT(ARGS...)> myAlg2 = art::make_tool<RT(ARGS...)>(alg_name);

  auto r1 = myAlg1->call_some_function(...);
  RT r2 = myAlg2(some_args...);
}

where art::make_tool receives a template argument of class type or function type. For the first signature, the pset for the module (or some nested table of that pset) is passed to the c'tor of the MyAlg class to make it configurable. For the second, the algorithm name (perhaps function pointer) is passed as the argument.

Users will be able to use the art::make_tool facility in modules, sources, services, and any other currently-existing plugins.

History

#1 Updated by Christopher Green about 4 years ago

The overall maintenance burden of this feature should be substantially lessened if the existing plugin facilities (cetlib/PluginFactory and friends) can be leveraged to provide this behavior.

#2 Updated by Kyle Knoepfel about 4 years ago

Thank you, Chris, for pointing out cetlib/PluginFactory.

#3 Updated by Kyle Knoepfel about 4 years ago

  • Status changed from New to Assigned

#4 Updated by Kyle Knoepfel about 4 years ago

  • % Done changed from 0 to 70
  • Estimated time set to 40.00 h

#5 Updated by Kyle Knoepfel about 4 years ago

  • % Done changed from 70 to 90

#6 Updated by Kyle Knoepfel almost 4 years ago

  • Category set to Infrastructure
  • Target version set to 2.06.00
  • SSI Package art added

#7 Updated by Kyle Knoepfel over 3 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 90 to 100

#8 Updated by Kyle Knoepfel over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF