Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9398216
fix(pipeline): report nodes blocked by unbound sources on load-only runs
eywalker Nov 26, 2026
e50b2b0
fix(pipeline): require existing Delta directories for saved source ca…
eywalker Nov 26, 2026
b97beaf
fix(pipeline): preserve missing bindings and restore jobs without cre…
eywalker Nov 26, 2026
5ee1604
Merge remote-tracking branch 'origin/main' into eywalker/itl-1467-loa…
eywalker Nov 26, 2026
0fafe5c
fix(pipeline): keep load-only source caches read-only and preserve SQ…
eywalker Nov 26, 2026
f6be35f
fix(pipeline): pin SQLite filenames and recheck restored Delta caches
eywalker Nov 26, 2026
c733b4b
fix(sources): preserve SQLite path semantics and isolate load-only ca…
eywalker Nov 26, 2026
24fca11
fix(sources): refresh load-only cache baselines and pin Windows SQLit…
eywalker Nov 26, 2026
b1f9384
fix(sources): save text paths from path-like inputs
eywalker Nov 26, 2026
90bd194
docs(sources): document path-like inputs
eywalker Nov 26, 2026
afceb67
fix(sources): pin drive-relative SQLite filenames on Windows
eywalker Nov 26, 2026
6ead800
fix(sources): save SQLite filesystem path text
eywalker Nov 27, 2026
ef4e590
fix(sources): preserve supplied Delta paths in saved jobs
eywalker Nov 27, 2026
1025593
chore(sources): stack file path changes on PR 581
eywalker Nov 27, 2026
8b46a17
test(pipeline): cover SQLite reload across working directories
eywalker Nov 27, 2026
5584ef4
fix(sources): pin local paths without resolving symlinks
eywalker Nov 27, 2026
bad79ce
chore(tests): update the PR 581 dependency
eywalker Nov 27, 2026
819ff83
docs(sources): explain relative source cache reuse
eywalker Nov 27, 2026
dca768d
test(pipeline): make SQLite primary key tags explicit
eywalker Nov 27, 2026
73c7a43
chore(tests): merge the PR 581 test update
eywalker Nov 27, 2026
1e37a6d
docs(sources): record the filesystem path identity rule
eywalker Nov 27, 2026
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
11 changes: 11 additions & 0 deletions changelog.d/ITL-1467.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Added

- `RunSummary.skipped_unbound_sources` maps each skipped node to the unbound source slots that blocked it.

### Fixed

- Load-only run summaries report nodes skipped for unbound sources, including when no node ran.
- Loading a saved job leaves missing Delta stores, source caches, and SQLite input database files absent. A local Delta store requires directories for the saved root and any saved scope.
- Saving a loaded job retains the recorded locations of stores that could not be opened.
- Load-only runs read existing source cache rows without writing to the cache or changing the source state used by a full run.
- SQLite sources save the original filesystem path text, including for path-like objects. Restored sources preserve literal filenames, including `file:` prefixes and `..` after a symlink.
18 changes: 18 additions & 0 deletions changelog.d/ITL-1489.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### Changed

- CSV sources now derive their default ID from `os.fspath(path)` when it differs from
`str(path)`, so pass the previous `str(path)` value as `source_id` to keep using the old
ID and cache.

### Fixed

- CSV, Delta and SQLite sources accept text path-like objects such as `pathlib.Path`.
Jobs using these sources save the supplied path text as JSON strings. Delta sources
pin local paths for reads and pass URI addresses through to deltalake.

### Known limitations

