zhimin-z
commited on
Commit
·
d42ec54
1
Parent(s):
f1f7ca4
refine
Browse files
msr.py
CHANGED
|
@@ -14,6 +14,9 @@ import requests.exceptions
|
|
| 14 |
from apscheduler.schedulers.blocking import BlockingScheduler
|
| 15 |
from apscheduler.triggers.cron import CronTrigger
|
| 16 |
import logging
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Load environment variables
|
| 19 |
load_dotenv()
|
|
@@ -90,8 +93,6 @@ def normalize_date_format(date_string):
|
|
| 90 |
return 'N/A'
|
| 91 |
|
| 92 |
try:
|
| 93 |
-
import re
|
| 94 |
-
|
| 95 |
if isinstance(date_string, datetime):
|
| 96 |
return date_string.strftime('%Y-%m-%dT%H:%M:%SZ')
|
| 97 |
|
|
@@ -187,7 +188,6 @@ def download_all_gharchive_data():
|
|
| 187 |
|
| 188 |
except Exception as e:
|
| 189 |
print(f"Error during download: {str(e)}")
|
| 190 |
-
import traceback
|
| 191 |
traceback.print_exc()
|
| 192 |
return False
|
| 193 |
|
|
@@ -496,7 +496,6 @@ def fetch_all_issue_metadata_streaming(conn, identifiers, start_date, end_date):
|
|
| 496 |
|
| 497 |
except Exception as e:
|
| 498 |
print(f"\n ✗ Batch {batch_num} error: {str(e)}")
|
| 499 |
-
import traceback
|
| 500 |
traceback.print_exc()
|
| 501 |
|
| 502 |
# Move to next batch
|
|
@@ -527,8 +526,6 @@ def sync_agents_repo():
|
|
| 527 |
raise ValueError(error_msg)
|
| 528 |
|
| 529 |
try:
|
| 530 |
-
import subprocess
|
| 531 |
-
|
| 532 |
# Run git pull with extended timeout due to large repository
|
| 533 |
result = subprocess.run(
|
| 534 |
['git', 'pull'],
|
|
@@ -769,7 +766,6 @@ def save_leaderboard_data_to_hf(leaderboard_dict, monthly_metrics):
|
|
| 769 |
|
| 770 |
except Exception as e:
|
| 771 |
print(f"Error saving leaderboard data: {str(e)}")
|
| 772 |
-
import traceback
|
| 773 |
traceback.print_exc()
|
| 774 |
return False
|
| 775 |
|
|
@@ -820,7 +816,6 @@ def mine_all_agents():
|
|
| 820 |
|
| 821 |
except Exception as e:
|
| 822 |
print(f"Error during DuckDB fetch: {str(e)}")
|
| 823 |
-
import traceback
|
| 824 |
traceback.print_exc()
|
| 825 |
return
|
| 826 |
finally:
|
|
@@ -835,7 +830,6 @@ def mine_all_agents():
|
|
| 835 |
|
| 836 |
except Exception as e:
|
| 837 |
print(f"Error saving leaderboard: {str(e)}")
|
| 838 |
-
import traceback
|
| 839 |
traceback.print_exc()
|
| 840 |
|
| 841 |
|
|
|
|
| 14 |
from apscheduler.schedulers.blocking import BlockingScheduler
|
| 15 |
from apscheduler.triggers.cron import CronTrigger
|
| 16 |
import logging
|
| 17 |
+
import traceback
|
| 18 |
+
import subprocess
|
| 19 |
+
import re
|
| 20 |
|
| 21 |
# Load environment variables
|
| 22 |
load_dotenv()
|
|
|
|
| 93 |
return 'N/A'
|
| 94 |
|
| 95 |
try:
|
|
|
|
|
|
|
| 96 |
if isinstance(date_string, datetime):
|
| 97 |
return date_string.strftime('%Y-%m-%dT%H:%M:%SZ')
|
| 98 |
|
|
|
|
| 188 |
|
| 189 |
except Exception as e:
|
| 190 |
print(f"Error during download: {str(e)}")
|
|
|
|
| 191 |
traceback.print_exc()
|
| 192 |
return False
|
| 193 |
|
|
|
|
| 496 |
|
| 497 |
except Exception as e:
|
| 498 |
print(f"\n ✗ Batch {batch_num} error: {str(e)}")
|
|
|
|
| 499 |
traceback.print_exc()
|
| 500 |
|
| 501 |
# Move to next batch
|
|
|
|
| 526 |
raise ValueError(error_msg)
|
| 527 |
|
| 528 |
try:
|
|
|
|
|
|
|
| 529 |
# Run git pull with extended timeout due to large repository
|
| 530 |
result = subprocess.run(
|
| 531 |
['git', 'pull'],
|
|
|
|
| 766 |
|
| 767 |
except Exception as e:
|
| 768 |
print(f"Error saving leaderboard data: {str(e)}")
|
|
|
|
| 769 |
traceback.print_exc()
|
| 770 |
return False
|
| 771 |
|
|
|
|
| 816 |
|
| 817 |
except Exception as e:
|
| 818 |
print(f"Error during DuckDB fetch: {str(e)}")
|
|
|
|
| 819 |
traceback.print_exc()
|
| 820 |
return
|
| 821 |
finally:
|
|
|
|
| 830 |
|
| 831 |
except Exception as e:
|
| 832 |
print(f"Error saving leaderboard: {str(e)}")
|
|
|
|
| 833 |
traceback.print_exc()
|
| 834 |
|
| 835 |
|