diff --git a/.github/workflows/update_test_file_ratings.yml b/.github/workflows/update_test_file_ratings.yml index e3321663bb..7704fda752 100644 --- a/.github/workflows/update_test_file_ratings.yml +++ b/.github/workflows/update_test_file_ratings.yml @@ -55,6 +55,7 @@ jobs: python3 test-infra/tools/torchci/td/historical_file_failure_correlation.py python3 test-infra/tools/torchci/td/historical_class_failure_correlation.py python3 test-infra/tools/torchci/td/td_heuristic_historical_edited_files.py + python3 test-infra/tools/torchci/td/get_all_test_names.py # Do not run this one, it won't change # python3 test-infra/tools/torchci/td/td_heuristic_profiling.py @@ -104,3 +105,17 @@ jobs: user_email: "test-infra@pytorch.org" user_name: "Pytorch Test Infra" commit_message: "Updating TD heuristic: historical edited files" + + - name: Push historical edited files heuristic to test-infra repository + if: github.event_name != 'pull_request' + uses: dmnemec/copy_file_to_another_repo_action@eebb594efdf52bc12e1b461988d7254322dac131 + env: + API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }} + with: + source_file: "td_all_tests.json" + destination_repo: "pytorch/test-infra" + destination_folder: "stats" + destination_branch: generated-stats + user_email: "test-infra@pytorch.org" + user_name: "Pytorch Test Infra" + commit_message: "Updating TD heuristic: historical edited files" diff --git a/tools/torchci/td/get_all_test_names.py b/tools/torchci/td/get_all_test_names.py new file mode 100644 index 0000000000..da19d1203a --- /dev/null +++ b/tools/torchci/td/get_all_test_names.py @@ -0,0 +1,31 @@ +import json + +from torchci.clickhouse import query_clickhouse + + +ALL_TESTS_QUERY = """ +SELECT + name, + classname, + invoking_file +FROM ( + SELECT + name, + classname, + invoking_file, + maxMerge(last_run) AS last_run + FROM tests.distinct_names + GROUP BY name, classname, invoking_file +) +WHERE last_run > now() - INTERVAL 1 WEEK +""" + + +if __name__ == "__main__": + all_tests = query_clickhouse(ALL_TESTS_QUERY, {}) + for test in all_tests: + test["file"] = test["invoking_file"].replace(".", "/") + ".py" + del test["invoking_file"] + + with open("td_all_tests.json", mode="w") as file: + json.dump(all_tests, file, sort_keys=True, indent=2)