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: BaseModel

Configuration for data fitting step in a pipeline.

Parameters:
objectives: dict[str, Any]#
parameters: dict[str, Any]#
cost: dict[str, Any] | None#
optimizer: dict[str, Any] | None#
existing_parameters: dict[str, Any] | None#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ionworks.pipeline.EntryConfig(*, values)[source]#

Bases: BaseModel

Configuration for entry point in a pipeline.

Parameters:

values (dict[str, Any])

values: dict[str, Any]#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ionworks.pipeline.BuiltInEntryConfig(*, name)[source]#

Bases: BaseModel

Configuration for built-in entry point in a pipeline.

Parameters:

name (str)

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: BaseModel

Configuration for calculation step in a pipeline.

Parameters:
  • calculation (str)

  • electrode (str | None)

  • method (str | None)

  • existing_parameters (dict[str, Any] | None)

calculation: str#
electrode: str | None#
method: str | None#
existing_parameters: dict[str, Any] | None#
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: BaseModel

Configuration for validation step in a pipeline.

Parameters:
objectives: dict[str, Any]#
summary_stats: list[Any]#
existing_parameters: dict[str, Any] | None#
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: BaseModel

Configuration for a complete pipeline workflow.

Parameters:
project_id: str | None#
elements: dict[str, Any]#
name: str | None#
description: str | None#
options: dict[str, Any] | None#
classmethod validate_elements_format(v)[source]#

Validate that elements is a dict, not the old list format.

Parameters:

v (Any)

Return type:

dict[str, Any]

set_defaults()[source]#

Set project_id from environment variable if not provided and defaults.

Return type:

PipelineConfig

model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ionworks.pipeline.DataFitResponse(*, parameter_values)[source]#

Bases: BaseModel

Response from a data fitting step containing fitted parameters.

Parameters:

parameter_values (dict[str, Any])

parameter_values: dict[str, Any]#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ionworks.pipeline.CalculationResponse(*, parameter_values)[source]#

Bases: BaseModel

Response from a calculation step containing calculated parameters.

Parameters:

parameter_values (dict[str, Any])

parameter_values: dict[str, Any]#
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: BaseModel

Response from a validation step containing validation results.

Parameters:
validation_results: dict[str, Any]#
summary_stats: dict[str, list[Any]]#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ionworks.pipeline.EntryResponse(*, parameter_values)[source]#

Bases: BaseModel

Response from an entry point containing parameter values.

Parameters:

parameter_values (dict[str, Any])

parameter_values: dict[str, Any]#
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: BaseModel

Response from submitting a pipeline to the API.

Parameters:
  • id (str)

  • name (str)

  • description (str | None)

  • status (str)

  • error (str | None)

id: str#
name: str#
description: str | None#
status: str#
error: str | None#
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: BaseModel

Complete response from retrieving pipeline results.

Parameters:
result: dict[str, Any]#
element_results: dict[str, Any]#
model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ionworks.pipeline.PipelineClient(client)[source]#

Bases: object

Client 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:

PipelineSubmissionResponse

Raises:

ValueError – If the configuration is invalid.

list(project_id=None, limit=None)[source]#

List all pipelines.

Parameters:
  • project_id (str | None) – The project id to filter pipelines. If not provided, uses PROJECT_ID environment variable.

  • limit (int | None) – Maximum number of pipelines to return. If not provided, returns all pipelines (up to the API’s default limit).

Returns:

List of pipeline submission responses.

Return type:

list[PipelineSubmissionResponse]

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:

PipelineSubmissionResponse

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:

PipelineResponse

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:

PipelineSubmissionResponse

Raises:
  • TimeoutError – If timeout is reached before the pipeline completes.

  • IonworksError – If the pipeline fails and raise_on_failure is True.