Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .github/workflows/pr-bench-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,21 @@ jobs:
secrets: inherit
with:
matrix_preset: "pr-full"

remove-sql-scan-label:
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.event.label.name == 'action/bench-scan'
steps:
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1
if: github.event.pull_request.head.repo.full_name == 'vortex-data/vortex'
with:
labels: action/bench-scan
fail_on_error: true

sql-scan-bench:
needs: remove-sql-scan-label
uses: ./.github/workflows/pr-bench-sql.yml
secrets: inherit
with:
matrix_preset: "pr-scan"
1 change: 1 addition & 0 deletions .github/workflows/pr-bench-sql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ on:
default: "pr"
options:
- "pr"
- "pr-scan"
- "pr-compact"
- "pr-all"
- "pr-full"
Expand Down
169 changes: 120 additions & 49 deletions .github/workflows/sql-bench-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
contents: read
outputs:
benchmark_matrix: ${{ steps.resolve.outputs.benchmark_matrix }}
comment_groups: ${{ steps.resolve.outputs.comment_groups }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
Expand All @@ -42,6 +43,10 @@ jobs:

matrix="$(uv run --project bench-orchestrator vx-bench matrix "$MATRIX_PRESET")"
echo "benchmark_matrix=$matrix" >> "$GITHUB_OUTPUT"
# A case runs as one entry per scan when it covers every scan; its PR comment collects
# the entries of its `group` into one table.
groups="$(jq -c '[group_by(.group)[] | {group: .[0].group, name: .[0].group_name, ids: map(.id)}]' <<<"$matrix")"
echo "comment_groups=$groups" >> "$GITHUB_OUTPUT"

build:
timeout-minutes: 60
Expand Down Expand Up @@ -292,8 +297,9 @@ jobs:
# The `file_size` records join the run's ingest records: develop runs store them in the
# benchmarks database (the `file_sizes` table), and PR runs fetch them back as the baseline.
- parallel:
# Every entry of a case generates the same data, so only the case's default entry records it.
- name: Capture file sizes
if: matrix.remote_key == null
if: matrix.remote_key == null && matrix.records_data
shell: bash
run: |
uv run --no-project scripts/capture-file-sizes.py \
Expand All @@ -309,7 +315,7 @@ jobs:
# dumped, then one file of every table is kept, plus more partitions weighted by size up to a
# line budget. Observability only, so it never fails the benchmark or holds up its job.
- name: Dump sampled file trees
if: ${{ !cancelled() && matrix.remote_key == null }}
if: ${{ !cancelled() && matrix.remote_key == null && matrix.records_data }}
continue-on-error: true
timeout-minutes: 20
shell: bash
Expand All @@ -320,56 +326,27 @@ jobs:
--seed ${{ inputs.mode == 'pr' && github.event.pull_request.head.sha || github.sha }} \
-o file-trees

# "Fetch baseline" reads the file-size records "Capture file sizes" appends, so it waits for them.
- parallel:
- name: Upload sampled file trees
if: ${{ !cancelled() && matrix.remote_key == null }}
continue-on-error: true
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: file-trees-${{ inputs.matrix_preset }}-${{ matrix.id }}
path: file-trees/
retention-days: 5
if-no-files-found: ignore
- name: Fetch baseline from the benchmarks database
if: inputs.mode == 'pr'
uses: ./.github/actions/fetch-bench-baseline
with:
role-arn: ${{ vars.GH_BENCH_READ_ROLE_ARN }}
region: ${{ vars.RDS_BENCH_REGION }}
endpoint: ${{ vars.RDS_BENCH_INSTANCE_ENDPOINT }}
database: ${{ vars.RDS_BENCH_DB_NAME }}

- name: Compare results
if: inputs.mode == 'pr'
shell: bash
run: |
set -Eeu -o pipefail -x

uv run --no-project scripts/compare-benchmark-jsons.py base.ingest.jsonl results.json \
"${{ matrix.name }}" --pr-records results.ingest.jsonl > comment.md
cat comment.md >> "$GITHUB_STEP_SUMMARY"

- name: Comment PR
if: inputs.mode == 'pr' && github.event.pull_request.head.repo.fork == false
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3
- name: Upload sampled file trees
if: ${{ !cancelled() && matrix.remote_key == null && matrix.records_data }}
continue-on-error: true
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
file-path: comment.md
# There is exactly one comment per comment-tag. If a comment with this tag already exists,
# this action will *update* the comment instead of posting a new comment. The preset is
# part of the tag because presets overlap on benchmark ids (`pr` and `pr-compact` share
# nine) and can run concurrently, so a preset-less tag would let them clobber each other.
comment-tag: bench-pr-comment-${{ matrix.id }}-${{ inputs.matrix_preset }}
name: file-trees-${{ inputs.matrix_preset }}-${{ matrix.id }}
path: file-trees/
retention-days: 5
if-no-files-found: ignore

- name: Comment PR on failure
if: failure() && inputs.mode == 'pr' && github.event.pull_request.head.repo.fork == false
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3
# The `comment` job compares and comments once per case, over every entry of the case.
- name: Upload results for the PR comment
if: ${{ !cancelled() && inputs.mode == 'pr' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
message: |
# 🚨🚨🚨❌❌❌ SQL BENCHMARK FAILED ❌❌❌🚨🚨🚨

Benchmark `${{ matrix.name }}` (${{ inputs.matrix_preset }}) failed! Check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
comment-tag: bench-pr-comment-${{ matrix.id }}-${{ inputs.matrix_preset }}
name: sql-results-${{ inputs.matrix_preset }}--${{ matrix.group }}--${{ matrix.id }}
path: |
results.json
results.ingest.jsonl
retention-days: 5
if-no-files-found: ignore

# v4 (Postgres) ingest -- the REQUIRED benchmark-results pipeline feeding the live
# benchmarks website (see develop-bench.yml for the full rationale); a failure here fails the
Expand Down Expand Up @@ -436,3 +413,97 @@ jobs:
separate-directories: true
delete-merged: true
retention-days: 5

# One comment per case: the entries of a case run on machines of their own, one per Vortex scan,
# and their results are compared here against one baseline, so the comment shows every scan side
# by side and names any entry that did not report.
comment:
needs: [resolve-matrix, bench]
if: ${{ !cancelled() && inputs.mode == 'pr' }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.resolve-matrix.outputs.comment_groups) }}
runs-on: >-
${{ github.repository == 'vortex-data/vortex'
&& format('runs-on={0}/region=us-east-1/runner=amd64-ci-small/image=ubuntu26-full-x64-pre-v2/tag=comment-{1}{2}', github.run_id, matrix.group, github.event.pull_request.head.repo.fork == false && '/extras=s3-cache' || '')
|| 'ubuntu-latest' }}
steps:
# `extras=s3-cache` points the artifact API at the RunsOn proxy, which only this action wires up.
- uses: runs-on/action@v2
if: github.event.pull_request.head.repo.fork == false
# The baseline is the newest develop commit reachable from the PR head, which needs full history.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Install uv
uses: spiraldb/actions/.github/actions/setup-uv@a746510eafaa926484c354541cfc49b2ec06cc63 # 0.18.6
with:
sync: false
- name: Download results
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
pattern: sql-results-${{ inputs.matrix_preset }}--${{ matrix.group }}--*
path: entries
- name: Merge results
id: merge
shell: bash
env:
IDS: ${{ toJSON(matrix.ids) }}
run: |
set -Eeuo pipefail
: > results.json
: > results.ingest.jsonl
missing=()
while read -r id; do
dir="entries/sql-results-${{ inputs.matrix_preset }}--${{ matrix.group }}--${id}"
if [[ -s "$dir/results.ingest.jsonl" ]]; then
cat "$dir/results.ingest.jsonl" >> results.ingest.jsonl
cat "$dir/results.json" >> results.json 2>/dev/null || true
else
missing+=("\`${id}\`")
fi
done < <(jq -r '.[]' <<<"$IDS")
echo "missing=${missing[*]}" >> "$GITHUB_OUTPUT"
echo "reported=$([[ -s results.ingest.jsonl ]] && echo true || echo false)" >> "$GITHUB_OUTPUT"
- name: Fetch baseline from the benchmarks database
if: steps.merge.outputs.reported == 'true'
uses: ./.github/actions/fetch-bench-baseline
with:
role-arn: ${{ vars.GH_BENCH_READ_ROLE_ARN }}
region: ${{ vars.RDS_BENCH_REGION }}
endpoint: ${{ vars.RDS_BENCH_INSTANCE_ENDPOINT }}
database: ${{ vars.RDS_BENCH_DB_NAME }}
- name: Compare results
shell: bash
env:
MISSING: ${{ steps.merge.outputs.missing }}
REPORTED: ${{ steps.merge.outputs.reported }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -Eeu -o pipefail -x
: > comment.md
if [[ -n "$MISSING" ]]; then
echo "# 🚨🚨🚨❌❌❌ SQL BENCHMARK FAILED ❌❌❌🚨🚨🚨" >> comment.md
echo >> comment.md
echo "Benchmark \`${{ matrix.name }}\` (${{ inputs.matrix_preset }}) has entries that did not report: ${MISSING}. Check the [workflow run](${RUN_URL}) for details." >> comment.md
echo >> comment.md
fi
if [[ "$REPORTED" == "true" ]]; then
uv run --no-project scripts/compare-benchmark-jsons.py base.ingest.jsonl results.json \
"${{ matrix.name }}" --pr-records results.ingest.jsonl >> comment.md
fi
cat comment.md >> "$GITHUB_STEP_SUMMARY"
- name: Comment PR
if: github.event.pull_request.head.repo.fork == false
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3
with:
file-path: comment.md
# There is exactly one comment per comment-tag. If a comment with this tag already exists,
# this action will *update* the comment instead of posting a new comment. The preset is
# part of the tag because presets overlap on benchmark ids (`pr` and `pr-compact` share
# nine) and can run concurrently, so a preset-less tag would let them clobber each other.
comment-tag: bench-pr-comment-${{ matrix.group }}-${{ inputs.matrix_preset }}
12 changes: 10 additions & 2 deletions bench-orchestrator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,19 @@ vx-bench clean --older-than "30 days" [options]
## CI Benchmark Matrices

CI benchmark coverage lives in `bench_orchestrator/ci_matrix/catalog.py`. This is the only file to
edit when changing what runs in the `develop`, `pr`, `pr-compact`, `pr-all`, `pr-full`, or
`nightly` presets. The remaining modules in `ci_matrix` model, validate, and render that catalog as
edit when changing what runs in the `develop`, `pr`, `pr-scan`, `pr-compact`, `pr-all`, `pr-full`,
or `nightly` presets. The remaining modules in `ci_matrix` model, validate, and render that catalog as
the JSON expected by GitHub Actions. `pr-all` is not declared per benchmark: it is derived as the
union of each benchmark's `pr`, `pr-compact`, and `pr-full` coverage.

Vortex targets name an integration (`file` or `datasource`) and a scan engine (`v1` or `v2`). A
coverage made with `with_all_scans` runs every valid combination, and each combination becomes a
matrix entry of its own, `{id}-{engine}-{integration}-{scan}`, on its own machine. The default
entry keeps the case's id. Every entry of a case shares its `group`, and the PR comment job merges
a group's results into one table. `nightly` covers every scan on every benchmark; `develop` and
`pr-scan` cover them on ClickBench and TPC-H SF=1 on NVMe. The other PR presets run the default
scans only.

When adding coverage, update the benchmark declarations and the expected preset membership in
`tests/test_matrix.py`.

Expand Down
Loading
Loading