[td] try catch exception, do not run td if not results (#138087)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/138087
Approved by: https://github.com/wdvr
This commit is contained in:
Catherine Lee 2024-10-16 18:04:25 +00:00 committed by PyTorch MergeBot
parent dabe2a3c3b
commit f173623bb2
2 changed files with 11 additions and 4 deletions

View File

@ -1769,6 +1769,8 @@ def main():
selected_tests = get_selected_tests(options)
test_prioritizations = import_results()
if len(test_prioritizations.get_all_tests()) == 0:
options.enable_td = False
test_prioritizations.amend_tests(selected_tests)
os.makedirs(REPO_ROOT / "test" / "test-reports", exist_ok=True)

View File

@ -19,10 +19,15 @@ def get_test_prioritizations(
print(f" {test}", file=file)
for heuristic in HEURISTICS:
new_rankings: TestPrioritizations = heuristic.get_prediction_confidence(tests)
aggregated_results.add_heuristic_results(heuristic, new_rankings)
try:
new_rankings: TestPrioritizations = heuristic.get_prediction_confidence(
tests
)
aggregated_results.add_heuristic_results(heuristic, new_rankings)
print(f"Results from {heuristic.__class__.__name__}")
print(new_rankings.get_info_str(verbose=False), file=file)
print(f"Results from {heuristic.__class__.__name__}")
print(new_rankings.get_info_str(verbose=False), file=file)
except Exception as e:
print(f"Error in {heuristic.__class__.__name__}: {e}", file=file)
return aggregated_results