class documentation

class PluginManager(PM):

View In Hierarchy

PluginManager class to manage plugins.

This class extends the base PluginManager class and implements the logic to load, configure, validate, start, stop and unload plugins based on the configuration settings.

Method restart Restart the PluginManager service.
Method shutdown Shutdown the PluginManager service and plugins.
Method start Start the PluginManager service. This is called when the CSE is started.
Method startup Runtime instance of the PluginManager.
Method stop Stop the PluginManager service. This is called when the CSE is stopped. It does not shut down the plugins, but only stops them.
Class Variable _pluginChecks Dictionary of plugin checks. The keys are the plugin names, the values are callables that take the plugin name as an argument and return a boolean indicating whether the plugin should be loaded. This is used to determine which plugins to load based on the configuration.

Inherited from PluginManager:

Method __delattr__ Delete the plugin by name.
Method __getattr__ Get the instance or plugin by name.
Method callService Call a service plugin endpoint.
Method configurePlugins Configure the specified plugins.
Method dependencyGraph Get the dependency graph of the plugins and other classes.
Method dependencyGraphProvidedInstances Get the provided instances that are not plugins, and who is using them.
Method getPluginsByTag Get the names of the plugins that have the given tag.
Method has Check if a plugin instance with the given name exists.
Method isProvidedFunction Check if a provided instance with the given name is a function provided by the @provide decorator.
Method loadPlugins Load plugins from the specified directory.
Method pausePlugins Pause the specified plugins.
Method provide Provide a instance of any non-plugin class to be injected as a dependency. This can be used to provide instances of classes that are not plugins, but are required as dependencies by plugins or other classes.
Method resolvePlugins Resolve the dependencies of all plugins and other classes. This is called before starting the plugins to ensure that all dependencies are resolved and the plugin instances have all the required attributes injected.
Method restartPlugins Restart the specified plugins.
Method setupFinished Check if all required dependencies are resolved. This can be called after the resolvePlugins method to check if there are any unresolved dependencies that are required and not provided. This is a separate step because sometimes, we might want to resolve the plugins first and then check for missing dependencies, so that we can provide the missing dependencies before starting the plugins...
Method startPlugins Start the specified plugins.
Method stopPlugins Shutdown the specified plugins. Plugins are stopped in reverse order of their priority.
Method unloadPlugins Unload a plugin by name. If running, stop it first.
Method unpausePlugins Unpause the specified plugins. Plugins are unpaused in reverse order of their priority.
Method unresolvePlugins Unresolve the plugins. This is called when plugins are unloaded to clean up the injected dependencies and set the plugin instances to None.
Method validatePlugins Validate the specified plugins.
Class Variable plugins Dictionary to hold the loaded plugins. The keys are the plugin names, the values are PluginInfo objects.
Class Variable unloadedPlugins List to hold the names of the plugins that were not loaded due to filtering.
Method _checkPluginTags Check if a plugin matches the specified tags and excluded tags.
Method _transition Transition the state of a plugin. This will happen in the order of the plugin priority, but can be reversed if necessary (e.g. for stopping plugins, which should happen in reverse order of starting).
Class Variable _pluginInstances Dictionary for the mapping between instance attribute names and the instances itself.
Class Variable _providedInstances Dictionary to hold instances that are extra provided class instances. The keys are the names of the instances, ie. the module name, the values are the instances themselves.
Class Variable _tagsPluginMap Dictionary to map tags to plugin names and instances for easier lookup by tag.
def restart(self, _: str):

Restart the PluginManager service.

def shutdown(self, tags: str | list[str] | None = None, excludedTags: str | list[str] | None = None) -> bool:

Shutdown the PluginManager service and plugins.

def start(self, tags: str | list[str] | None = None, excludedTags: str | list[str] | None = None) -> bool:

Start the PluginManager service. This is called when the CSE is started.

def startup(self):

Runtime instance of the PluginManager.

def stop(self, tags: str | list[str] | None = None, excludedTags: str | list[str] | None = None) -> bool:

Stop the PluginManager service. This is called when the CSE is stopped. It does not shut down the plugins, but only stops them.

_pluginChecks: dict[str, Callable] =

Dictionary of plugin checks. The keys are the plugin names, the values are callables that take the plugin name as an argument and return a boolean indicating whether the plugin should be loaded. This is used to determine which plugins to load based on the configuration.