-
-
Notifications
You must be signed in to change notification settings - Fork 6
186 lines (160 loc) · 5.94 KB
/
daily-benchmark-jit.yml
File metadata and controls
186 lines (160 loc) · 5.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Daily Memory Tracker Benchmark - JIT Build
on:
schedule:
# Run daily at 23:00 UTC (EOD) to pick up all commits from the day
- cron: '0 23 * * *'
workflow_dispatch:
inputs:
target_date:
description: 'Date to get commits from (YYYY-MM-DD, defaults to today)'
required: false
type: string
binary_id:
description: 'Binary ID to use for benchmarking'
required: false
default: 'jit'
environment_id:
description: 'Environment ID'
required: false
default: 'gh_actions'
server_url:
description: 'Memory tracker server URL'
required: false
default: 'https://memory.python.org'
cpython_repo:
description: 'CPython repository URL'
required: false
default: 'https://github.com/python/cpython.git'
llvm:
description: 'LLVM version to use for JIT builds'
required: false
default: '18'
jobs:
get-daily-commits:
runs-on: ubuntu-latest
outputs:
commits: ${{ steps.get-commits.outputs.commits }}
commit-count: ${{ steps.get-commits.outputs.commit-count }}
steps:
- name: Clone CPython repository
run: |
git clone ${{ github.event.inputs.cpython_repo || 'https://github.com/python/cpython.git' }} cpython
cd cpython
git fetch --all
- name: Get commits from target date
id: get-commits
run: |
cd cpython
# Determine target date
if [ -n "${{ github.event.inputs.target_date }}" ]; then
TARGET_DATE="${{ github.event.inputs.target_date }}"
else
TARGET_DATE=$(date -u +%Y-%m-%d)
fi
echo "Getting commits from date: $TARGET_DATE"
# Get commits from the target date (00:00 to 23:59 UTC)
COMMITS=$(git log --since="$TARGET_DATE 00:00:00 UTC" --until="$TARGET_DATE 23:59:59 UTC" --pretty=format:"%H" --reverse)
if [ -z "$COMMITS" ]; then
echo "No commits found for date $TARGET_DATE"
echo "commits=" >> $GITHUB_OUTPUT
echo "commit-count=0" >> $GITHUB_OUTPUT
else
# Convert to JSON array format for matrix strategy
COMMITS_JSON=$(echo "$COMMITS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
COMMIT_COUNT=$(echo "$COMMITS" | wc -l)
echo "Found $COMMIT_COUNT commits for date $TARGET_DATE"
echo "commits=$COMMITS_JSON" >> $GITHUB_OUTPUT
echo "commit-count=$COMMIT_COUNT" >> $GITHUB_OUTPUT
echo "Commits to benchmark:"
echo "$COMMITS"
fi
benchmark-commits:
needs: get-daily-commits
if: needs.get-daily-commits.outputs.commit-count > 0
runs-on: ubuntu-latest
strategy:
matrix:
commit: ${{ fromJson(needs.get-daily-commits.outputs.commits) }}
fail-fast: false
max-parallel: 5
steps:
- name: Checkout memory tracker
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Clone CPython repository
run: |
git clone ${{ github.event.inputs.cpython_repo || 'https://github.com/python/cpython.git' }} cpython
cd cpython
git fetch --depth=200
- name: Install memory tracker worker
run: |
cd worker
pip install -e .
- name: Install build dependencies
run: |
# Install CPython dependencies using their script
cd cpython
sudo .github/workflows/posix-deps-apt.sh
# Install JIT dependencies
if [ "${{ inputs.binary_id }}" = "jit" ]; then
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ inputs.llvm }}
fi
# Install Memray dependencies
sudo apt-get install -y \
python3-dev \
libdebuginfod-dev \
libunwind-dev \
liblz4-dev
- name: Run memory benchmark for commit
env:
MEMORY_TRACKER_TOKEN: ${{ secrets.MEMORY_TRACKER_TOKEN }}
run: |
if [ "${{ inputs.binary_id }}" = "jit" ]; then
export PATH="$(llvm-config-${{ inputs.llvm }} --bindir):$PATH"
fi
COMMIT="${{ matrix.commit }}"
# Build command for single commit
CMD="memory-tracker benchmark '$COMMIT'"
CMD="$CMD --repo-path ./cpython"
CMD="$CMD --binary-id '${{ github.event.inputs.binary_id || 'jit' }}'"
CMD="$CMD --environment-id '${{ github.event.inputs.environment_id || 'gh_actions' }}'"
CMD="$CMD --api-base '${{ github.event.inputs.server_url || 'https://memory.python.org' }}'"
CMD="$CMD --output-dir ./benchmark_results"
CMD="$CMD --force"
CMD="$CMD -vv"
echo "Running benchmark for commit: $COMMIT"
echo "Command: $CMD"
eval $CMD
- name: Upload benchmark results (if failed)
if: failure()
uses: actions/upload-artifact@v4
with:
name: benchmark-logs-${{ matrix.commit }}
path: |
*.log
./benchmark_results/
retention-days: 7
- name: Upload benchmark results (on success)
if: success()
uses: actions/upload-artifact@v4
with:
name: benchmark-results-${{ matrix.commit }}
path: ./benchmark_results/
retention-days: 30
summary:
needs: [get-daily-commits, benchmark-commits]
if: always()
runs-on: ubuntu-latest
steps:
- name: Print summary
run: |
echo "Daily benchmark run completed"
echo "Total commits processed: ${{ needs.get-daily-commits.outputs.commit-count }}"
if [ "${{ needs.get-daily-commits.outputs.commit-count }}" = "0" ]; then
echo "No commits found for the target date"
else
echo "Benchmark jobs completed with status: ${{ needs.benchmark-commits.result }}"
fi