diff --git a/.zed/rules b/.zed/rules index 5ccd4aa78..82b1230c2 100644 --- a/.zed/rules +++ b/.zed/rules @@ -579,6 +579,11 @@ Orcapod pins the hashes it stores or embeds in names in the golden folder of the its identity, firing rule, stored tables, and downstream hashes are outside the freeze. Golden cases declare provisional=("FunctionPod with a context argument",). Ordinary function pods retain their 0.4.0 freeze. +- `PipelineJob.load(read_only=True)` is provisional (ITL-1966). It uses + `utils/provisional.warn_provisional_use` with `record_identity=False`; the load + interface introduces no hash recipe. The view lists every saved label, exposes + stored sources for available nodes, and refuses execution. It skips rebuilding + original sources and never uses stored source rows as current-run output. - Provisional sources are outside the freeze too (developer, November 21, 2026, ITL-1314: "make polling source provisional"; ITL-1331: "Let's also make DerivedSource as provisional?", both forms): `orcapod.sources.PROVISIONAL_SOURCES` diff --git a/CLAUDE.md b/CLAUDE.md index 21e096d38..d373f6392 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -590,6 +590,11 @@ Orcapod pins the hashes it stores or embeds in names in the golden folder of the its identity, firing rule, stored tables, and downstream hashes are outside the freeze. Golden cases declare `provisional=("FunctionPod with a context argument",)`. Ordinary function pods retain their 0.4.0 freeze. +- `PipelineJob.load(read_only=True)` is provisional (ITL-1966). It uses + `utils/provisional.warn_provisional_use` with `record_identity=False`; the load + interface introduces no hash recipe. The view lists every saved label, exposes + stored sources for available nodes, and refuses execution. It skips rebuilding + original sources and never uses stored source rows as current-run output. - Provisional sources are outside the freeze too (developer, November 21, 2026, ITL-1314: "make polling source provisional"; ITL-1331: "Let's also make DerivedSource as provisional?", both forms): `orcapod.sources.PROVISIONAL_SOURCES` diff --git a/changelog.d/ITL-1966.md b/changelog.d/ITL-1966.md new file mode 100644 index 000000000..f9529a420 --- /dev/null +++ b/changelog.d/ITL-1966.md @@ -0,0 +1,7 @@ +### Added + +- `PipelineJob.load(..., read_only=True)` provisionally exposes saved function results and cached operator outputs as read-only sources. The view lists every saved node label and explains when stored results are unavailable. + +### Known limitations + +- Loading a saved job may create a missing local Delta directory (ITL-1967). diff --git a/docs/api/pipeline.md b/docs/api/pipeline.md index 478a64be2..a99945d0c 100644 --- a/docs/api/pipeline.md +++ b/docs/api/pipeline.md @@ -13,6 +13,8 @@ blueprint; `PipelineJob` binds a pipeline to sources and a database and runs it. ::: orcapod.pipeline.PipelineJob +::: orcapod.pipeline.SourceOnlyPipelineJob + ::: orcapod.pipeline.PipelineDiagram ::: orcapod.pipeline.LoadStatus diff --git a/docs/concepts/pipeline-job.md b/docs/concepts/pipeline-job.md index 003b3f72b..18f3e51c0 100644 --- a/docs/concepts/pipeline-job.md +++ b/docs/concepts/pipeline-job.md @@ -126,6 +126,42 @@ outside the job over one of its own slots. Build the step from the slot inside the job, or pass the source itself. A schema-only `SourceNode` declares an independent slot for each job. +## Inspecting a saved job as sources + +Pass `read_only=True` to `PipelineJob.load()` to inspect stored results without the +original function code or source data. This provisional option warns when first used +in a process. The view refuses `run()` and `run_async()`, including load-only runs. +Opening the view and reading from it make no writes to any database table. + +```python +from pathlib import Path +from tempfile import TemporaryDirectory + +with TemporaryDirectory() as directory: + saved = Path(directory) / "bmi.json" + job.save(saved) + view = PipelineJob.load(saved, database=database, read_only=True) + print(sorted(view.labels)) + # ['bmi', 'mice'] + print(sorted(view.nodes)) + # ['bmi'] + print(sorted(view.unavailable)) + # ['mice'] + print(view.nodes["bmi"].as_table().sort_by("subject_id").to_pylist()) + # [{'subject_id': 'mouse_01', 'bmi': 1756.9444444444446}, {'subject_id': 'mouse_02', 'bmi': 2209.9999999999995}] +``` + +`view.labels` lists every saved label. `view.nodes` holds the stored sources for +function nodes with a saved run key and a result database and operators with an +existing cache. The sources preserve the identity, Arrow schemas, provenance and +row selection of `node.as_source()` and can feed another job. +`view.unavailable` explains excluded labels, such as source slots, functions with +no saved run key and uncached operators. Looking up an excluded label raises +`KeyError` with that reason. A source whose database has no matching rows raises +`RuntimeError` when read. +Pass the original database instance for in-memory results and supply connector +databases explicitly. A saved Delta database can be reopened from its configuration. + ## The database Any Orcapod database can hold a job's results. Two are used most: diff --git a/docs/dev/specs/itl-1966-source-only-load.md b/docs/dev/specs/itl-1966-source-only-load.md new file mode 100644 index 000000000..f7292afe2 --- /dev/null +++ b/docs/dev/specs/itl-1966-source-only-load.md @@ -0,0 +1,78 @@ +# Load a saved pipeline job as sources (ITL-1966) + +`PipelineJob.load(path, database=None, *, result_database=None, read_only=False)` +keeps the existing `PipelineJob` return type. With `read_only=True` it returns a +separate `SourceOnlyPipelineJob`, exported alongside `PipelineJob`. A separate +class exposes stored sources without the binding and execution interface of a job. + +The view exposes `name` as the saved name tuple and `labels` as all saved node +labels in saved order. Its read-only `nodes` mapping contains derived sources for +function nodes with a saved run key and attached result bindings and operators +with an existing cache table. Availability uses saved keys, bindings and table +metadata. Rows are read on demand. +`unavailable` maps excluded labels to reasons, including source slots, side-effect +nodes, functions with no saved run key and operators without a cache. It also +explains when a job name cannot form a default derived source ID. Looking up an +excluded label in `nodes` raises `KeyError` with +`Node '