Repository navigation
fix(nemo-gym): preserve replica identity during routing - #3374
Merged
Merged
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
August 13, 2026 21:44
e0d1388 to
77fcf6b
Compare
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
August 13, 2026 22:04
77fcf6b to
0448453
Compare
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
August 13, 2026 22:14
0448453 to
320431d
Compare
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
3 times, most recently
from
August 14, 2026 19:32
6a314a5 to
768097e
Compare
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
2 times, most recently
from
August 31, 2026 18:11
426099c to
c876e21
Compare
ananthsub
marked this pull request as ready for review
August 31, 2026 18:11
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
September 1, 2026 06:26
c876e21 to
4e15aae
Compare
Contributor
Author
|
/ok to test 4e15aae |
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
September 1, 2026 17:42
4e15aae to
81bacdb
Compare
Contributor
Author
|
/ok to test 81bacdb |
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
September 2, 2026 05:51
81bacdb to
9d3c0cd
Compare
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
September 17, 2026 16:57
563d477 to
5cfa9c9
Compare
Contributor
Author
|
/ok to test 5cfa9c9 |
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
September 17, 2026 17:19
5cfa9c9 to
42d8219
Compare
Contributor
Author
|
/ok to test 42d8219 |
ananthsub
force-pushed
the
ansubramania/gym-shards/replication
branch
from
September 17, 2026 19:08
42d8219 to
bca06ea
Compare
Contributor
Author
|
/ok to test bca06ea |
Contributor
Author
|
/ok to test f503377 |
macandro96
previously approved these changes
Sep 18, 2026
Contributor
Author
|
/ok to test 9a74630 |
Contributor
Author
|
/ok to test 7bf4e04 |
Contributor
Author
|
/ok to test 876a971 |
Contributor
Author
|
/ok to test 4da801e |
Contributor
Author
|
/ok to test 67dbb8b |
Contributor
Author
|
/ok to test 6aa3ae9 |
Contributor
Author
|
/ok to test c3d8177 |
terrykong
previously approved these changes
Sep 21, 2026
Replica expansion and round-robin dispatch already worked, but everything downstream of dispatch named only the shard, so the replicas of one shard were indistinguishable once they reported back. That was a bug in the metrics, not just a readability gap: timings were collected into a dict keyed by shard, so the second replica overwrote the first and the shard reported as though it had done a fraction of its work. Keying by instance fixes it. Instances are labelled the way their log directories already are -- the shard name alone when it has one replica, shard/index when it has more -- so a metric, a log directory, and an error message all agree, and a shard that is not replicated reads exactly as it did before replicas existed. A failing replica now names the instance rather than the shard, since the shard is still serving rows and only one node is at fault. Also reject replicas on any placement strategy other than STRICT_SPREAD. Replicas are stamped from one merge, so they share that shard's port range and no per-replica override exists to give them separate ones. Only STRICT_SPREAD guarantees each replica its own node and therefore its own port space; elsewhere two replicas can land together and race for the same ports at spinup. Gym picks a port at random and test-binds it before use, so that surfaces as an intermittent startup failure rather than a deterministic one. Since no config can express a fix, the combination is refused at parse time rather than warned about after the placement group has been built. Signed-off-by: Ananth Subramaniam <[email protected]>
Keep local row-validation failures as ValueError while retaining shard-instance attribution for actor stream failures under the new retry path. Signed-off-by: Ananth Subramaniam <[email protected]>
Attach instance attribution as an exception note so routing remains diagnosable without breaking callers that classify transport failures by exception type. Signed-off-by: Ananth Subramaniam <[email protected]>
Match the tokenizer-free rollout call and verify instance attribution without replacing the original actor failure. Signed-off-by: Ananth Subramaniam <[email protected]>
Signed-off-by: Ananth Subramaniam <[email protected]>
Signed-off-by: Ananth Subramaniam <[email protected]>
Collaborator
|
/ok to test 524f723 |
terrykong
approved these changes
Sep 21, 2026
2 of 3 tasks
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.
Summary
Preserves physical actor identity when one logical shard has multiple replicas.
Replica expansion and round-robin dispatch already use multiple actors. Other paths still keyed results by logical shard name, so one replica could overwrite another replica's timing metrics and failures could identify only the shard.
NemoGymShardSet.instance_label()now uses the shard name when it has one replica andshard/indexwhen it has several. Actor timing metrics, log directories, and stream failures use the same label. Routing metrics zero-fill every actor instance for each prompt group, so normal metric aggregation reports the fraction of groups routed to each replica. Stream validation keeps local input errors asValueError, while transport failures identify the actor instance that failed.Replica selection remains round-robin. A future least-in-flight policy requires callers to acquire and release a dispatch lease so completed work can decrement the selected actor's load. This PR does not claim that lifecycle or hide it behind the current handle-only API.
The schema rejects
replicas > 1whenplacement_strategyis notSTRICT_SPREAD. Replicas share one merged configuration and one port range. Placing two replicas on the same node would let them race for the same ports. Colocated instances must instead be separate shards with separate port ranges.Example
These instances are reported as
tools/0,tools/1, andtools/2.Dependency
This PR targets the branch from PR #3373.