From 712bd9ae8826cb11d2989bbe5f7b4e1cc3802831 Mon Sep 17 00:00:00 2001 From: Zain Rizvi Date: Wed, 22 Mar 2023 22:03:51 +0000 Subject: [PATCH] Upload failed and rerun tests (#97304) Upload data for any test that didn't cleanly succeed to S3 for injestion by rockset. About 0.001% of tests fall under this category, keeping the data usage low. Pull Request resolved: https://github.com/pytorch/pytorch/pull/97304 Approved by: https://github.com/clee2000 --- tools/stats/upload_test_stats.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/stats/upload_test_stats.py b/tools/stats/upload_test_stats.py index 466c59a3028ac9..2e8159026928a2 100644 --- a/tools/stats/upload_test_stats.py +++ b/tools/stats/upload_test_stats.py @@ -354,6 +354,21 @@ def init_value(test_case: Dict[str, Any]) -> Dict[str, Any]: invoking_file_times, ) + # Separate out the failed test cases. + # Uploading everying is too data intensive most of the time, + # but these will be just a tiny fraction. + failed_tests_cases = [] + for test_case in test_cases: + if "rerun" in test_case or "failure" in test_case or "error" in test_case: + failed_tests_cases.append(test_case) + + upload_workflow_stats_to_s3( + args.workflow_run_id, + args.workflow_run_attempt, + "failed_test_runs", + failed_tests_cases, + ) + if args.head_branch == "master": # For master jobs, upload everytihng. upload_workflow_stats_to_s3(