flowbber.loaders.loader
¶Base class to load Flowbber plugins.
All Flowbber component loaders extend from the PluginLoader class.
PluginLoader
:
Plugin loader utility class.flowbber.loaders.loader.
PluginLoader
(component, api_version='1.0')¶Plugin loader utility class.
This class allows to load plugins using Python entry points.
Inheritance
load_plugins
(cache=True)¶Load all available plugins.
This function load all available plugins by discovering installed plugins registered in the entry point. This can be costly or error prone if the package that declared the entrypoint misbehave. Because of this a cache is stored after the first call.
True
return the cached result. If False
force reload of all plugins registered for the entry point.flowbber.components.Component
)
implementing it.register
(key)¶Register a plugin locally.
This method is expected to be used as a decorator. It allows to register a plugin locally without having to create a full Python package to use entrypoints.
Usage:
from flowbber.loaders import source
from flowbber.components.source import Source
@source.register('my_source')
class MySource(Source):
def collect(self):
return {'my_value': 1000}
Same apply for aggregators and sinks.