Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
522f642
perf(pipeline): an operator node hands the table it kept to the nodes…
Nov 22, 2026
6d331e2
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
22bbca8
wip(pipeline): ITL-1347 stage 2: nodes return output streams, arrow_s…
Nov 22, 2026
2d01d29
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
6605376
Merge branch 'eywalker/itl-1347-stage-1-operator-kept-table' into eyw…
Nov 22, 2026
303902a
perf(pipeline): F takes the stream's keys and flags system tags by va…
Nov 22, 2026
840267d
perf(pipeline): arrow_schema() lists F's columns in F's order (ITL-1360)
Nov 22, 2026
e8d5851
docs(changelog): ITL-1360 fragment
Nov 22, 2026
ab0bd08
test(pipeline): L7 for a loaded job (ITL-1360)
Nov 22, 2026
3ab16e5
refactor(streams): F's per-slice step as module functions of streams.…
Nov 22, 2026
a425c84
fix(pipeline): F equals the rows for narrower sources and raw streams…
Nov 22, 2026
b58deca
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
f068463
fix(side_effects): cast the node to StreamProtocol through object (IT…
Nov 22, 2026
5b39d5b
fix(function_node): a type disagreement fails the run with as_table's…
Nov 22, 2026
49a81d6
fix(streams): type the schema metadata row_built_provenance keeps (IT…
Nov 22, 2026
fbf8aff
fix(function_node): a failed write is reported before e9 (ITL-1360)
Nov 22, 2026
149fdd4
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
6947e71
docs(operators): state F's domain; pin its one exception and the bind…
Nov 22, 2026
6f899a1
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
335c4bc
fix(pipeline): F types source info from its tokens, over the whole ta…
Nov 22, 2026
942fe14
fix(source_node): a source's rows keep their data order (ITL-1360)
Nov 22, 2026
a658238
fix(pipeline): async held rows as planned; async outputs built on rea…
Nov 22, 2026
44d95c3
fix(streams): a description never polls; L7 compares column order (IT…
Nov 22, 2026
b9f9879
fix(pipeline): channels check source-info types as tokens; no new imp…
Nov 22, 2026
f2ddf55
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
25386a1
test(pipeline): name ITL-1366's input as difference e10 (ITL-1360)
Nov 22, 2026
6757ed6
fix(source_node): a narrower bind's rows keep main's key order; descr…
Nov 22, 2026
b5f5a18
fix(pipeline): held streams built when read and not kept; membership …
Nov 22, 2026
c6c47aa
fix(streams): an undeclared poller that has not polled is described w…
Nov 22, 2026
5a1725e
fix(pipeline): any failure of F's whole-table build falls back to the…
Nov 22, 2026
95c9d17
test(pipeline): type the held-lifetime test's streams (ITL-1360)
Nov 22, 2026
8d13df2
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
a3d90a5
fix(pipeline): rows built on read off the provably-equal routes (ITL-…
Nov 22, 2026
a31ed4b
fix(pipeline): RowsOnRead typed through rows_on_read (ITL-1360)
Nov 22, 2026
c757bc0
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
3223e64
fix(pipeline): the eager route only for library source kinds; RowsOnR…
Nov 22, 2026
6844386
fix(pipeline): type the protocol-member walk and round-4 tests (ITL-1…
Nov 22, 2026
0e357ee
fix(pipeline): eager only for a source kind's own reading; result ord…
Nov 22, 2026
14b28b9
fix(pipeline): type the result keys and token kinds for basedpyright …
Nov 22, 2026
352ce7b
fix(pipeline): eager only for exactly a proven class; result order fr…
Nov 22, 2026
36fd78a
fix(pipeline): every wrapper in a result's chain proven; eager only i…
Nov 22, 2026
dd6b7cd
fix(pipeline): eager only in the node's data context with row-typed s…
Nov 22, 2026
1c5c045
docs(pipeline): an observer that changes the pipeline mid-run is unsu…
Nov 22, 2026
1ae78fb
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
392655e
fix(pipeline): an operator node reads its result from the one computa…
Nov 22, 2026
3ceed8a
test(pipeline): no deferred-read test rebinds a source mid-run; docum…
Nov 22, 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
4 changes: 4 additions & 0 deletions .zed/rules
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,10 @@ data. The rules:
are not concerned. The refusal is for now: how an operator node logs and replays is to be
redesigned to load its cache and then apply the restriction (TODO(ITL-1219)).
- Empty data → ArrowTableSource raises ValueError("Table is empty").
- An observer only watches (developer, November 22, 2026, ITL-1369): an observer or callback
that changes the job, its nodes or its bound sources during a run is unsupported; what the
run then does is undefined and is not part of the equality with main. Preventing it (a
guard, then a read-only view) is ITL-1369; never chase a case that needs such a change.
- A side-effect job node delivers only when it runs (developer, November 13, 2026, ITL-1091):
job.run(), node.run() (state-driven, ITL-1095: a node holding a current run delivers
nothing, so clear_cache() it first to deliver again; otherwise the job run's work for that
Expand Down
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,10 @@ data. The rules:
are not concerned. The refusal is for now: how an operator node logs and replays is to be
redesigned to load its cache and then apply the restriction (`TODO(ITL-1219)`).
- Empty data → `ArrowTableSource` raises `ValueError("Table is empty")`.
- An observer only watches (developer, November 22, 2026, ITL-1369): an observer or callback
that changes the job, its nodes or its bound sources during a run is unsupported; what the
run then does is undefined and is not part of the equality with `main`. Preventing it (a
guard, then a read-only view) is ITL-1369; never chase a case that needs such a change.
- A side-effect job node delivers only when it runs (developer, November 13, 2026, ITL-1091):
`job.run()`, `node.run()` (state-driven, ITL-1095: a node holding a current run delivers
nothing, so `clear_cache()` it first to deliver again; otherwise the job run's work for that
Expand Down
41 changes: 41 additions & 0 deletions changelog.d/ITL-1360.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
### Changed

- **A job node's `execute` returns its output stream** — `execute` of a source, operator,
function and side-effect job node (and of the node protocols) returned the node's rows as
a list of (tag, data) pairs, and the sync orchestrator rebuilt a table from them for each
successor. It now returns the node's output stream, which the sync orchestrator hands to
every successor. Where that table is provably the rows' own, the node gives it
without making the rows: a node bound to an instance of exactly a library source kind
whose table is its rows (`TABLE_IS_ROWS`, never inherited by a subclass), and an
operator node whose result yields its rows from exactly an `ArrowTableStream`, in that
stream's row order (REPLAY: its stored table), each only when the rows report the
node's data context and every system tag is non-null text, as rows give it. Every other
output (a narrower bind, a subclass or another kind of bound stream or result, rows of
another data context, system tags of another type, a table the whole-table build
cannot use, a result with no row, a held node, a function or side-effect node) is the
node's rows, unchanged, whose table is built where a successor reads it, as before; a
retained one keeps only its rows once every successor has read it.
`OrchestratorResult.node_outputs` holds each node's output stream: its rows
(`iter_data()`) are the rows the node returned, and its table is built when the table
is first read (`as_table()`, a successor's edge); on the sync path a held node gives
the stream of its held rows, and the async path still sends a held node's rows as the
run's plan took them (`held_rows`). Every successor's input is unchanged: columns,
types, row order, system tags, source info, pipeline and content hashes, and an error
surfaces where and when it did. No hash, stored table or output changes. An operator
node's table is built once, for what it keeps and for every successor, instead of once
to keep and once per successor. The first two stages of the table transport between
job nodes (`docs/dev/specs/itl-1347-job-table-transport.md`).
(ITL-1347, ITL-1360)

### Added

- **`arrow_schema()` and `arrow_types_declared` on every stream** — `StreamProtocol`,
every stream and every source node state the Arrow schema of the columns a job node
passes on (user tags, system tags, data and source info), without reading, computing or
polling a row. System-tag and source-info fields are stated nullable and a source-info
field's type as the declared token type: a complete table decides both from its values,
so a consumer must not rely on them. A `null` column keeps the `null` type of a table
with no rows. `arrow_types_declared` is false where the rows decide the types: a stream
that cannot type itself without rows (an unbound slot, a `PollingSource` not yet
polled), a narrower bind, and an output held as its rows. Such a description gives the
declared names and types, in no guaranteed order. (ITL-1360)
4 changes: 3 additions & 1 deletion docs/concepts/pipeline-job.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ Among `job.run()`'s optional arguments, the tutorial's
[Part 9](../tutorial/09-when-things-go-wrong.md) demonstrates `orchestrator=` (for example
`SyncPipelineOrchestrator(error_policy="fail_fast")` to stop at the first failing row; the
default policy skips failed rows and continues) and `observer=` (`StatusObserver`,
`LoggingObserver`) to record what happened during the run. `load_only=True` fills the nodes
`LoggingObserver`) to record what happened during the run. An observer only watches: one
that changes the job, its nodes or its bound sources during a run is unsupported, and what
the run then does is undefined (ITL-1369). `load_only=True` fills the nodes
from what is already stored and computes nothing; see
[Loading without computing](function-pods.md#loading-without-computing-runload_onlytrue).

Expand Down
38 changes: 34 additions & 4 deletions docs/dev/specs/itl-1347-job-table-transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,13 @@ A run checks its sources first (ITL-1102), which polls them.
**ITL-1307 later.** When `Schema` carries its Arrow schema, `arrow_schema()` reads the two
schemas plus the system-tag and source-info fields, in one place (`StreamBase`).

Two exceptions keep today's bytes:
- **Source-info nullability** is decided by a complete Arrow table's values (F step 5).
`arrow_schema()` states those fields nullable (question 5).
Three exceptions keep today's bytes:
- **Source-info and system-tag nullability** is decided by a complete Arrow table's values
(F step 5). `arrow_schema()` states those fields nullable (question 5).
- **Source-info types** are decided by a complete Arrow table's tokens, as each row types
its tokens from their values (`_type_source_info_by_values`): a list of `None` or of
empty lists shows fewer list levels than its column declares. `arrow_schema()` states the
declared token type; consumers must not rely on it (Codex on PR #485).
- **`null` columns.** Rows carry `large_string`, and a zero-row Arrow table carries `null`, as
today (ITL-1319).

Expand Down Expand Up @@ -511,7 +515,33 @@ rows; they are kept as `main` has them, and documented below.

**No row changes a sync-path result.** On the sync path the branch equals `main` byte for
byte. Stages 1–4 hold this by construction and by L0–L5, and a lemma that fails stops its
stage.
stage. Where building a node's output from its whole table is not provably `main`'s result
(a narrower bind, a whole-table build that is unavailable, an odd stored table, a held
node, a node whose output is still its rows), the node hands on its rows and the table is
built from them by `main`'s row path where a successor reads them (`RowsOnRead`,
`at_edge`): `main`'s order, error and moment by construction (Codex on PR #485, round 3).
"Provably" is one precondition, positive and exact, never an inspection of overrides
(Codex on PR #485, final check and round 7): **the stream that holds the rows is exactly a
class whose whole-table read is its rows, nothing on the instance shadows one of that
class's methods or properties** (`reads_as_its_class`), **its rows report the node's data
context, and every system-tag field of its table is what the rows give, non-null
`large_string`** (`system_tags_as_rows_give`). It is applied in two places:

- a bound source: its class is a library source kind that itself declares
`TABLE_IS_ROWS` (`table_is_rows`);
- an operator's result: the stream it yields its rows from, followed through every
`DynamicPodStream` that is itself proven (`produced_stream`; a subclass or a wrapper
with a replaced member stops the chain), is `ArrowTableStream` in the node's data
context (its rows report that context, as `main`'s rows did), and its own `keys()` (the
keys `iter_data` reads its rows with, tags in its tag-column order) give the order.

Any subclass, replaced reader, other stream kind, other data context or other system-tag
type takes `main`'s row path. A retained output held as its rows (`RowsOnRead`) keeps
only its rows once every successor has read it (`release_built`), as `main` retained
only the rows.
An observer or callback that changes the job, its nodes or its bound sources during a run
is unsupported; what the run then does is undefined and is not part of the equality with
`main` (ITL-1369; developer, November 22, 2026).

| # | What differs | On `main` today | On the branch | Why `main` is wrong (bug, reproducer) | Approval needed |
|---|---|---|---|---|---|
Expand Down
46 changes: 41 additions & 5 deletions src/orcapod/core/nodes/function_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,27 @@ def _with_datagram_id(data: Data, datagram_id: uuid.UUID) -> Data:
)


def rows_as_output_stream(
rows: Sequence[tuple[TagProtocol, DataProtocol]], node: StreamProtocol
) -> StreamProtocol:
"""Return ``rows`` as ``node``'s output stream: the rows, built when read.

For the job nodes whose output is still their rows (function and side-effect
nodes, until ITL-1347 stages 3 and 4): ``RowsOnRead``, built by ``main``'s row path
where a successor reads it. One place imports the operator module for them.

Args:
rows: The node's output rows, in order.
node: The node.

Returns:
The node's output stream.
"""
from orcapod.core.operators.static_output_pod import rows_on_read

return rows_on_read(rows, node)


def _executor_supports_concurrent(
data_function: DataFunctionProtocol,
) -> bool:
Expand Down Expand Up @@ -2456,6 +2477,19 @@ def as_node(self) -> FunctionNode:
# Data processing
# ------------------------------------------------------------------

def _output_stream(
self, rows: list[tuple[TagProtocol, DataProtocol]]
) -> StreamProtocol:
"""The output stream of a run whose output rows are ``rows``.

The rows, their table built when read by ``main``'s row path
(``RowsOnRead``): the sync orchestrator builds it where a successor reads it,
as ``main`` rebuilt the rows there, and a leaf's is never built (ITL-1347).
"""
from orcapod.core.operators.static_output_pod import rows_on_read

return rows_on_read(rows, self)

def execute_data(
self,
tag: TagProtocol,
Expand Down Expand Up @@ -2485,7 +2519,7 @@ def execute(
error_policy: Literal["continue", "fail_fast"] = "continue",
run_id: str | None = None,
load_only: bool = False,
) -> list[tuple[TagProtocol, DataProtocol]]:
) -> StreamProtocol:
"""Execute all data from a stream: compute, persist, and cache.

For each data: fire ``on_data_start``, check the in-memory cache
Expand All @@ -2511,8 +2545,10 @@ def execute(
this way.

Returns:
Materialized list of (tag, output_data) pairs, excluding
``None`` outputs and failed data.
The node's output stream: its output rows (no row for a ``None`` output or
a failed row) as the table ``_rows_to_table`` builds from them, with this
node's identity (``StaticOutputOperatorPod._materialize_upstream``). The sync
orchestrator hands it to every successor (ITL-1347, stage 2).

Raises:
RuntimeError: If the node was loaded by ``PipelineJob.load`` and so
Expand All @@ -2524,7 +2560,7 @@ def execute(
from orcapod.pipeline.observer import NoOpObserver

if load_only:
return self._execute_load_only(input_stream, observer)
return self._output_stream(self._execute_load_only(input_stream, observer))
if self._function_pod is None:
raise self._cannot_compute_error()

Expand Down Expand Up @@ -2653,7 +2689,7 @@ def execute(
self.clear_cache()
raise

return output
return self._output_stream(output)

def _empty_data_cache_hit(
self, tag: TagProtocol, data: EmptyData, base_entry_id: bytes
Expand Down
98 changes: 86 additions & 12 deletions src/orcapod/core/nodes/operator_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,20 @@
)
from orcapod.channels import Channel, ChannelClosed, ReadableChannel, WritableChannel
from orcapod.config import OrcapodConfig
from orcapod.core.operators.static_output_pod import StaticOutputOperatorPod
from orcapod.core.operators.static_output_pod import (
RowBuiltFormUnavailable,
StaticOutputOperatorPod,
produced_stream,
rows_on_read,
)
from orcapod.core.streams.arrow_table_stream import ArrowTableStream
from orcapod.core.streams.base import (
ZERO_ROW_INPUT_COLUMNS,
StreamBase,
check_head_size,
reads_as_its_class,
short_stream_repr,
system_tags_as_rows_give,
)
from orcapod.core.streams.view import (
JOB_NODE_NOT_RUN_NOTE,
Expand Down Expand Up @@ -1645,7 +1652,7 @@ def execute(
*input_streams: StreamProtocol,
observer: ExecutionObserverProtocol | None = None,
load_only: bool = False,
) -> list[tuple[TagProtocol, DataProtocol]]:
) -> StreamProtocol:
"""Execute input streams: compute, persist, and cache.

Args:
Expand All @@ -1657,7 +1664,10 @@ def execute(
as in any run.

Returns:
Materialized list of (tag, data) pairs.
The node's output stream: its rows as the table ``_rows_to_table`` builds
from them (``StaticOutputOperatorPod._output_stream``), with this node's
identity, built from the operator's result table without making rows
(ITL-1347, stage 2). The sync orchestrator hands it to every successor.

Raises:
ValueError: If the node caches (``LOG`` or ``REPLAY``) and a source
Expand Down Expand Up @@ -1685,20 +1695,84 @@ def execute(
# Check REPLAY cache first
cached_output = self.get_cached_output()
if cached_output is not None:
output = list(cached_output.iter_data())
try:
output = StaticOutputOperatorPod._output_stream(
cached_output.as_table(columns=ZERO_ROW_INPUT_COLUMNS),
cached_output.keys(),
self,
)
except RowBuiltFormUnavailable:
# A stored table F cannot build from: its rows, built when read,
# as main handed them on (ITL-1347).
output = rows_on_read(cached_output.iter_data(), self)
ctx_obs.on_node_end(node_label, node_hash)
return output

# Compute
result_stream = self._operator.process(*input_streams)

# Materialize
output = list(result_stream.iter_data())

# Cache, in row order with or without rows (ITL-1131, ITL-1133)
self._cached_output_stream = StaticOutputOperatorPod._kept_output(
result_stream, output
)
produced = produced_stream(result_stream)

output: StreamProtocol
# The result's table, as the table built from its rows would be, without
# making the rows (ITL-1347, stage 2), when it provably is its rows: the
# stream holding them is exactly an ``ArrowTableStream`` in the node's
# data context, whose system tags are what the rows give.
result_table: pa.Table | None = None
if (
reads_as_its_class(produced, ArrowTableStream)
and produced.data_context_key == self.data_context_key
):
# From the captured stream: reading the wrapper again could run the
# operator again (an upstream with no modified time), so the table,
# the keys and the gate describe one computation.
result_table = produced.as_table(columns=ZERO_ROW_INPUT_COLUMNS)
if not system_tags_as_rows_give(result_table.schema):
result_table = None
if result_table is None:
# Otherwise (a custom stream kind, a replaced reader, rows of another
# data context, system tags the rows type otherwise): main's own row
# path, its rows read once and handed on unchanged, its table built
# where a successor reads it (ITL-1347).
# The rows of the computation already made (``produced``), read once.
rows = list(produced.iter_data())
self._cached_output_stream = StaticOutputOperatorPod._kept_output(
result_stream, rows
)
output = rows_on_read(rows, self)
else:
# An exact ``ArrowTableStream``'s ``keys()`` are the keys its rows are
# read with (``iter_data``), so they are the order of the result's
# rows, to any depth of composition, never the prediction.
keys = produced.keys()
tag_keys = keys[0]
data_tags = data_tag_names(*keys)

# Cache, in row order with or without rows (ITL-1131, ITL-1133).
if result_table.num_rows:
try:
kept_table = StaticOutputOperatorPod._row_built_form(
result_table, keys
)
except RowBuiltFormUnavailable as error:
StaticOutputOperatorPod._raise_as_rows_do(
produced.iter_data(), error
)
self._cached_output_stream = ArrowTableStream(
kept_table, tag_columns=tag_keys, data_tags=data_tags
)
# The output stream, built once the node holds its run (as the
# sync orchestrator built a successor's input after ``execute``
# returned).
output = StaticOutputOperatorPod._as_upstream_stream(
kept_table, tag_keys, data_tags, self
)
else:
self._cached_output_stream = (
StaticOutputOperatorPod._zero_rows_in_row_order(result_stream)
)
# Its zero-row form is derived where a successor reads it, as on
# main: the operator is not called again here (``RowsOnRead``).
output = rows_on_read([], self)

self._update_modified_time()

Expand Down
Loading
Loading