Skip to content

feat(node): atomic try_acquire/release for race-free scheduling - #19

Merged
adnanhd merged 1 commit into
mainfrom
feat/node-atomic-reserve
Jun 24, 2026
Merged

feat(node): atomic try_acquire/release for race-free scheduling#19
adnanhd merged 1 commit into
mainfrom
feat/node-atomic-reserve

Conversation

@adnanhd

@adnanhd adnanhd commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Adds Node.try_acquire() / Node.release() so a scheduler can make the select-and-reserve step atomic. Without it, a least-loaded picker reads load(), picks, then runs — two concurrent picks can both grab a capacity-1 node (→ GPU double-booking / OOM in the torchestrator pools). try_acquire reserves under the node lock and returns whether a slot was free.

Tests: capacity respect, no-negative release, and a 20-thread contention test asserting exactly one acquire wins per slot. Lint/format/mypy clean.

Adds Node.try_acquire() (reserve a slot iff spare capacity) and release(),
so a scheduler can make select-and-reserve atomic and never double-book a
capacity-1 node under concurrent dispatch.
@adnanhd
adnanhd merged commit d573038 into main Jun 24, 2026
3 checks passed
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