mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-21 16:04:21 +01:00
Fixing benchmarks
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
import os
|
||||
|
||||
|
||||
def get_last_subdirectory(directory_path: str) -> str | None:
|
||||
# Get all subdirectories in the directory
|
||||
subdirs = [
|
||||
os.path.join(directory_path, name)
|
||||
for name in os.listdir(directory_path)
|
||||
if os.path.isdir(os.path.join(directory_path, name))
|
||||
]
|
||||
|
||||
# Sort the subdirectories by creation time
|
||||
subdirs.sort(key=os.path.getctime)
|
||||
|
||||
# Return the last subdirectory in the list
|
||||
return subdirs[-1] if subdirs else None
|
||||
|
||||
|
||||
def get_latest_report_from_agent_directories(
|
||||
directory_path: str,
|
||||
) -> list[tuple[os.DirEntry[str], str]]:
|
||||
latest_reports = []
|
||||
|
||||
for subdir in os.scandir(directory_path):
|
||||
if subdir.is_dir():
|
||||
# Get the most recently created subdirectory within this agent's directory
|
||||
latest_subdir = get_last_subdirectory(subdir.path)
|
||||
if latest_subdir is not None:
|
||||
# Look for 'report.json' in the subdirectory
|
||||
report_file = os.path.join(latest_subdir, "report.json")
|
||||
if os.path.isfile(report_file):
|
||||
latest_reports.append((subdir, report_file))
|
||||
|
||||
return latest_reports
|
||||
Reference in New Issue
Block a user