fluxnet_shuttle.core.registry
Plugin Registry and Error Collection
- module::
fluxnet_shuttle.core.registry
- synopsis:
Plugin registry and error collection for FLUXNET Shuttle Library
- moduleauthor:
Valerie Hendrix <vchendrix@lbl.gov>
- moduleauthor:
Sy-Toan Ngo <sytoanngo@lbl.gov>
- platform:
Unix, Windows
- created:
2025-10-09
- updated:
2025-12-09
This module provides the plugin registry for managing data hub plugins and error collection capabilities.
Functions
|
Add dunder methods based on the fields defined in the class. |
|
Return an object to identify dataclass fields. |
Classes
|
Special type indicating an unconstrained type. |
|
Base class for all data hub plugins. |
|
Async iterator that collects errors while yielding results. |
|
Pydantic model for error summary information. |
|
Combined model for complete FLUXNET dataset metadata. |
|
Pydantic model for individual plugin error details. |
|
Container for plugin execution errors. |
Registry for managing data hub plugins with automatic discovery. |
|
|
The year, month and day arguments are required. |
- class fluxnet_shuttle.core.registry.ErrorCollectingIterator(plugins, operation, **kwargs)[source]
Bases:
objectAsync iterator that collects errors while yielding results.
This class implements the async iterator protocol and collects results from multiple plugins while isolating and collecting any errors that occur.
- Parameters:
plugins (Dict[str, DataHubPlugin])
operation (str)
kwargs (Any)
- add_error(plugin_name, error, operation='')[source]
Add an error to the collection.
- Parameters:
plugin_name (
str) – Name of the plugin that encountered the errorerror (
Exception) – The exception that occurredoperation (
str) – The operation being performed when the error occurred
- Return type:
None
- class fluxnet_shuttle.core.registry.PluginErrorInfo(plugin_name, error, timestamp=<factory>, operation='')[source]
Bases:
objectContainer for plugin execution errors.
- Parameters:
plugin_name (str)
error (Exception)
timestamp (datetime)
operation (str)
- error: Exception
- operation: str = ''
- plugin_name: str
- timestamp: datetime
- class fluxnet_shuttle.core.registry.PluginRegistry[source]
Bases:
objectRegistry for managing data hub plugins with automatic discovery.
This class manages the registration and instantiation of data hub plugins, including automatic discovery through entry points.
- create_instance(name, **config)[source]
Create an instance of a plugin.
- Parameters:
name (
str) – Plugin name**config (
Any) – Configuration parameters
- Return type:
- Returns:
Plugin instance
- Raises:
ValueError – If plugin is not found
- get_plugin(name)[source]
Get a plugin by name.
- Parameters:
name (
str) – Plugin name- Return type:
Type[DataHubPlugin]- Returns:
Plugin class or None if not found
- Raises:
ValueError – If plugin is not found
- list_plugins()[source]
List all registered plugin names.
- Return type:
List[str]- Returns:
List of plugin names
- register(plugin_class)[source]
Register a data hub plugin.
- Parameters:
plugin_class (
Type[DataHubPlugin]) – The plugin class to register- Return type:
None