Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions changelog.d/ITL-1965.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Added

- `PipelineRepository` publishes saved jobs under an optional repository name
and author, lists committed publications, and loads the latest or a specific
version with `load(name, ver=...)`. Publications carry a `pipeline_json_v1`
job hash that includes saved bindings and node identities. Run status and
other advisory run fields do not create a new version on their own.
Pass `read_only=True` to load a publication as a provisional
`SourceOnlyPipelineJob` with access to its stored node results.
6 changes: 6 additions & 0 deletions docs/api/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ blueprint; `PipelineJob` binds a pipeline to sources and a database and runs it.

::: orcapod.pipeline.SourceOnlyPipelineJob

::: orcapod.pipeline.PipelineRepository

::: orcapod.pipeline.PipelinePublication

::: orcapod.pipeline.PipelinePublicationConflictError

::: orcapod.pipeline.PipelineDiagram

::: orcapod.pipeline.LoadStatus
Expand Down
79 changes: 79 additions & 0 deletions docs/concepts/pipeline-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,85 @@ Delta matches these option names case-insensitively.
| OpenDAL Google Cloud and TOS options | `opendal.google_service_account_key`, `opendal.tos_secret_access_key`, `opendal.tos_security_token`, `opendal.volcengine_secret_access_key`, `opendal.volcengine_session_token` |
| Other OpenDAL names | `opendal.access_key`, `opendal.access_key_secret`, `opendal.account_key`, `opendal.application_key`, `opendal.client_secret`, `opendal.credential`, `opendal.delegation`, `opendal.encryption_key`, `opendal.master_key`, `opendal.password`, `opendal.sas_key`, `opendal.sas_token`, `opendal.secret_access_key`, `opendal.secret_key`, `opendal.security_token`, `opendal.service_account_key`, `opendal.session_token`, `opendal.temp_url_key`, `opendal.token` |

## Publishing jobs to a repository

`PipelineRepository` stores saved jobs in a database so you can list them by
name and load them later. The repository holds the same saved text as
`PipelineJob.save`. For persisted node results, the loaded job uses its saved
database bindings or the overrides you pass to `load`.

```python
from orcapod import PipelineRepository

repository_database = InMemoryArrowDatabase()
repository = PipelineRepository(repository_database)
publication = repository.publish(
job, name=("examples", "daily"), description="Daily BMI calculation"
)

reader = PipelineRepository(repository_database)
entries = reader.list_pipelines(prefix=("examples", "daily"))
print([(entry.name, entry.version) for entry in entries])
# [(('examples', 'daily'), 1)]

published_job = reader.load(publication.name, ver=publication.version, database=database)
rows = published_job.nodes["bmi"].as_source().as_table().sort_by("subject_id")
print(rows["subject_id"].to_pylist())
# ['mouse_02', 'mouse_03', 'mouse_11']

published_sources = reader.load(publication.name, read_only=True, database=database)
rows = published_sources.nodes["bmi"].as_table().sort_by("subject_id")
print(rows["subject_id"].to_pylist())
# ['mouse_02', 'mouse_03', 'mouse_11']
```

The repository name defaults to the job's pipeline name. Supply `name` to
publish the same saved job under another name. The loaded job keeps its
original pipeline name. Publish a changed job under the same repository name
to create the next version. If the job matches the latest publication's
whole-job hash, `publish` returns that publication with its original metadata.
Use `list_versions(name)` for the history and `load(name, ver=...)` for a
specific version. Omitting `ver` loads the latest version.
Publishing hashes the job's recorded bindings and node identities, including
its database locations. A change confined to the run ID, status, unbound-source
list, or advisory row counts keeps the same version. Changes to input rows that
leave the saved job's identities unchanged also keep the same version.

`list_pipelines(prefix=("measurements",))` matches whole leading name components.
A string such as `"bmi"` is equivalent to the one-component tuple `("bmi",)`.
Listings include the version, UTC publication time, `pipeline_json_v1` job hash,
function node labels, author, and optional description. Set `author` explicitly or let it
default to the PostgreSQL session user or authenticated SpiralDB principal.
When the backend cannot report an identity, the default is `None`.

Publish to each repository name from one writer at a time. If two writers
choose the same version, the store can reject the duplicate while adding it.
If both reach the commit step, `publish` verifies the committed version.
It returns the stored entry for identical saved snapshots and raises
`PipelinePublicationConflictError` if a different snapshot won. The losing
writer can retry to publish against the current version.
If a flush fails before committing, retry the same publication on the same
repository instance to reuse its original saved text and publication metadata.
If the write committed and only readback failed, the retry returns that
publication even if a newer version now exists.

List and load use read-only operations on committed entries in the repository's
own storage. For SpiralDB, a viewer opens the repository with
`SpiralDBKeyedConnector(..., writable=True)` to select the keyed table format
(ITL-1961, ITL-1962).

Load only publications from publishers you would trust to give you a saved job
file. As with `PipelineJob.load`, loading a publication reconstructs its saved
database bindings under the reader's authority. For example, opening a saved
local Delta binding can create its missing directory (ITL-1967).

A loaded job can run in `load_only=True` mode, and nodes with stored results
expose them through their stored views without importing the original function
modules.
Pass `read_only=True` with either the latest or a pinned version to get a
provisional `SourceOnlyPipelineJob` with stored sources, saved labels, and
the reasons other nodes are unavailable.

## How it connects to other concepts

- A job records applications of [Function Pods](function-pods.md) and
Expand Down
Loading
Loading