zhimin-z
commited on
Commit
·
e94bca2
1
Parent(s):
d42ec54
refine
Browse files
msr.py
CHANGED
|
@@ -29,6 +29,7 @@ AGENTS_REPO = "SWE-Arena/bot_data"
|
|
| 29 |
AGENTS_REPO_LOCAL_PATH = os.path.expanduser("~/bot_data") # Local git clone path
|
| 30 |
DUCKDB_CACHE_FILE = "cache.duckdb"
|
| 31 |
GHARCHIVE_DATA_LOCAL_PATH = os.path.expanduser("~/gharchive/data")
|
|
|
|
| 32 |
LEADERBOARD_REPO = "SWE-Arena/leaderboard_data"
|
| 33 |
LEADERBOARD_TIME_FRAME_DAYS = 180
|
| 34 |
|
|
@@ -737,7 +738,6 @@ def save_leaderboard_data_to_hf(leaderboard_dict, monthly_metrics):
|
|
| 737 |
raise Exception("No HuggingFace token found")
|
| 738 |
|
| 739 |
api = HfApi(token=token)
|
| 740 |
-
filename = "swe-issue.json"
|
| 741 |
|
| 742 |
combined_data = {
|
| 743 |
'last_updated': datetime.now(timezone.utc).isoformat(),
|
|
@@ -748,21 +748,21 @@ def save_leaderboard_data_to_hf(leaderboard_dict, monthly_metrics):
|
|
| 748 |
}
|
| 749 |
}
|
| 750 |
|
| 751 |
-
with open(
|
| 752 |
json.dump(combined_data, f, indent=2)
|
| 753 |
|
| 754 |
try:
|
| 755 |
upload_file_with_backoff(
|
| 756 |
api=api,
|
| 757 |
-
path_or_fileobj=
|
| 758 |
-
path_in_repo=
|
| 759 |
repo_id=LEADERBOARD_REPO,
|
| 760 |
repo_type="dataset"
|
| 761 |
)
|
| 762 |
return True
|
| 763 |
finally:
|
| 764 |
-
if os.path.exists(
|
| 765 |
-
os.remove(
|
| 766 |
|
| 767 |
except Exception as e:
|
| 768 |
print(f"Error saving leaderboard data: {str(e)}")
|
|
|
|
| 29 |
AGENTS_REPO_LOCAL_PATH = os.path.expanduser("~/bot_data") # Local git clone path
|
| 30 |
DUCKDB_CACHE_FILE = "cache.duckdb"
|
| 31 |
GHARCHIVE_DATA_LOCAL_PATH = os.path.expanduser("~/gharchive/data")
|
| 32 |
+
LEADERBOARD_FILENAME = f"{os.path.basename(os.getcwd())}.json"
|
| 33 |
LEADERBOARD_REPO = "SWE-Arena/leaderboard_data"
|
| 34 |
LEADERBOARD_TIME_FRAME_DAYS = 180
|
| 35 |
|
|
|
|
| 738 |
raise Exception("No HuggingFace token found")
|
| 739 |
|
| 740 |
api = HfApi(token=token)
|
|
|
|
| 741 |
|
| 742 |
combined_data = {
|
| 743 |
'last_updated': datetime.now(timezone.utc).isoformat(),
|
|
|
|
| 748 |
}
|
| 749 |
}
|
| 750 |
|
| 751 |
+
with open(LEADERBOARD_FILENAME, 'w') as f:
|
| 752 |
json.dump(combined_data, f, indent=2)
|
| 753 |
|
| 754 |
try:
|
| 755 |
upload_file_with_backoff(
|
| 756 |
api=api,
|
| 757 |
+
path_or_fileobj=LEADERBOARD_FILENAME,
|
| 758 |
+
path_in_repo=LEADERBOARD_FILENAME,
|
| 759 |
repo_id=LEADERBOARD_REPO,
|
| 760 |
repo_type="dataset"
|
| 761 |
)
|
| 762 |
return True
|
| 763 |
finally:
|
| 764 |
+
if os.path.exists(LEADERBOARD_FILENAME):
|
| 765 |
+
os.remove(LEADERBOARD_FILENAME)
|
| 766 |
|
| 767 |
except Exception as e:
|
| 768 |
print(f"Error saving leaderboard data: {str(e)}")
|