PipelineRegistry¶
Module: flowerpower.pipeline.registry.PipelineRegistry
The PipelineRegistry manages discovery, listing, creation, and deletion of pipelines. It handles caching of pipeline data and provides methods for pipeline lifecycle management.
Initialization¶
from_filesystem¶
Create a PipelineRegistry from filesystem parameters.
This factory method creates a complete PipelineRegistry instance by: 1. Creating the filesystem if not provided 2. Loading the ProjectConfig from the base directory 3. Initializing the registry with the loaded configuration
Parameters:
- base_dir: The base directory path for the FlowerPower project
- fs: Optional filesystem instance. If None, will be created from base_dir
- storage_options: Optional storage options for filesystem access
Returns: PipelineRegistry - A fully configured registry instance
Raises: - ValueError: If base_dir is invalid or ProjectConfig cannot be loaded - RuntimeError: If filesystem creation fails
Example:
Methods¶
get_pipeline¶
Get a Pipeline instance for the given name.
This method creates a fully-formed Pipeline object by loading its configuration and Python module, then injecting the project context.
Parameters:
- name: Name of the pipeline to get
- project_context: Reference to the FlowerPowerProject
- reload: Whether to reload configuration and module from disk
Returns: Pipeline instance ready for execution
Raises: - FileNotFoundError: If pipeline configuration or module doesn't exist - ImportError: If pipeline module cannot be imported - ValueError: If pipeline configuration is invalid
Example:
new¶
Add a pipeline with the given name.
Parameters:
- name: Name for the new pipeline. Must be a valid Python identifier.
- overwrite: Whether to overwrite existing pipeline with same name. Defaults to False.
Raises: - ValueError: If the configuration or pipeline path does not exist, or if the pipeline already exists.
Example:
delete¶
Delete a pipeline.
Parameters:
- name: Name of the pipeline to delete
- cfg: Whether to delete the config file. Defaults to True.
- module: Whether to delete the module file. Defaults to False.
Returns: None
Raises: - FileNotFoundError: If the specified files do not exist.
Example:
show_pipelines¶
Print all available pipelines in a formatted table.
Example:
list_pipelines¶
Get a list of all available pipeline names.
Returns: List of pipeline names, sorted alphabetically.
Example:
pipelines (Property)¶
Get list of all available pipeline names.
Returns: List of pipeline names.
Example:
summary (Property)¶
Get complete summary of all pipelines.
Returns: Full summary including configuration, code, and project settings for all pipelines.
Example:
get_summary¶
Get a detailed summary of pipeline(s) configuration and code.
Parameters:
- name: Specific pipeline to summarize. If None, summarizes all.
- cfg: Include pipeline configuration details. Default True.
- code: Include pipeline module code. Default True.
- project: Include project configuration. Default True.
Returns: Nested dictionary containing requested summaries.
Example:
add_hook¶
Add a hook to the pipeline module.
Parameters:
- name: The name of the pipeline
- type: The type of the hook.
- to: The name of the file to add the hook to. Defaults to the hook.py file in the pipelines hooks folder.
- function_name: The name of the function. If not provided uses default name of hook type.
Returns: None
Raises: - ValueError: If the hook type is not valid
Example:
clear_cache¶
Clear cached pipelines, configurations, and modules.
Parameters:
- name: If provided, clear cache only for this pipeline. If None, clear entire cache.
Example: ```python registry.clear_cache("my_pipeline") # Clear specific registry.clear_cache() # Clear all