- A saved job loads relative source paths from its current working directory. If a
relative path now points to a different dataset, reading the restored cached source
mixes both datasets in the original cache (ITL-1546). Use absolute source paths
when building a job you expect to load from a different working directory.
25 changes: 23 additions & 2 deletions docs/concepts/function-pods.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,11 @@ but it does compute the results that are missing. `job.run(load_only=True)` fill
with what is already stored for this run's inputs and never computes: sources are read,
operators run on the rows that reach them, each function node takes the stored results of
its inputs and skips the inputs that have none, no side effect is delivered and nothing is
written to the database. The summary counts what each node loaded and skipped:
written to the database. A cached source checks its store on each run and reads only the
rows already there. If it has no stored rows, it warns and supplies an empty input.
These cache snapshots, including those read through a derived source, leave the source's
full-run rows and modification time intact.
The summary counts what each node loaded and skipped:

```python
more_mice = mice + [{"subject_id": "mouse_04", "weight": 30.0, "height": 0.12}]
Expand Down Expand Up @@ -699,6 +703,10 @@ incomplete: a group formed after it may lack members, and the result stored for
group by an earlier run may then be loaded for it. `run_async(load_only=True)` does the same
on the asynchronous orchestrator.

A run skips unbound source slots and every node that depends on them. The summary lists those
nodes and the slots blocking each one in `summary.skipped_unbound_sources`. Bind the missing
sources with `job.bind(sources=...)` to include those nodes on the next run.

A load-only run reads only job nodes, sources and streams that neither compute nor deliver.
A pod's stream built outside the job (a function pod's, which computes when it is read, or a
side-effect pod's, which delivers) is refused with a `ValueError` before anything is read,
Expand Down Expand Up @@ -1023,6 +1031,19 @@ file saved by an earlier release (format `0.1.0` to `0.3.0`) is refused, with a
saying so. Rebuild the pipeline from code and save it again; taking older files to the
current format is the work of a separate migration tool, not of `load`.

For a saved local Delta database, `load()` requires directories for its saved root
and any saved scope. A directory can hold zero Delta tables. If either path is
missing or is a file, loading warns and
leaves the database unbound. Use
`PipelineJob.load(path, database=...)` to give the job a moved store, or
`PipelineJob.load(path, result_database=...)` for a moved separate result store.
If a cached source's Delta cache cannot be opened, its source slot stays unbound.
For a remote Delta database, the connection is deferred until the store is accessed.
Saving the loaded job retains unavailable store and source cache locations.

See [Saving and loading](pipeline-job.md#saving-and-loading) for how loading handles
SQLite source paths and write-ahead log files.

For example:

```python
Expand Down Expand Up @@ -1057,7 +1078,7 @@ loaded job cannot compute: function pods are not saved with it, so `loaded.run()
`loaded.run(load_only=True)` fills its nodes from the database instead, as for any job (see
*Loading without computing* above): the sources are read (an in-memory source must be bound
first, since its data is not saved), the rebuilt operators run, and each function node takes
the results stored for those inputs. Nodes below a source that is not available stay empty.
the results stored for those inputs. The run summary lists the nodes skipped for unbound sources.
`node.run(load_only=True)` does the same for one node and what it depends on.

```python
Expand Down
63 changes: 52 additions & 11 deletions docs/concepts/pipeline-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ A `CachedSource` is not a node of the job: its cache is kept in the cache databa
the path it was created with, whatever job reads it, so two jobs given one `CachedSource`
(or one cache database and path) share its cache.

When a saved `CachedSource` wraps a relative file path, the path is relative to the
working directory when the job is loaded. The restored source still uses the original
cache. If the path points to a different dataset there, reading the restored source
mixes rows from both datasets in that cache (ITL-1546). Use absolute source paths when
building a job you expect to load from a different working directory.

