Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
Only Push to gdirve correct timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
waynehamadi committed Aug 16, 2023
1 parent 26d62da commit 906c683
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion agbenchmark/reports/ReportManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def end_info_report(self, config: Dict[str, Any]) -> None:
"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(timezone.utc).isoformat(),
"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",
Expand Down
2 changes: 1 addition & 1 deletion agbenchmark/start_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)

CURRENT_DIRECTORY = Path(__file__).resolve().parent
BENCHMARK_START_TIME = datetime.now(timezone.utc).isoformat()
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
Expand Down
7 changes: 7 additions & 0 deletions send_to_googledrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from dotenv import load_dotenv
from oauth2client.service_account import ServiceAccountCredentials

import re

# Load environment variables from .env file
load_dotenv()

Expand Down Expand Up @@ -109,7 +111,12 @@ def process_test(
# 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)
Expand Down

0 comments on commit 906c683

Please sign in to comment.