Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/update_test_file_ratings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -104,3 +105,17 @@ jobs:
user_email: "[email protected]"
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: "[email protected]"
user_name: "Pytorch Test Infra"
commit_message: "Updating TD heuristic: historical edited files"
31 changes: 31 additions & 0 deletions tools/torchci/td/get_all_test_names.py
Original file line number Diff line number Diff line change
@@ -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)