From 168e8760a8601f3bac60244f631d71d132c8e16b Mon Sep 17 00:00:00 2001 From: Will Dean Date: Wed, 19 Feb 2025 03:08:08 +0100 Subject: [PATCH 1/7] fail with no test times --- scripts/slowest_tests/update-slowest-times-issue.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/slowest_tests/update-slowest-times-issue.sh b/scripts/slowest_tests/update-slowest-times-issue.sh index b1c0c15789..83db13def2 100644 --- a/scripts/slowest_tests/update-slowest-times-issue.sh +++ b/scripts/slowest_tests/update-slowest-times-issue.sh @@ -89,6 +89,11 @@ echo "$jobs" | jq -c '.[]' | while read -r job; do fi done +if [ -z "$all_times" ]; then + echo "No slow tests found, exiting" + exit 1 +fi + run_date=$(date +"%Y-%m-%d") body=$(cat << EOF If you are motivated to help speed up some tests, we would appreciate it! From fc43cd0982d3ec5364b48b451d56691558394997 Mon Sep 17 00:00:00 2001 From: Will Dean Date: Thu, 20 Feb 2025 07:44:21 +0100 Subject: [PATCH 2/7] filter pass test skips --- .../update-slowest-times-issue.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/slowest_tests/update-slowest-times-issue.sh b/scripts/slowest_tests/update-slowest-times-issue.sh index 83db13def2..ecdeb858bd 100644 --- a/scripts/slowest_tests/update-slowest-times-issue.sh +++ b/scripts/slowest_tests/update-slowest-times-issue.sh @@ -7,8 +7,19 @@ repo=pytensor issue_number=1124 title="Speed up test times :rocket:" workflow=Tests -latest_id=$(gh run list --workflow $workflow --status success --limit 1 --json databaseId --jq '.[0].databaseId') -jobs=$(gh api /repos/$owner/$repo/actions/runs/$latest_id/jobs --jq '.jobs | map({name: .name, run_id: .run_id, id: .id, started_at: .started_at, completed_at: .completed_at})') +latest_id=$(gh run list --branch main --limit 1 --workflow "Tests" --status success --json databaseId,startedAt,updatedAt --jq ' +. | map({ + databaseId: .databaseId, + startedAt: .startedAt, + updatedAt: .updatedAt, + minutes: (((.updatedAt | fromdate) - (.startedAt | fromdate)) / 60) +} | select(.minutes > 10)) +| .[0].databaseId +') +jobs=$(gh api /repos/$owner/$repo/actions/runs/$latest_id/jobs --jq ' +.jobs +| map({name: .name, run_id: .run_id, id: .id, started_at: .started_at, completed_at: .completed_at}) +') # Skip 3.10, float32, and Benchmark tests function skip_job() { @@ -105,7 +116,8 @@ $all_times You can find more information on how to contribute [here](https://pytensor.readthedocs.io/en/latest/dev_start_guide.html) Automatically generated by [GitHub Action](https://github.com/pymc-devs/pytensor/blob/main/.github/workflows/slow-tests-issue.yml) -Latest run date: $run_date +Latest run date: $run_date +Run logs: [$latest_id](https://github.com/pymc-devs/pytensor/actions/runs/$latest_id) EOF ) From 33082e0862e83319a03092863f5cafa384e789e6 Mon Sep 17 00:00:00 2001 From: Will Dean Date: Thu, 20 Feb 2025 08:00:31 +0100 Subject: [PATCH 3/7] dont skip python 3.10 --- scripts/slowest_tests/update-slowest-times-issue.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/slowest_tests/update-slowest-times-issue.sh b/scripts/slowest_tests/update-slowest-times-issue.sh index ecdeb858bd..b2a8f27bbc 100644 --- a/scripts/slowest_tests/update-slowest-times-issue.sh +++ b/scripts/slowest_tests/update-slowest-times-issue.sh @@ -24,9 +24,9 @@ jobs=$(gh api /repos/$owner/$repo/actions/runs/$latest_id/jobs --jq ' # Skip 3.10, float32, and Benchmark tests function skip_job() { name=$1 - if [[ $name == *"py3.10"* ]]; then - return 0 - fi + # if [[ $name == *"py3.10"* ]]; then + # return 0 + # fi if [[ $name == *"float32 1"* ]]; then return 0 From 28d5f62a5377465d03b9018be01d6ad5dffe139e Mon Sep 17 00:00:00 2001 From: Will Dean Date: Thu, 20 Feb 2025 08:08:48 +0100 Subject: [PATCH 4/7] switch to REST endpoint --- scripts/slowest_tests/update-slowest-times-issue.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/slowest_tests/update-slowest-times-issue.sh b/scripts/slowest_tests/update-slowest-times-issue.sh index b2a8f27bbc..878e344722 100644 --- a/scripts/slowest_tests/update-slowest-times-issue.sh +++ b/scripts/slowest_tests/update-slowest-times-issue.sh @@ -24,9 +24,9 @@ jobs=$(gh api /repos/$owner/$repo/actions/runs/$latest_id/jobs --jq ' # Skip 3.10, float32, and Benchmark tests function skip_job() { name=$1 - # if [[ $name == *"py3.10"* ]]; then - # return 0 - # fi + if [[ $name == *"py3.10"* ]]; then + return 0 + fi if [[ $name == *"float32 1"* ]]; then return 0 @@ -75,7 +75,11 @@ echo "$jobs" | jq -c '.[]' | while read -r job; do fi echo "Processing job: $name (ID: $id, Run ID: $run_id)" - times=$(gh run view --job $id --log | python extract-slow-tests.py) + + # Seeing a bit more stabilty with the API rather than the CLI + # https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run + times=$(gh api /repos/$owner/$repo/actions/jobs/$id/logs | python extract-slow-tests.py) + # times=$(gh run view --job $id --log | python extract-slow-tests.py) if [ -z "$times" ]; then # Some of the jobs are non-test jobs, so we skip them From 0beaadb6245f73d1b3ee3e81e66965959f500399 Mon Sep 17 00:00:00 2001 From: Will Dean Date: Thu, 20 Feb 2025 08:21:14 +0100 Subject: [PATCH 5/7] update the prefix --- scripts/slowest_tests/update-slowest-times-issue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/slowest_tests/update-slowest-times-issue.sh b/scripts/slowest_tests/update-slowest-times-issue.sh index 878e344722..11977baf5c 100644 --- a/scripts/slowest_tests/update-slowest-times-issue.sh +++ b/scripts/slowest_tests/update-slowest-times-issue.sh @@ -42,7 +42,7 @@ function skip_job() { # Remove common prefix from the name function remove_prefix() { name=$1 - echo $name | sed -e 's/^ubuntu-latest test py3.12 : fast-compile 0 : float32 0 : //' + echo $name | sed -e 's/^ubuntu-latest test py3.12 numpy>=2.0 : fast-compile 0 : float32 0 : //' } function human_readable_time() { From 30eeab7f205d097c27a0dc13e3af703da0a344c5 Mon Sep 17 00:00:00 2001 From: Will Dean Date: Thu, 20 Feb 2025 10:20:59 +0100 Subject: [PATCH 6/7] use the variable --- scripts/slowest_tests/update-slowest-times-issue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/slowest_tests/update-slowest-times-issue.sh b/scripts/slowest_tests/update-slowest-times-issue.sh index 11977baf5c..f4cc80b052 100644 --- a/scripts/slowest_tests/update-slowest-times-issue.sh +++ b/scripts/slowest_tests/update-slowest-times-issue.sh @@ -7,7 +7,7 @@ repo=pytensor issue_number=1124 title="Speed up test times :rocket:" workflow=Tests -latest_id=$(gh run list --branch main --limit 1 --workflow "Tests" --status success --json databaseId,startedAt,updatedAt --jq ' +latest_id=$(gh run list --branch main --limit 1 --workflow $workflow --status success --json databaseId,startedAt,updatedAt --jq ' . | map({ databaseId: .databaseId, startedAt: .startedAt, From 3bed3997a747f13241ce0c607dea6fe48b2966f0 Mon Sep 17 00:00:00 2001 From: Will Dean Date: Fri, 21 Feb 2025 13:23:42 +0100 Subject: [PATCH 7/7] update the prefix --- scripts/slowest_tests/update-slowest-times-issue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/slowest_tests/update-slowest-times-issue.sh b/scripts/slowest_tests/update-slowest-times-issue.sh index f4cc80b052..a87ce19ec3 100644 --- a/scripts/slowest_tests/update-slowest-times-issue.sh +++ b/scripts/slowest_tests/update-slowest-times-issue.sh @@ -42,7 +42,7 @@ function skip_job() { # Remove common prefix from the name function remove_prefix() { name=$1 - echo $name | sed -e 's/^ubuntu-latest test py3.12 numpy>=2.0 : fast-compile 0 : float32 0 : //' + echo $name | sed -e 's/^ubuntu-latest test py3.13 numpy>=2.0 : fast-compile 0 : float32 0 : //' } function human_readable_time() {