Skip to content

Commit 740f8aa

Browse files
committed
update render code
1 parent 8eb61b6 commit 740f8aa

File tree

1 file changed

+47
-31
lines changed

1 file changed

+47
-31
lines changed

docs/render_submissions.py

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
)
2424
logger = logging.getLogger(__name__)
2525

26-
analysis_files_path = "/share/rush/commit0_analysis_temp"
26+
analysis_files_path = "/Users/willjiang/Desktop/ai2dev/commit0/commit0_analysis_temp"
2727

2828

2929
def get_pytest_info(path_to_logs, repo_name, branch_name):
@@ -473,7 +473,21 @@ def main(args):
473473
print(f"Saved pytest info to {submission_metrics_output_file}")
474474

475475
if args.analyze_submissions:
476+
submission_dataset = submission_dataset.add_item({
477+
'org_name': 'sweagent-commit0',
478+
'branch': 'sweagent',
479+
'display_name': 'SWE-Agent',
480+
'submission_date': '11/26/2024',
481+
'split': 'all',
482+
'project_page': 'https://github.com/sweagent-commit0'
483+
})
476484
for submission in tqdm.tqdm(submission_dataset):
485+
print(submission['project_page'])
486+
continue
487+
# if "openhands" not in submission['org_name']:
488+
# continue
489+
if "sweagent" not in submission['org_name']:
490+
continue
477491
submission_details = {"submission_info": submission}
478492
branch_name = submission["branch"]
479493
org_name = submission["org_name"]
@@ -491,8 +505,8 @@ def main(args):
491505
submission_repos_path = os.path.join(
492506
analysis_files_path, "submission_repos", org_name, branch_name
493507
)
494-
if os.path.exists(submission_repos_path):
495-
shutil.rmtree(submission_repos_path)
508+
# if os.path.exists(submission_repos_path):
509+
# shutil.rmtree(submission_repos_path)
496510
os.makedirs(os.path.join(analysis_files_path, org_name), exist_ok=True)
497511
commit0_dot_file_path = os.path.join(
498512
analysis_files_path,
@@ -501,36 +515,38 @@ def main(args):
501515
branch_name,
502516
".commit0.yaml",
503517
)
504-
for repo_log_path in glob.glob(f"{os.getcwd()}/logs/pytest/*"):
505-
if os.path.exists(os.path.join(repo_log_path, branch_name)):
506-
shutil.rmtree(os.path.join(repo_log_path, branch_name))
507-
for example in dataset:
508-
repo_name = example["repo"].split("/")[-1]
509-
if split != "all" and repo_name not in SPLIT[split]:
510-
continue
511-
clone_url = f"https://github.com/{org_name}/{repo_name}.git"
512-
clone_dir = os.path.abspath(
513-
os.path.join(submission_repos_path, repo_name)
514-
)
515-
try:
516-
clone_repo(clone_url, clone_dir, branch_name, logger)
517-
except Exception as e:
518-
submission_details[repo_name] = f"Error cloning: {e}"
519-
if os.path.exists(clone_dir):
520-
shutil.rmtree(clone_dir)
518+
519+
# for repo_log_path in glob.glob(f"{os.getcwd()}/logs/pytest/*"):
520+
# if os.path.exists(os.path.join(repo_log_path, branch_name)):
521+
# shutil.rmtree(os.path.join(repo_log_path, branch_name))
522+
# for example in dataset:
523+
# repo_name = example["repo"].split("/")[-1]
524+
# if split != "all" and repo_name not in SPLIT[split]:
525+
# continue
526+
# clone_url = f"https://github.com/{org_name}/{repo_name}.git"
527+
# clone_dir = os.path.abspath(
528+
# os.path.join(submission_repos_path, repo_name)
529+
# )
530+
# try:
531+
# clone_repo(clone_url, clone_dir, branch_name, logger)
532+
# except Exception as e:
533+
# submission_details[repo_name] = f"Error cloning: {e}"
534+
# if os.path.exists(clone_dir):
535+
# shutil.rmtree(clone_dir)
521536
# after successfully setup, write the commit0 dot file
522-
write_commit0_config_file(
523-
commit0_dot_file_path,
524-
{
525-
"dataset_name": commit0_dataset_name,
526-
"dataset_split": "test",
527-
"repo_split": split,
528-
"base_dir": submission_repos_path,
529-
},
530-
)
537+
# write_commit0_config_file(
538+
# commit0_dot_file_path,
539+
# {
540+
# "dataset_name": commit0_dataset_name,
541+
# "dataset_split": "test",
542+
# "repo_split": split,
543+
# "base_dir": submission_repos_path,
544+
# },
545+
# )
531546
# run pytests
547+
os.system("source /Users/willjiang/Desktop/ai2dev/commit0_rebuttal/.venv/bin/activate")
532548
os.system(
533-
f"commit0 evaluate --branch {branch_name} --timeout 200"
549+
f"commit0 evaluate --branch {branch_name} --timeout 500 "
534550
f"--commit0-config-file {commit0_dot_file_path}"
535551
)
536552
for example in dataset:
@@ -546,7 +562,7 @@ def main(args):
546562
submission_details, open(submission_metrics_output_file, "w"), indent=4
547563
)
548564
print(f"Saved pytest info to {submission_metrics_output_file}")
549-
565+
asdf
550566
if args.render_webpages:
551567
# Render only updated leaderboard and new submissions
552568
render_mds(args.overwrite_previous_eval)

0 commit comments

Comments
 (0)