Skip to content

handle generator exhaustion in the scheduler - #256

Open
sneakers-the-rat wants to merge 5 commits into
mainfrom
generator-exhaustion
Open

handle generator exhaustion in the scheduler#256
sneakers-the-rat wants to merge 5 commits into
mainfrom
generator-exhaustion

Conversation

@sneakers-the-rat

@sneakers-the-rat sneakers-the-rat commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Fix: #147 , supercedes #248

Handle generator exhaustion but in the scheduler this time, now that we have noob-core.

allows nodes to emit an Exhaustion meta-signal, which effectively allows them to self-disable. any remaining scheduled work can continue, but subsequent calls to try and run the generator once it's exhausted throws an error.

handling this in the scheduler is better than in the runners so we don't have to add a ton more state to each of the runners, and this also allows us to have a fine-grained understanding of exhaustion, where tubes that have a generator within them that can exhaust while the tube still has meaningful work to do can exist.

i just want to take a moment to laugh at what the LLM would have had us do instead, first commit in 248, which is a very concrete example of how the LLM would have done a technically working but not very general implementation: each runner needed its own implementation, it was special-cased for generators rather than something any any node would be able to emit, it wasn't finely scoped to individual nodes, wouldn't have allowed in-progress work to complete, and was just in general shitty.


📚 Documentation preview 📚: https://noob--256.org.readthedocs.build/en/256/

@codspeed-hq

codspeed-hq Bot commented Aug 4, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 10.49%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 7 untouched benchmarks
⏩ 8 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation test_kitchen_sink_run[SynchronousRunner-testing-kitchen-sink] 10.3 ms 9.3 ms +10.49%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing generator-exhaustion (4773f64) with main (d5bea76)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@coveralls

coveralls commented Aug 4, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 83.15% (+0.01%) from 83.14% — generator-exhaustion into main

@sneakers-the-rat
sneakers-the-rat marked this pull request as ready for review August 4, 2026 01:08
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.

Handle StopIteration in generator nodes

2 participants