multi agent scheduling - #27
Merged
Merged
Conversation
middle of starting. Signed-off-by: Hero <caleb@calebgj.io>
…ents now but we still need something similar for vms.
…rk and a lot of testing
testing. Signed-off-by: Hero <caleb@calebgj.io>
the caches dont seem to be working the way i expect though. need to do more testing and see if they are working correctly. I also just generally don't trust on_link_died. Signed-off-by: Hero <caleb@calebgj.io>
caches are working Signed-off-by: Hero <caleb@calebgj.io>
placces. Signed-off-by: Hero <caleb@calebgj.io>
I realized I can make this even better, and so I want to go through another iteration, but I don't want to lose this version. squash this in the actual merge. Signed-off-by: Hero <caleb@calebgj.io>
Signed-off-by: Hero <caleb@calebgj.io>
Signed-off-by: Hero <caleb@calebgj.io>
Signed-off-by: Hero <caleb@calebgj.io>
Signed-off-by: Hero <caleb@calebgj.io>
Closed
| ) -> Result<RemoteActorRef<AgentActor>, Report> { | ||
| loop { | ||
| let agent_actor_option = RemoteActorRef::<AgentActor>::lookup("agent").await?; | ||
| async fn lookup_by_actor_id( |
| self.agent_actor_cache.lock_data_cache().await.get(actor_id).map(|data| data.actor_ref.clone()) | ||
| } | ||
|
|
||
| async fn lookup_by_hostname( |
| // I am leaving it this way because I just wanted to get things working. We may need to change the way the data is stored in the future. | ||
| // My suggestions are either replacing it with a concurrent map, or using a RwLock. Either one might help, but I am not dealing with it now. | ||
| #[derive(Debug)] | ||
| pub struct ActorCache<ParentActor: Actor + RemoteActor, ChildActor: Actor + RemoteActor, Data: Clone + Send + Sync + 'static + fmt::Debug> { |
| parent_actor_ref: ActorRef<ParentActor>, | ||
| data_cache: Arc<Mutex<AHashMap<ActorId, Data>>>, | ||
| keepalive_tasks: Arc<Mutex<AHashMap<ActorId, JoinHandle<()>>>>, | ||
| actor_finder: Option<JoinHandle<()>>, |
|
|
||
| let actor_cache = ActorCache { | ||
| parent_actor_ref: parent_actor_ref.clone(), | ||
| data_cache: data_cache, |
| let actor_cache = ActorCache { | ||
| parent_actor_ref: parent_actor_ref.clone(), | ||
| data_cache: data_cache, | ||
| keepalive_tasks: keepalive_tasks, |
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
in AgentStatus Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Contributor
Author
|
partially blocked by #19. placement groups and affinity is difficult to implement without modifying VmConfig, and I rather just write the meta-manifest and then add affinity stuff to that. |
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
Signed-off-by: Caleb Jones <caleb@calebgj.io>
| /// additionally, because caleb is way too performance brained, he used integer math for the entire scoring algorithm just so we didnt have to convert to floats. | ||
| async fn schedule_agent( | ||
| &mut self, | ||
| msg: &CreateVM |
|
|
||
| #[derive(Debug)] | ||
| pub struct ActorCache<ParentActor: Actor + RemoteActor, ChildActor: Actor + RemoteActor, Data: Clone + Send + Sync + 'static + fmt::Debug> { | ||
| parent_actor_ref: ActorRef<ParentActor>, |
TheHeroBrine422
marked this pull request as ready for review
April 26, 2026 13:36
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.
the easiest/best way to do have proper supervision between remote actors is to use an in memory cache of all the actors.
kameo/libp2p's swarm mDNS stuff is not 100% stable, so we need to do heartbeats to confirm if an actor still exists.
thankfully we can use link_remote and on_link_died, we just need to make sure the link doesnt die.
we can also use this to get a cache of current status anyway.
I made the in memory actor cache generic so we can use it for whatever in the future, and it has hooks to be able to get any data you want whenever it does a heartbeat.
scheduling across multiple agents is functional, but the code still has a lot of extra features that may need to be added.
todo: