Repository navigation
flow: losses in a flow's shuffle (PR 2 of the keyed-partitions plan) - #177
Merged
Merged
Conversation
A loss before a Partition's barrier reads the input again: a partition task's own, or a piece's, found when the barrier checks every piece. The rerun releases every piece of the attempt. A loss after the barrier fails the flow, naming the operator and the partition. FlowStats gains each partition's bytes, counted at the barrier from Client.size_of. A restarted head adopting a re-sent TaskMany now keeps all of its results, not only the first (found by the head-restart gate). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017TycsyUqdnuDeZrYc3z6wV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 2 of "Keyed partitions in flows (plan, 2026-11-29)" in DESIGN.md: losses.
What was built
FlowRun._partition) turns a lost piece (is_loss) into a rerun of that input, and keeps raising for any other error. A partition task's own loss (its worker gone while it ran) reruns its input too, from_advance's scan of finished tasks. Both count in thePartition'srerunsand stay within the flow'sretries._rerunnow also takes the input's partition task out of the running list (abandoned, released once settled) and releases every piece of that attempt, pieces 1 toparts-1included._advance(reducers and laterMaps) and fromnext's partition branch:operator 2 (Reduce m::merge) failed on partition 1: input failed: result … lost: …; lost after the reducers started, which a flow doesn't rerun: run the flow again. Everything is released, as before.stats:FlowStats.partition_bytes(andunsized_pieces), counted when the barrier passes, from the newClient.size_of. Inline pieces' sizes are known without fetching too, because the driver keeps their bytes; stored ones come from the located frame.TaskManywhose results a rejoining worker had already reported delivered only the first result and dropped the others. The partition flow inhead_restart.shfailed with "an input was released before this task ran" in 3 of 4 runs before the fix.Partitionrun the same code as before (_rerun's and the barrier's new branches arecomptime if Self.P >= 0).FlowStats.write_toprints nothing new for them. No public name or signature changed;FlowStats.__init__gained two defaulted arguments.Gate and tests
tests/flow_loss.shnow runs three cases:map(the old one),partition(the worker with the most pieces, other than the one whose partition task waits, is killed before the barrier: exact, with reruns at thePartition), andreduce(killed while the first of one-at-a-time reducers waits: the flow fails with the message, and the head holds nothing).tests/head_restart.sh: a group-by flow on two workers of a new groupshuffle. The head is killed while the driver is inside itsnext, before its barrier; it must come out exact, and the driver checks that the restart happened during thatnext.tests/cli.shstarts twoshuffleworkers for the same driver.tests/test_flow_partition.mojo: a partition task that kills its worker once reruns its input, with exact results; one that kills it every time fails after its retries; the group-by test checkspartition_bytes.Verified
flow_loss.sh6/6 passes (all three cases each time),head_restart.sh6/6,test_flow_partition,test_flow,test_shuffle, format-check, and the fullpixi run test(results in a comment below).Deviations (recorded in DESIGN.md, "PR 2, as built")
🤖 Generated with Claude Code
https://claude.ai/code/session_017TycsyUqdnuDeZrYc3z6wV