hotfix using datetime.now().strftime() to format the time on spreadsheet_swarm.py

pull/700/head
Patrick Devaney 3 weeks ago
parent af7f52bd05
commit 6aa2522a3b

@ -962,7 +962,6 @@ def create_app() -> FastAPI:
logger.info("FastAPI application created successfully") logger.info("FastAPI application created successfully")
return app return app
def run_server(): def run_server():
"""Run the API server""" """Run the API server"""
try: try:
@ -974,8 +973,7 @@ def run_server():
asyncio.run(server.startup()) asyncio.run(server.startup())
except Exception as e: except Exception as e:
logger.error(f"Failed to start API: {str(e)}") logger.error(f"Failed to start API: {str(e)}")
print(f"Error starting server: {str(e)}" print(f"Error starting server: {str(e)}") # <-- Fixed here
if __name__ == "__main__": if __name__ == "__main__":
run_server() run_server()

@ -1,6 +1,6 @@
import asyncio import asyncio
import csv import csv
import datetime from datetime import datetime # Correct import statement
import os import os
import uuid import uuid
from typing import List, Union from typing import List, Union
@ -16,15 +16,14 @@ from swarms.utils.loguru_logger import initialize_logger
logger = initialize_logger(log_folder="spreadsheet_swarm") logger = initialize_logger(log_folder="spreadsheet_swarm")
time = datetime.datetime.now().isoformat() # Corrected line
time = datetime.now().isoformat() # Use datetime.now() instead of datetime.datetime.now()
uuid_hex = uuid.uuid4().hex uuid_hex = uuid.uuid4().hex
# --------------- NEW CHANGE START --------------- # --------------- NEW CHANGE START ---------------
# Format time variable to be compatible across operating systems # Format time variable to be compatible across operating systems
formatted_time = datetime.now().strftime("%Y-%m-%dT%H-%M-%S") formatted_time = datetime.now().strftime("%Y-%m-%dT%H-%M-%S")
# Create the save file path with the formatted time and UUID hex
self.save_file_path = f"spreadsheet_swarm_{formatted_time}_run_id_{uuid_hex}.csv"
# --------------- NEW CHANGE END --------------- # --------------- NEW CHANGE END ---------------
class AgentOutput(BaseModel): class AgentOutput(BaseModel):

Loading…
Cancel
Save