Skip to content

Rename PortCursors to PortAllocator and key it by the node's ip - #1871

Open
fzyzcjy wants to merge 1 commit into
tom/refactor-miles/op5-6from
tom/refactor-miles/op5-7
Open

Rename PortCursors to PortAllocator and key it by the node's ip#1871
fzyzcjy wants to merge 1 commit into
tom/refactor-miles/op5-6from
tom/refactor-miles/op5-7

Conversation

@fzyzcjy

@fzyzcjy fzyzcjy commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Part of #1837

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch from 1a69a48 to cd1e679 Compare July 28, 2026 13:31
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch 2 times, most recently from 97cf640 to c98cff5 Compare August 3, 2026 23:45
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch from 08f925f to 72e9dc1 Compare August 4, 2026 00:39
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch from c98cff5 to 6e7d155 Compare August 4, 2026 00:39
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch from 72e9dc1 to b5d7950 Compare August 4, 2026 06:58
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch 2 times, most recently from 7637998 to 82c96d8 Compare August 6, 2026 07:03
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch 2 times, most recently from 7e18bb5 to b58d9bb Compare August 10, 2026 06:08
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch 2 times, most recently from 0294ac2 to 2aba180 Compare August 10, 2026 16:07
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch from b58d9bb to 00e79b2 Compare August 10, 2026 16:07
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch from 2aba180 to 063dbde Compare August 10, 2026 16:34
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch 2 times, most recently from 25fba13 to 5ac66ca Compare August 12, 2026 02:48
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch from 063dbde to 1c68f0e Compare August 12, 2026 02:48
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch from 5ac66ca to cba2bd6 Compare August 12, 2026 14:31
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch 2 times, most recently from 5a2046a to bd8fd4a Compare August 12, 2026 23:56
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch from bd8fd4a to a15b461 Compare August 13, 2026 01:13
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch from 80b8bb3 to 6c8cf30 Compare August 13, 2026 03:25
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch 2 times, most recently from 359da2b to ee3d09b Compare August 13, 2026 06:01
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch from 6c8cf30 to ebd2ff3 Compare August 13, 2026 06:01
The cursor dict was keyed by ``node_index = local_rank // num_engines_per_node``
-- an arithmetic proxy for "which machine", derived from an assumed rank layout
and restarting at zero for every group. The node ip is the machine's actual
identity and needs no such assumption.

Nothing misbehaves today: the dict is rebuilt on every call, and groups are kept
apart by ``next_base_port()``, one high-water mark taken across all nodes. That
guard is safe but coarse -- it drags every node's cursor up to the busiest
node's. The rekey is what makes a per-node cursor mean anything once the
allocator becomes shared and long-lived: keyed by a per-group index, one shared
dict would alias two groups' distinct machines onto a single cursor, and
conversely split one machine into two cursors whenever the two groups computed
different indices for it.

Reading the ip costs one extra ``_get_current_node_ip_and_free_port`` round trip
per node.
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-6 branch from ebd2ff3 to 8ed35a7 Compare August 14, 2026 04:46
@fzyzcjy
fzyzcjy force-pushed the tom/refactor-miles/op5-7 branch from ee3d09b to 729ed18 Compare August 14, 2026 04:46

@guapisolo guapisolo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved in the #1837 stack context. This cleanly migrates port-allocation identity from group-local indices to node IPs; #1872 completes the shared allocator mechanics before the #2176 safe-merge checkpoint, and the behavior remains present through the checked chain tip.

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.

2 participants