Skip to content

exec: write output notebook incrementally after each cell#14

Merged
anish749 merged 1 commit into
mainfrom
incremental-output-writes
Mar 30, 2026
Merged

exec: write output notebook incrementally after each cell#14
anish749 merged 1 commit into
mainfrom
incremental-output-writes

Conversation

@anish749

Copy link
Copy Markdown
Owner

Problem

The output notebook (_out.ipynb) was only written once after all cells finished executing. If the process was killed mid-run (SIGKILL, OOM, machine crash), all collected results were lost.

Solution

Flush the output notebook to disk after each cell completes instead of batching writes at the end. The output base notebook is now loaded before the cell loop, and a callback writes results incrementally as they arrive.

Context

The session notebook already used incremental writes via NotebookWriter.flush(). This brings the --file execution path to parity — partial results now survive process crashes, not just Ctrl+C and cell errors.

Instead of collecting all results in memory and writing the output
notebook once at the end, flush results to disk after each cell
completes. This ensures partial results survive if the process is
killed mid-execution.
@anish749 anish749 merged commit 3f539ec into main Mar 30, 2026
1 check passed
@anish749 anish749 deleted the incremental-output-writes branch March 30, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant