From 597095f0bf66d67875b122b5d250a0280975effd Mon Sep 17 00:00:00 2001 From: Patrick Devaney Date: Tue, 24 Dec 2024 20:21:12 -0500 Subject: [PATCH] multi platform spreadsheet_swarm, deps build clusterops from github source --- tests/structs/test_spreadsheet_swarm.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tests/structs/test_spreadsheet_swarm.py b/tests/structs/test_spreadsheet_swarm.py index 6f8c544f..4f1346c1 100644 --- a/tests/structs/test_spreadsheet_swarm.py +++ b/tests/structs/test_spreadsheet_swarm.py @@ -1,17 +1,14 @@ import os from datetime import datetime from uuid import uuid4 - # Import necessary classes from your swarm module from swarms.structs.agent import Agent from swarms.structs.base_swarm import BaseSwarm from swarms.telemetry.capture_sys_data import log_agent_data from swarms.utils.file_processing import create_file_in_folder from swarms import SpreadSheetSwarm - # Ensure you have an environment variable or default workspace dir workspace_dir = os.getenv("WORKSPACE_DIR", "./workspace") - def create_agents(num_agents: int): """ Create a list of agent instances. @@ -27,14 +24,11 @@ def create_agents(num_agents: int): agent_name = f"Agent-{i + 1}" agents.append(Agent(agent_name=agent_name)) return agents - def main(): # Number of agents to create num_agents = 5 - # Create the agents agents = create_agents(num_agents) - # Initialize the swarm with agents and other configurations swarm = SpreadSheetSwarm( name="Test-Swarm", @@ -44,35 +38,28 @@ def main(): max_loops=2, workspace_dir=workspace_dir ) - # Run a sample task in the swarm (synchronously) task = "process_data" # Ensure the run method is synchronous swarm_metadata = swarm.run(task) # Assuming this is made synchronous - # Print swarm metadata after task completion print("Swarm Metadata:") print(swarm_metadata) - # Check if CSV file has been created and saved if os.path.exists(swarm.save_file_path): print(f"Metadata saved to: {swarm.save_file_path}") else: print(f"Metadata not saved correctly. Check the save path.") - # Test saving metadata to JSON file swarm.data_to_json_file() - # Test exporting metadata to JSON swarm_json = swarm.export_to_json() print("Exported JSON metadata:") print(swarm_json) - - # Log agent data (without ClusterOps imports) + # Log agent data print("Logging agent data:") print(log_agent_data(swarm.metadata.model_dump())) - # Run the synchronous main function if __name__ == "__main__": - main() + main() \ No newline at end of file