ionworks-api Python package exposes client.pipeline for running and managing pipelines. For installation and authentication, see the Python API client page.
Submitting a pipeline
client.pipeline.create() accepts either an iws.Pipeline schema instance or the dict returned by .to_config(). Schema instances are validated locally before submission, so shape errors surface immediately.
Serializing a pipeline to JSON
Use.to_config() when you want to inspect, cache, or transport the pipeline payload as JSON — for example to review it before submission, commit it to version control, or hand it off to another process.
Overriding submission metadata
create() accepts optional project_id, name, description, and options kwargs that override any values carried on the schema:
project_id is omitted, the client falls back to the default configured on Ionworks(...) or the IONWORKS_PROJECT_ID environment variable.
Data references in pipelines
Use these prefixes to reference data sources in pipeline configs:A See pinning a measurement to a time window.
db: measurement that is still being recorded grows as rows are appended,
so an unpinned config reads more data on a later run than it did on the
first. Add a time_range alongside data to pin the run to a fixed window
of elapsed seconds:The
folder: scheme expects a directory containing time_series and
steps files. Both .parquet and .csv are supported, and parquet is
preferred when both are present. For example, a folder with
time_series.parquet and steps.parquet (or .csv) loads correctly.PyBaMM model support
You can hand an objective a PyBaMM model object directly instead of naming a built-in model. It is serialized for you when the config is built — there is no registration step and no string name to look up.Waiting for completion
raise_on_failure=False to get the failed submission response back instead of raising when the pipeline errors out.
Retrieving results
Each element returns a typed result object. Ask the pipeline for an element by the name you gave it, index the fitted parameters, and plot:OptimizationResult,
PosteriorResult, ValidationResult and so on, all sharing a BaseResults
base — so parameter_values, to_config() and the plots work the same way on
any of them. result.results returns every element at once, keyed by name.
Plotting needs the optional extra: pip install ionworks-schema[plot].
The overlay and the optimizer trace are fetched on first access, not when the
result is built, so reading
parameter_values costs nothing extra.result.result for the
pipeline’s final parameter values and result.element_results for per-element
dicts, keyed exactly as you passed them to iws.Pipeline(elements=...).
Element metadata
Elements write large fields (a validation’s full per-point comparison, for example) to a metadata blob rather than intoelement_results. The result object
already reads what it needs from there; fetch the blob yourself only for fields
it does not expose:
Data-fit parameter trace
fit.plot_trace() draws the optimizer’s per-iteration progress, and fit.trace
gives the raw records if you would rather plot them yourself — see
Inspecting the parameter trace
for the schema. Neither needs the element’s job ID; the result object resolves
that for you.
Data-fit model-vs-data plot data
fit.plot_fit_results() above covers the common case. Drop to
client.job.get_plot_data when you want the raw traces — to feed your own
plotting stack, or to refetch detail as a user zooms. It returns the
model-vs-data traces for a data-fit job
— the same overlay Studio renders on the fit’s results page. A data-fit
re-runs a validation on its best-fit parameters and stores the overlay in its
own metadata, so you can fetch it directly from the fit’s job ID without
adding a separate Validation element or parsing the raw metadata blob.
The endpoint is keyed by job ID, which the elements listing carries:
max_points points per series
(default 2000, range 100–80000). For semantic zoom — refetching more
detail as a user zooms in — pass x_min and x_max set to the current
viewport:
Listing pipelines
list() accepts id, name, description, status, created_by_email,
created_at and updated_at (plus their _gt / _lt range variants),
order_by, order, limit, and offset.
The result is a PaginatedList: it behaves like a list — iterate it, index it,
call len() on it — and also carries .items, .count, and .total, where
.total counts every matching pipeline rather than the rows in this page.
Getting a single submission
SimplePipeline
ASimplePipeline is a lightweight alternative to Pipeline for workflows with at most one expensive element — a single DataFit, ArrayDataFit, or Validation. It runs fire-and-forget and returns a flat result containing parameter_values, cost, and (for validation) summary_stats. Submit and poll it through client.simple_pipeline.
Building the config
SimplePipeline inherits everything from Pipeline and adds client-side validation that rejects configs with more than one expensive element:
If you pass more than one
DataFit, ArrayDataFit, or Validation element, SimplePipeline raises a ValueError immediately — no need to wait for a server-side rejection.Submitting and polling
client.pipeline.wait_for_completion, this also accepts poll_interval (seconds between polls, default 2), verbose (print status updates, default True), and raise_on_failure (default True; pass False to get the failed response back instead of raising) keyword arguments, and returns once the run reaches a terminal status — completed, failed, or canceled.
client.simple_pipeline.create() mirrors client.pipeline.create() — it accepts either an iws.SimplePipeline schema instance or the dict returned by .to_config(). Prefer the schema instance: you don’t need to call .to_config() yourself, and shape errors surface locally when you build the schema object. A raw dict is forwarded as-is, so a malformed dict is only rejected server-side as an HTTP 422.
Listing, filtering, and sorting
list returns a PaginatedList, the same type client.pipeline.list()
returns: it behaves like a list and also carries items, count, and
total.
String filters accept either an exact value or an operator-prefixed
expression such as ilike.%foo% (case-insensitive contains) or
in.(completed,failed) (match any of a set).
Execution options
data_fit elements in simple pipelines are evaluated in parallel using
the same distributed worker pool as regular pipelines. No extra
configuration is required — set optimizer.population_size as usual
and the server fans the population evaluations out across workers.options dict to create to control runtime execution behavior
for the submitted pipeline. Options are submission metadata — they affect
how the server runs the job but are not stored as part of the pipeline
config.
options (along with project_id, name, or
description) directly in the config dict — create lifts them out of
the config before submission. Arguments passed explicitly to create
take precedence over values found in the config.
Updating, cancelling, and deleting
Handling errors
Validation pipelines
SimplePipeline also supports a single Validation element. The result includes summary_stats alongside parameter_values.
result.result_object gives the same run as a typed result object, with the
plot_fit_results() / plot_trace() methods and the lazy overlay / series
channels described under Pipeline results:
End-to-end example
For more end-to-end examples (entry-only, calculation-only, datafit, validation), see
packages/ionworks-api/examples/pipeline/ in the SDK repo.