Improve scheduler actor - #63
Open
TheHeroBrine422 wants to merge 36 commits into
Open
Conversation
this was done for two reasons: 1) the vm and agent actor caches have slightly different requirements, specifically around keys (actorid vs vmid) 2) the scheduler needs direct control of the cache so the cache can be updated in response to messages it forwards. being possibly up to 1 second out of date in this data could cause problems. In theory the scheduler could update the generic cache, but I don't think using a generic cache if we need to modify it directly anyway really makes sense. Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
scheduler affinity Signed-off-by: Caleb Jones <caleb@calebgj.io>
…k/odorobo into caleb/fix-scheduler-actor-cache
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Contributor
There was a problem hiding this comment.
clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
this also fixes an issue where if a VM is never linked (ex: it didnt boot) it would never be removed from the caches.
TheHeroBrine422
marked this pull request as ready for review
July 16, 2026 20:23
Member
|
i will look at this when i get back home. have you run it through clippy? |
halfcyan
previously approved these changes
Jul 17, 2026
korewaChino
previously approved these changes
Jul 20, 2026
halfcyan
requested changes
Jul 31, 2026
halfcyan
previously approved these changes
Aug 17, 2026
TheHeroBrine422
commented
Aug 18, 2026
| data_cache | ||
| .entry(vmid) | ||
| .and_modify(|entries| { | ||
| if let Some(entry) = entries.iter_mut().find(|entry| { |
Contributor
Author
There was a problem hiding this comment.
this code is hard to read.
| data_cache.alter(&actor_ref.id(), |_, mut v| { | ||
| v.data = data; | ||
|
|
||
| v.extended_vm_set.retain(|vmid| v.data.vms.contains(vmid)); |
Contributor
Author
There was a problem hiding this comment.
this has two issues.
-
should a vm stay in the extended vm set if we sent CreateVM, then sent GetAgentStatus, GetAgentStatus got there first and so its not in the agent status BUT it will be in a moment when CreateVM is received.
-
if we do want to reset it entirely, we should just remake the set from the iter directly instead of deleting and then adding things weirdly.
- Pending VM CPU/RAM is now reserved immediately, preventing back-to-back creates from oversubscribing an agent. - Exact-fit capacity is accepted by using `<=`. - VM cache ownership is optional for restart-discovered VMs instead of incorrectly using the VM actor ID as an agent ID. - Unconfirmed VM cache entries expire even if an actor reference was briefly found, fixing the create/stop discovery leak. - Agent affinity state is rebuilt from current status plus active scheduler reservations, preventing stale VM IDs while preserving create-race safety. - Removed the hard-coded required affinity rule from `odoroboctl create`, allowing creation in an empty cluster. - Fixed the clippy warning and added reservation/capacity regression tests.
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.
intended changes for this PR
All that is left is testing and review by another maintainer.