Merge pull request #613 from sambhavnoobcoder/ConcurrentWorkflows

Fix AttributeError in ConcurrentWorkflow by Properly Initializing Tasks List
pull/617/head
Kye Gomez 3 months ago committed by GitHub
commit 1271980051
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -112,6 +112,7 @@ class ConcurrentWorkflow(BaseSwarm):
return_str_on: bool = False, return_str_on: bool = False,
agent_responses: list = [], agent_responses: list = [],
auto_generate_prompts: bool = False, auto_generate_prompts: bool = False,
max_workers: int = None,
*args, *args,
**kwargs, **kwargs,
): ):
@ -132,9 +133,12 @@ class ConcurrentWorkflow(BaseSwarm):
self.return_str_on = return_str_on self.return_str_on = return_str_on
self.agent_responses = agent_responses self.agent_responses = agent_responses
self.auto_generate_prompts = auto_generate_prompts self.auto_generate_prompts = auto_generate_prompts
self.max_workers = max_workers or os.cpu_count()
self.tasks = [] # Initialize tasks list
self.reliability_check() self.reliability_check()
def reliability_check(self): def reliability_check(self):
try: try:
logger.info("Starting reliability checks") logger.info("Starting reliability checks")
@ -389,6 +393,9 @@ class ConcurrentWorkflow(BaseSwarm):
ValueError: If an invalid device is specified. ValueError: If an invalid device is specified.
Exception: If any other error occurs during execution. Exception: If any other error occurs during execution.
""" """
if task is not None:
self.tasks.append(task)
try: try:
logger.info(f"Attempting to run on device: {device}") logger.info(f"Attempting to run on device: {device}")
if device == "cpu": if device == "cpu":
@ -406,7 +413,6 @@ class ConcurrentWorkflow(BaseSwarm):
count, self._run, task, img, *args, **kwargs count, self._run, task, img, *args, **kwargs
) )
# If device gpu
elif device == "gpu": elif device == "gpu":
logger.info("Device set to GPU") logger.info("Device set to GPU")
return execute_on_gpu( return execute_on_gpu(

Loading…
Cancel
Save