Every run reads a function node's stored tables (its result table and its pipeline
records) as they are when the node starts: results that another job, or another handle on
the same database (a second `DeltaTableDatabase` over the same directory, another
Expand Down Expand Up @@ -359,9 +365,10 @@ tag_schema=Schema({...}), data_schema=Schema({...}))`) means one Arrow type per
zones, declare the slot with Arrow schemas (`tag_schema=pa.schema([...])`). Binding a source
never changes a node's schema or where its results are stored.

A job made without sources has **unbound** slots. It can still be run: nodes that depend on
an unbound source are skipped, and `job.unbound_sources` lists what is missing. Bind later
with `job.bind(...)`:
A job made without sources has **unbound** slots. It can still run the parts of the
pipeline with bound inputs. `job.unbound_sources` lists the missing slots, and
`summary.skipped_unbound_sources` maps each skipped node to the slots blocking it.
Bind a source later with `job.bind(...)`:

```python
job_c = PipelineJob.from_pipeline(pipeline, database=database)
Expand Down Expand Up @@ -478,11 +485,40 @@ the **Nodes** table below the picture for each node's columns and status.
## Saving and loading

`job.save(path)` writes the job to a JSON file: the graph, the database's location (and the
result database's, when one was given) and how each source was configured. `PipelineJob.load(path)` reads it back, for example in a later
Python session. An `InMemoryArrowDatabase` has no location to record, so here the database
is passed again; `PipelineJob.load(path, database=...)` is also how you point a loaded job
at a database that has moved, and `PipelineJob.load(path, result_database=...)` at a result
database. The file records each node's own Arrow types, so saving types
result database's, when one was given) and how each source was configured.
`PipelineJob.load(path)` reads it back, for example in a later Python session. Pass the
original `InMemoryArrowDatabase` again to read its rows in the same process. For a
local Delta store, loading requires existing directories for the saved root and
any saved scope under it.
If the path is missing or is a file, loading warns and leaves the database unbound.
This also applies to a source's Delta cache, in which case the source slot stays
unbound. Open a moved store by passing `database=...` or `result_database=...` to
`PipelineJob.load()`. Bind a cached source with `job.bind(sources=...)` after giving
it the cache's new location. An existing directory opens even if it holds no Delta
tables. A remote Delta store's location is checked when it is accessed.

Saving a loaded job keeps the recorded locations of databases and source caches
that could not be opened, so a later load can find them when they return.

Loading a job creates no files or directories, with one exception. If an existing
SQLite database uses write-ahead logging (WAL), you may see `-wal` and `-shm`
files appear next to it. SQLite can create these working files as part of opening
the database in read-only mode. This is expected and harmless. Orcapod writes
nothing to the database. A missing SQLite database file stays absent and its
source slot stays unbound.

SQLite saves the supplied path text and uses it in the default source ID. A
relative path stays relative in the saved job, so loading the job in a different
working directory reads relative to that directory. Each live or restored source
pins its absolute filename when built and keeps using it after a working-directory
change. SQLite treats a `file:` prefix as part of the filename and follows symlinks
as it opens the file, including when a symlink is followed by `..`.

The `create_base_path` option on `DeltaTableDatabase.from_config()` is
**provisional**. Passing `False` requires the saved local root and scope directories
to exist. Job loading uses this setting.

The file records each node's own Arrow types, so saving types
every node from its inputs' types, as previewing an empty job does, and costs what that
preview costs: a pipeline whose joins keep many system-tag columns saves as slowly as it
previews.
Expand All @@ -504,9 +540,9 @@ not their code, so a loaded job cannot compute:
`as_source()` read what the database holds for the node: here the three rows of cohort A
and the one of cohort B, because both cohorts were read through a source named `"mice"`.
- `loaded.run()` raises `RuntimeError`. To compute, run the code that defines the pipeline.
- `loaded.run(load_only=True)` fills the nodes with the stored results for the sources'
current rows, computing nothing. An in-memory source such as `DictSource` is not saved
with the job, so bind it first:
- `loaded.run(load_only=True)` fills the nodes with stored results for the bound
sources' current rows. It computes nothing. The data in a `DictSource` is kept in
memory, so the summary names the skipped nodes and their blocking slot until you bind it.

