@@ -7,8 +7,19 @@ repo=pytensor
7
7
issue_number=1124
8
8
title=" Speed up test times :rocket:"
9
9
workflow=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
+ ' )
12
23
13
24
# Skip 3.10, float32, and Benchmark tests
14
25
function skip_job() {
@@ -31,7 +42,7 @@ function skip_job() {
31
42
# Remove common prefix from the name
32
43
function remove_prefix() {
33
44
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 : //'
35
46
}
36
47
37
48
function human_readable_time() {
@@ -64,7 +75,11 @@ echo "$jobs" | jq -c '.[]' | while read -r job; do
64
75
fi
65
76
66
77
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)
68
83
69
84
if [ -z " $times " ]; then
70
85
# 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
89
104
fi
90
105
done
91
106
107
+ if [ -z " $all_times " ]; then
108
+ echo " No slow tests found, exiting"
109
+ exit 1
110
+ fi
111
+
92
112
run_date=$( date +" %Y-%m-%d" )
93
113
body=$( cat << EOF
94
114
If you are motivated to help speed up some tests, we would appreciate it!
@@ -100,7 +120,8 @@ $all_times
100
120
You can find more information on how to contribute [here](https://pytensor.readthedocs.io/en/latest/dev_start_guide.html)
101
121
102
122
Automatically 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 )
104
125
EOF
105
126
)
106
127
0 commit comments