@@ -7,8 +7,19 @@ repo=pytensor
77issue_number=1124
88title=" Speed up test times :rocket:"
99workflow=Tests
10- latest_id=$( gh run list --workflow $workflow --status success --limit 1 --json databaseId --jq ' .[0].databaseId' )
11- 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})' )
10+ latest_id=$( gh run list --branch main --limit 1 --workflow $workflow --status success --json databaseId,startedAt,updatedAt --jq '
11+ . | map({
12+ databaseId: .databaseId,
13+ startedAt: .startedAt,
14+ updatedAt: .updatedAt,
15+ minutes: (((.updatedAt | fromdate) - (.startedAt | fromdate)) / 60)
16+ } | select(.minutes > 10))
17+ | .[0].databaseId
18+ ' )
19+ jobs=$( gh api /repos/$owner /$repo /actions/runs/$latest_id /jobs --jq '
20+ .jobs
21+ | map({name: .name, run_id: .run_id, id: .id, started_at: .started_at, completed_at: .completed_at})
22+ ' )
1223
1324# Skip 3.10, float32, and Benchmark tests
1425function skip_job() {
@@ -31,7 +42,7 @@ function skip_job() {
3142# Remove common prefix from the name
3243function remove_prefix() {
3344 name=$1
34- echo $name | sed -e ' s/^ubuntu-latest test py3.12 : fast-compile 0 : float32 0 : //'
45+ echo $name | sed -e ' s/^ubuntu-latest test py3.13 numpy>=2.0 : fast-compile 0 : float32 0 : //'
3546}
3647
3748function human_readable_time() {
@@ -64,7 +75,11 @@ echo "$jobs" | jq -c '.[]' | while read -r job; do
6475 fi
6576
6677 echo " Processing job: $name (ID: $id , Run ID: $run_id )"
67- times=$( gh run view --job $id --log | python extract-slow-tests.py)
78+
79+ # Seeing a bit more stabilty with the API rather than the CLI
80+ # https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run
81+ times=$( gh api /repos/$owner /$repo /actions/jobs/$id /logs | python extract-slow-tests.py)
82+ # times=$(gh run view --job $id --log | python extract-slow-tests.py)
6883
6984 if [ -z " $times " ]; then
7085 # Some of the jobs are non-test jobs, so we skip them
@@ -89,6 +104,11 @@ echo "$jobs" | jq -c '.[]' | while read -r job; do
89104 fi
90105done
91106
107+ if [ -z " $all_times " ]; then
108+ echo " No slow tests found, exiting"
109+ exit 1
110+ fi
111+
92112run_date=$( date +" %Y-%m-%d" )
93113body=$( cat << EOF
94114If you are motivated to help speed up some tests, we would appreciate it!
@@ -100,7 +120,8 @@ $all_times
100120You can find more information on how to contribute [here](https://pytensor.readthedocs.io/en/latest/dev_start_guide.html)
101121
102122Automatically generated by [GitHub Action](https://github.com/pymc-devs/pytensor/blob/main/.github/workflows/slow-tests-issue.yml)
103- Latest run date: $run_date
123+ Latest run date: $run_date
124+ Run logs: [$latest_id ](https://github.com/pymc-devs/pytensor/actions/runs/$latest_id )
104125EOF
105126)
106127
0 commit comments