From 97fb1e6980580bdda411ae488e521fcb04f641d1 Mon Sep 17 00:00:00 2001 From: Kye Date: Mon, 11 Sep 2023 12:17:49 -0400 Subject: [PATCH] AutoScaler --- swarms/orchestrator/autoscaler.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/swarms/orchestrator/autoscaler.py b/swarms/orchestrator/autoscaler.py index dbf58b9a..43d15000 100644 --- a/swarms/orchestrator/autoscaler.py +++ b/swarms/orchestrator/autoscaler.py @@ -4,22 +4,25 @@ from time import sleep from swarms.workers.worker import Worker from swarms.utils.decorators import error_decorator, log_decorator, timing_decorator +from shapeless import shapeless # TODO Handle task assignment and task delegation # TODO: User task => decomposed into very small sub tasks => sub tasks assigned to workers => workers complete and update the swarm, can ask for help from other agents. # TODO: Missing, Task Assignment, Task delegation, Task completion, Swarm level communication with vector db +@shapeless class AutoScaler: @log_decorator @error_decorator @timing_decorator - def __init__(self, - initial_agents=10, - scale_up_factor=1, - idle_threshold=0.2, - busy_threshold=0.7, - agent=None, - ): + def __init__( + self, + initial_agents=10, + scale_up_factor=1, + idle_threshold=0.2, + busy_threshold=0.7, + agent=None, + ): self.agent = agent or Worker self.agents_pool = [self.agent() for _ in range(initial_agents)] self.task_queue = queue.Queue()