Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Only push to gdrive correct timestamps (#318)

merwanehamadi6b9a75f78668
diff --git a/agbenchmark/reports/ReportManager.py b/agbenchmark/reports/ReportManager.py
index 69b61c4d63..18db144f17 100644
--- a/agbenchmark/reports/ReportManager.py
+++ b/agbenchmark/reports/ReportManager.py
@@ -2,7 +2,7 @@ import json
import os
import sys
import time
-from datetime import datetime
+from datetime import datetime, timezone
from pathlib import Path
from typing import Any, Dict
@@ -63,7 +63,7 @@ class ReportManager:
"command": command.split(os.sep)[-1],
"benchmark_git_commit_sha": BENCHMARK_GIT_COMMIT_SHA,
"agent_git_commit_sha": AGENT_GIT_COMMIT_SHA,
- "completion_time": datetime.now().strftime("%Y-%m-%d-%H:%M"),
+ "completion_time": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S+00:00"),
"benchmark_start_time": BENCHMARK_START_TIME,
"metrics": {
"run_time": str(round(time.time() - self.start_time, 2)) + " seconds",
diff --git a/agbenchmark/start_benchmark.py b/agbenchmark/start_benchmark.py
index b9526e95fc..2568546f40 100644
--- a/agbenchmark/start_benchmark.py
+++ b/agbenchmark/start_benchmark.py
@@ -3,7 +3,7 @@ import json
import os
import subprocess
import sys
-from datetime import datetime
+from datetime import datetime, timezone
from pathlib import Path
from typing import Any, Optional
@@ -18,7 +18,7 @@ from agbenchmark.utils.utils import (
)
CURRENT_DIRECTORY = Path(__file__).resolve().parent
-BENCHMARK_START_TIME = datetime.now().strftime("%Y-%m-%d-%H:%M")
+BENCHMARK_START_TIME = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S+00:00")
if os.environ.get("HELICONE_API_KEY"):
HeliconeLockManager.write_custom_property(
"benchmark_start_time", BENCHMARK_START_TIME
diff --git a/send_to_googledrive.py b/send_to_googledrive.py
index f441952682..aa9a6b09dc 100644
--- a/send_to_googledrive.py
+++ b/send_to_googledrive.py
@@ -7,6 +7,8 @@ import pandas as pd
from dotenv import load_dotenv
from oauth2client.service_account import ServiceAccountCredentials
+import re
+
# Load environment variables from .env file
load_dotenv()
@@ -109,7 +111,12 @@ for agent_dir in os.listdir(base_dir):
# Load the JSON data from the file
with open(report_path, "r") as f:
data = json.load(f)
+ benchmark_start_time = data.get("benchmark_start_time", "")
+ # Check if benchmark_start_time complies with the required format
+ pattern = re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+00:00')
+ if not pattern.fullmatch(benchmark_start_time):
+ continue # Skip processing this report if the date is not in the correct format
# Loop through each test
for test_name, test_info in data["tests"].items():
process_test(test_name, test_info, agent_dir, data)