Pipeline#
Client for managing pipelines with data fitting, calculations, and validation.
Pipeline client for running parameterization workflows.
This module provides the PipelineClient for creating and managing
pipelines that combine data fitting, calculations, and validation steps
for battery model parameterization.
- class ionworks.pipeline.DataFitConfig(*, objectives, parameters, cost=None, optimizer=None, existing_parameters=None)[source]#
Bases:
BaseModelConfiguration for data fitting step in a pipeline.
- Parameters:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.EntryConfig(*, values)[source]#
Bases:
BaseModelConfiguration for entry point in a pipeline.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.BuiltInEntryConfig(*, name)[source]#
Bases:
BaseModelConfiguration for built-in entry point in a pipeline.
- Parameters:
name (str)
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.CalculationConfig(*, calculation, electrode=None, method=None, existing_parameters=None)[source]#
Bases:
BaseModelConfiguration for calculation step in a pipeline.
- Parameters:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.ValidationConfig(*, objectives, summary_stats, existing_parameters=None)[source]#
Bases:
BaseModelConfiguration for validation step in a pipeline.
- Parameters:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.PipelineConfig(*, project_id=None, elements, name=None, description=None, options=None)[source]#
Bases:
BaseModelConfiguration for a complete pipeline workflow.
- Parameters:
- classmethod validate_elements_format(v)[source]#
Validate that elements is a dict, not the old list format.
- set_defaults()[source]#
Set project_id from environment variable if not provided and defaults.
- Return type:
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.DataFitResponse(*, parameter_values)[source]#
Bases:
BaseModelResponse from a data fitting step containing fitted parameters.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.CalculationResponse(*, parameter_values)[source]#
Bases:
BaseModelResponse from a calculation step containing calculated parameters.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.ValidationResponse(*, validation_results, summary_stats)[source]#
Bases:
BaseModelResponse from a validation step containing validation results.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.EntryResponse(*, parameter_values)[source]#
Bases:
BaseModelResponse from an entry point containing parameter values.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.PipelineSubmissionResponse(*, id, name, description=None, status, error=None)[source]#
Bases:
BaseModelResponse from submitting a pipeline to the API.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.PipelineResponse(*, result, element_results)[source]#
Bases:
BaseModelComplete response from retrieving pipeline results.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ionworks.pipeline.PipelineClient(client)[source]#
Bases:
objectClient for creating and managing pipeline workflows.
- Parameters:
client (Any)
- __init__(client)[source]#
Initialize the pipeline client.
- Parameters:
client (Any) – The HTTP client to use for API requests.
- Return type:
None
- create(config)[source]#
Run a complete pipeline with the given configuration.
- Parameters:
config (dict[str, Any]) – Dictionary containing configuration for the pipeline.
- Returns:
The pipeline submission response.
- Return type:
- Raises:
ValueError – If the configuration is invalid.
- list(project_id=None, limit=None)[source]#
List all pipelines.
- Parameters:
- Returns:
List of pipeline submission responses.
- Return type:
- Raises:
ValueError – If response data is not a list or project_id is missing.
- get(job_id)[source]#
Get the pipeline response for the given job id.
- Parameters:
job_id (str) – The job id.
- Returns:
The pipeline submission response.
- Return type:
- result(job_id)[source]#
Get the result for the given job id.
- Parameters:
job_id (str) – The job id.
- Returns:
The pipeline results.
- Return type:
- wait_for_completion(pipeline_id, timeout=600, poll_interval=2, verbose=True, raise_on_failure=True)[source]#
Wait for a pipeline to complete by polling until done or timeout.
- Parameters:
pipeline_id (str) – The pipeline ID to wait for.
timeout (int, optional) – Maximum time to wait in seconds (default: 600).
poll_interval (int, optional) – Time between polls in seconds (default: 2).
verbose (bool, optional) – Whether to print status updates (default: True).
raise_on_failure (bool, optional) – Whether to raise IonworksError when pipeline fails (default: True).
- Returns:
The completed (or failed, if raise_on_failure=False) pipeline response.
- Return type:
- Raises:
TimeoutError – If timeout is reached before the pipeline completes.
IonworksError – If the pipeline fails and raise_on_failure is True.