```python
try:
Expand All @@ -515,6 +551,11 @@ except RuntimeError:
print("a loaded job cannot compute")
# a loaded job cannot compute

print(loaded.run(load_only=True))
# Load-only run of job 'bmi': no nodes ran.
# 'bmi': skipped (unbound sources: 'mice')
# 'mice': skipped (unbound sources: 'mice')

loaded.bind(sources={"mice": mice(cohort_a)})
summary = loaded.run(load_only=True)
print(loaded.nodes["bmi"].as_table().num_rows, summary.nodes["bmi"].not_stored)
Expand Down
19 changes: 17 additions & 2 deletions docs/concepts/sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,23 @@ hashing) and produces the final immutable stream.
| `DictSource` | `list[dict]` | Each dict becomes one (Tag, Data) pair |
| `ListSource` | `list[Any]` | Each element stored under the data column given by `name`; the tag defaults to `element_index` |
| `DataFrameSource` | Pandas or Polars `DataFrame` | Converts via Arrow |
| `CSVSource` | File path (string) | Reads CSV into Arrow |
| `DeltaTableSource` | Directory path | Reads Delta Lake table |
| `CSVSource` | CSV file path | Reads CSV into Arrow |
| `DeltaTableSource` | Table directory path | Reads Delta Lake table |

`CSVSource`, `DeltaTableSource`, and `SQLiteTableSource` accept `str` or
`os.PathLike[str]`, including `pathlib.Path`. At construction, they call `os.fspath` once
and use its result for the default source ID, the saved job configuration, and opening the
source. For example, a CSV path object whose `__fspath__` returns `data/entries.csv` and
whose `__str__` returns `display.csv` gets the default ID `csv_v1:data/entries.csv`. For
local files or tables, the source anchors a relative path to the working directory at
construction. The reader handles symlinks and `..` in that path, and later reads keep
the same working-directory anchor. A saved relative path is relative to the working
directory when the job is loaded. Use absolute source paths when building a job you
expect to load from a different working directory. If a relative path points to a
different dataset after loading, reading the restored `CachedSource` mixes rows from
both datasets in the existing source cache (ITL-1546).

Delta URIs such as `s3://bucket/table` are saved and passed to deltalake as given.

`orcapod.sources` also provides database-backed sources (`SQLiteTableSource`,
`PostgreSQLTableSource`, `SpiralDBTableSource`) and `PollingSource` for data that arrives over
Expand Down
4 changes: 3 additions & 1 deletion docs/dev/design_issues/PLT-4864-TUT1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### TUT1 — Newcomer-facing defects found while writing the tutorial
**Status:** open
**Severity:** medium
**Issue:** PLT-4864 (related: ITL-821, ITL-817)
**Issue:** PLT-4864 (related: ITL-821, ITL-817, ITL-1489)

Writing `docs/tutorial/` against the library exercised paths the existing docs did not. The
tutorial and `docs/troubleshooting.md` describe each of these as it behaves today; none is
Expand All @@ -13,6 +13,8 @@ items found then to be fixed were removed.
1. **`CSVSource` rejects a `pathlib.Path`.** `CSVSource(Path("f.csv"), tag_columns=["a"])`
raises `TypeError: 'PosixPath' object is not iterable`; the `file_path` parameter is typed
`str` and the path is used as the default `source_id`. `CSVSource(str(path), ...)` works.
**Fix (ITL-1489):** `CSVSource` accepts `pathlib.Path` directly and stores its
filesystem text, so job saving works with both given and default source names.
2. **`list(job.nodes)` order depends on `PYTHONHASHSEED`** for source nodes: a job over two
sources `units` and `sessions` lists `['units', 'sessions', 'Join', 'fn']` under some
seeds and `['sessions', 'units', 'Join', 'fn']` under others. Cosmetic, but it makes
Expand Down
75 changes: 75 additions & 0 deletions docs/dev/plans/ITL-1467.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ITL-1467 — Report nodes skipped for unbound sources and open existing stores

## Reproduced on origin/main

Run `uv run python docs/dev/scripts/itl_1467/reproduce.py` on `5eb327ad`. A job
over a saved `DictSource` slot loads with the slot unbound. With either the
original in-memory database or a Delta database supplied, the downstream
function has zero rows and the summary says “nothing to do; every node holds a
current run.” Moving a relative Delta store and loading without an override
recreates the empty root in the current working directory. The stored view
returns zero rows and warns when read.

## Run summary

`PipelineJob._prepare_run` excludes unbound slots and their descendants before
`plan_run` applies the held-node state rule. The summary sees only the remaining
graph. An empty `plan.to_run` therefore cannot establish that every node was
held.

Carry the exclusion reasons through the job's shared run preparation and
completion paths. Propagate the unbound slot names through the saved graph and
include only restored job nodes in the result. Add
`RunSummary.skipped_unbound_sources: Mapping[str, tuple[str, ...]]`, keyed by
skipped node label with sorted, unique blocking slot names. Include unbound
slots themselves. Keep `RunSummary.nodes` and `NodeRunSummary.held` as the
function and side-effect row counts for the resolvable graph.
`ran_nothing` still means that no node was run.

When there are exclusions and no node ran, use this headline:

> Load-only run of job 'small': no nodes ran.

When a partial load-only run ran nodes and had no stored-result misses, use
`every available input had a stored result.` in place of
`every input had a stored result.` The stored-result miss headline stays the
same. Under the headline, in text and notebook HTML, list the excluded nodes
by label using this wording (both the node label and each slot name are
represented as Python strings):

```text
'joined': skipped (unbound sources: 'memory')
'memory': skipped (unbound sources: 'memory')
'total': skipped (unbound sources: 'memory')
```

Use the same skip lines for partial full runs of freshly compiled jobs. The
held headline still applies when there are no exclusions.

## Reopen the existing database

`DeltaTableDatabase.from_config` always requests local root creation, including
when the read-only job loader calls it. Give Delta config resolution a way to
require an existing local root. Use it for both the saved job and separate
result databases, so a missing root takes the existing load-time warning and
override/bind path. Continue honoring explicit overrides, relative path
resolution, and remote Delta behavior. Retain creation defaults for callers
that reconstruct a store for writing. Apply the same rule when rebuilding a
saved source's Delta cache. The root and any saved scope must be directories.
A missing directory or regular file leaves the binding unavailable, and saving
the job preserves the configuration. An existing directory can open with zero
Delta tables. Open existing SQLite source files read-only; SQLite can still
make its own working files while reading an existing WAL database. Restore the
embedded blueprint directly from the decoded job instead of using a temporary
file. There is no saved-format, stored-path, or identity change.

## Verification

Write public regression tests before library edits. Exercise memory and Delta,
sync and async, using a rebuilt CSV and a skipped in-memory source with two tag
and two data columns, a function and an operator. Check the summary fields and
text, including the no-execution and partial-execution cases and an unchanged
rerun. Check directory absence in a temporary working directory after loading
a moved Delta store, the warning and the explicit override. Update the
published load and load-only documentation and add the issue changelog
fragment. Run targeted tests and the golden check without updating goldens.
16 changes: 16 additions & 0 deletions docs/dev/plans/ITL-1489.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ITL-1489 — Save jobs built from path-like sources

1. Reproduce the CSV job save error on `main` and cover text conversion and source identity
for CSV, Delta and SQLite.
2. Convert the input once at construction with `os.fspath`. Use the path text as passed
for saved paths and default source names. Pin local access paths at construction by
joining the working directory without resolving symlinks or `..`. Give Delta URIs
directly to deltalake. Stack on PR #581 for SQLite read-only restoration and preserving
unavailable source bindings when re-saving jobs.
3. Verify the source tests, lint, format, type checking and golden hashes. Update docs
examples if the pending tutorial PR has merged.

The developer confirmed on November 27, 2026, that the filesystem path determines
the default source ID. A CSV path object with `str(path) == "display.csv"` and
`os.fspath(path) == "data/entries.csv"` now defaults to `csv_v1:data/entries.csv`,
which names the file the source actually opens.
Loading
Loading