Skip to content

Commit 98551c4

Browse files
authored
ci: Aggregate test durations (#5129)
## Changes Made Aggregate pytest durations so we can see what files / directories take the longest. See https://github.com/Eventual-Inc/Daft/actions/runs/17448222436/job/49547643604?pr=5129#step:12:2046 for example ## Related Issues <!-- Link to related GitHub issues, e.g., "Closes #123" --> ## Checklist - [ ] Documented in API Docs (if applicable) - [ ] Documented in User Guide (if applicable) - [ ] If adding a new documentation page, doc is added to `docs/mkdocs.yml` navigation - [ ] Documentation builds and is formatted properly (tag @/ccmao1130 for docs review)
1 parent d321b39 commit 98551c4

File tree

4 files changed

+366
-22
lines changed

4 files changed

+366
-22
lines changed

.github/workflows/pr-test-suite.yml

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ jobs:
143143
source .venv/bin/activate
144144
maturin develop --uv
145145
pytest --ignore tests/integration --collect-only -qq # run this to ensure no weird imports that result in `Collector` errors
146-
pytest --cov=daft --ignore tests/integration --durations=50
146+
pytest --cov=daft --ignore tests/integration --durations=0 | ./tools/capture-durations.sh "pytest_output.txt"
147+
python tools/aggregate_test_durations.py pytest_output.txt
147148
coverage combine -a --data-file='.coverage' || true
148149
mkdir -p report-output
149150
coverage xml -o ./report-output/coverage-${{ join(matrix.*, '-') }}.xml
@@ -160,7 +161,8 @@ jobs:
160161
cargo llvm-cov clean --workspace
161162
maturin develop --uv
162163
pytest --ignore tests/integration --collect-only -qq # run this to ensure no weird imports that result in `Collector` errors
163-
pytest --cov=daft --ignore tests/integration --durations=50
164+
pytest --cov=daft --ignore tests/integration --durations=0 | ./tools/capture-durations.sh "pytest_output.txt"
165+
python tools/aggregate_test_durations.py pytest_output.txt
164166
coverage combine -a --data-file='.coverage' || true
165167
mkdir -p report-output
166168
coverage xml -o ./report-output/coverage-${{ join(matrix.*, '-') }}.xml
@@ -318,20 +320,23 @@ jobs:
318320
- name: Run TPCH integration tests (native)
319321
run: |
320322
source .venv/bin/activate
321-
pytest tests/integration/test_tpch.py --durations=50
323+
pytest tests/integration/test_tpch.py --durations=0 | ./tools/capture-durations.sh "tpch_pytest_output.txt"
324+
python tools/aggregate_test_durations.py tpch_pytest_output.txt
322325
env:
323326
DAFT_RUNNER: native
324327
- name: Run TPCH integration tests (ray)
325328
run: |
326329
source .venv/bin/activate
327-
pytest tests/integration/test_tpch.py --durations=50
330+
pytest tests/integration/test_tpch.py --durations=0 | ./tools/capture-durations.sh "tpch_pytest_output.txt"
331+
python tools/aggregate_test_durations.py tpch_pytest_output.txt
328332
env:
329333
DAFT_RUNNER: ray
330334
DAFT_FLOTILLA: 0
331335
- name: Run TPCH integration tests (flotilla)
332336
run: |
333337
source .venv/bin/activate
334-
pytest tests/integration/test_tpch.py --durations=50
338+
pytest tests/integration/test_tpch.py --durations=0 | ./tools/capture-durations.sh "tpch_pytest_output.txt"
339+
python tools/aggregate_test_durations.py tpch_pytest_output.txt
335340
env:
336341
DAFT_RUNNER: ray
337342
DAFT_FLOTILLA: 1
@@ -415,8 +420,9 @@ jobs:
415420
- name: Run IO integration tests
416421
run: |
417422
source .venv/bin/activate
418-
pytest tests/integration/io -m 'integration and not benchmark' --durations=50
419-
pytest tests/io -m 'integration' --durations=50
423+
pytest tests/integration/io -m 'integration and not benchmark' --durations=0 | ./tools/capture-durations.sh "io_integration_pytest_output.txt"
424+
pytest tests/io -m 'integration' --durations=0 | ./tools/capture-durations.sh "io_integration_pytest_output_2.txt"
425+
python tools/aggregate_test_durations.py io_integration_pytest_output.txt io_integration_pytest_output_2.txt
420426
env:
421427
DAFT_RUNNER: ${{ matrix.daft-runner }}
422428
DAFT_FLOTILLA: ${{ matrix.flotilla }}
@@ -519,7 +525,8 @@ jobs:
519525
- name: Run IO integration tests
520526
run: |
521527
source .venv/bin/activate
522-
pytest tests/integration/io -m 'integration and not benchmark' --credentials --durations=50
528+
pytest tests/integration/io -m 'integration and not benchmark' --credentials --durations=0 | ./tools/capture-durations.sh "io_credentialed_pytest_output.txt"
529+
python tools/aggregate_test_durations.py io_credentialed_pytest_output.txt
523530
env:
524531
DAFT_RUNNER: ${{ matrix.daft-runner }}
525532
DAFT_FLOTILLA: ${{ matrix.flotilla }}
@@ -597,20 +604,23 @@ jobs:
597604
- name: Run sql integration tests (native)
598605
run: |
599606
source .venv/bin/activate
600-
pytest tests/integration/sql -m 'integration or not integration' --durations=50
607+
pytest tests/integration/sql -m 'integration or not integration' --durations=0 | ./tools/capture-durations.sh "sql_pytest_output.txt"
608+
python tools/aggregate_test_durations.py sql_pytest_output.txt
601609
env:
602610
DAFT_RUNNER: native
603611
- name: Run sql integration tests (ray)
604612
run: |
605613
source .venv/bin/activate
606-
pytest tests/integration/sql -m 'integration or not integration' --durations=50
614+
pytest tests/integration/sql -m 'integration or not integration' --durations=0 | ./tools/capture-durations.sh "sql_pytest_output.txt"
615+
python tools/aggregate_test_durations.py sql_pytest_output.txt
607616
env:
608617
DAFT_RUNNER: ray
609618
DAFT_FLOTILLA: 0
610619
- name: Run sql integration tests (flotilla)
611620
run: |
612621
source .venv/bin/activate
613-
pytest tests/integration/sql -m 'integration or not integration' --durations=50
622+
pytest tests/integration/sql -m 'integration or not integration' --durations=0 | ./tools/capture-durations.sh "sql_pytest_output.txt"
623+
python tools/aggregate_test_durations.py sql_pytest_output.txt
614624
env:
615625
DAFT_RUNNER: ray
616626
DAFT_FLOTILLA: 1
@@ -705,15 +715,17 @@ jobs:
705715
if: always()
706716
run: |
707717
source .venv/bin/activate
708-
pytest tests/integration/unity -m 'integration or not integration' --durations=50
718+
pytest tests/integration/unity -m 'integration or not integration' --durations=0 | ./tools/capture-durations.sh "unity_pytest_output.txt"
719+
python tools/aggregate_test_durations.py unity_pytest_output.txt
709720
env:
710721
DAFT_RUNNER: native
711722
UNITY_CATALOG_PORT: 3000
712723
- name: Run Unity integration tests (ray)
713724
if: always()
714725
run: |
715726
source .venv/bin/activate
716-
pytest tests/integration/unity -m 'integration or not integration' --durations=50
727+
pytest tests/integration/unity -m 'integration or not integration' --durations=0 | ./tools/capture-durations.sh "unity_pytest_output.txt"
728+
python tools/aggregate_test_durations.py unity_pytest_output.txt
717729
env:
718730
DAFT_RUNNER: ray
719731
DAFT_FLOTILLA: 0
@@ -722,7 +734,8 @@ jobs:
722734
if: always()
723735
run: |
724736
source .venv/bin/activate
725-
pytest tests/integration/unity -m 'integration or not integration' --durations=50
737+
pytest tests/integration/unity -m 'integration or not integration' --durations=0 | ./tools/capture-durations.sh "unity_pytest_output.txt"
738+
python tools/aggregate_test_durations.py unity_pytest_output.txt
726739
env:
727740
DAFT_RUNNER: ray
728741
DAFT_FLOTILLA: 1
@@ -732,22 +745,25 @@ jobs:
732745
if: always()
733746
run: |
734747
source .venv/bin/activate
735-
pytest tests/integration/iceberg -m 'integration' --durations=50
748+
pytest tests/integration/iceberg -m 'integration' --durations=0 | ./tools/capture-durations.sh "iceberg_pytest_output.txt"
749+
python tools/aggregate_test_durations.py iceberg_pytest_output.txt
736750
env:
737751
DAFT_RUNNER: native
738752
- name: Run Iceberg integration tests (ray)
739753
if: always()
740754
run: |
741755
source .venv/bin/activate
742-
pytest tests/integration/iceberg -m 'integration' --durations=50
756+
pytest tests/integration/iceberg -m 'integration' --durations=0 | ./tools/capture-durations.sh "iceberg_pytest_output.txt"
757+
python tools/aggregate_test_durations.py iceberg_pytest_output.txt
743758
env:
744759
DAFT_RUNNER: ray
745760
DAFT_FLOTILLA: 0
746761
- name: Run Iceberg integration tests (flotilla)
747762
if: always()
748763
run: |
749764
source .venv/bin/activate
750-
pytest tests/integration/iceberg -m 'integration' --durations=50
765+
pytest tests/integration/iceberg -m 'integration' --durations=0 | ./tools/capture-durations.sh "iceberg_pytest_output.txt"
766+
python tools/aggregate_test_durations.py iceberg_pytest_output.txt
751767
env:
752768
DAFT_RUNNER: ray
753769
DAFT_FLOTILLA: 1
@@ -756,22 +772,25 @@ jobs:
756772
if: always()
757773
run: |
758774
source .venv/bin/activate
759-
pytest tests/integration/delta_lake -m 'integration' --durations=50
775+
pytest tests/integration/delta_lake -m 'integration' --durations=0 | ./tools/capture-durations.sh "delta_lake_pytest_output.txt"
776+
python tools/aggregate_test_durations.py delta_lake_pytest_output.txt
760777
env:
761778
DAFT_RUNNER: native
762779
- name: Run Delta Lake integration tests (ray)
763780
if: always()
764781
run: |
765782
source .venv/bin/activate
766-
pytest tests/integration/delta_lake -m 'integration' --durations=50
783+
pytest tests/integration/delta_lake -m 'integration' --durations=0 | ./tools/capture-durations.sh "delta_lake_pytest_output.txt"
784+
python tools/aggregate_test_durations.py delta_lake_pytest_output.txt
767785
env:
768786
DAFT_RUNNER: ray
769787
DAFT_FLOTILLA: 0
770788
- name: Run Delta Lake integration tests (flotilla)
771789
if: always()
772790
run: |
773791
source .venv/bin/activate
774-
pytest tests/integration/delta_lake -m 'integration' --durations=50
792+
pytest tests/integration/delta_lake -m 'integration' --durations=0 | ./tools/capture-durations.sh "delta_lake_pytest_output.txt"
793+
python tools/aggregate_test_durations.py delta_lake_pytest_output.txt
775794
env:
776795
DAFT_RUNNER: ray
777796
DAFT_FLOTILLA: 1
@@ -846,7 +865,8 @@ jobs:
846865
- name: Run AI provider integration tests
847866
run: |
848867
source .venv/bin/activate
849-
pytest -m integration tests/integration/ai --credentials --durations=50
868+
pytest -m integration tests/integration/ai --credentials --durations=0 | ./tools/capture-durations.sh "ai_pytest_output.txt"
869+
python tools/aggregate_test_durations.py ai_pytest_output.txt
850870
env:
851871
DAFT_RUNNER: ${{ matrix.daft-runner }}
852872
DAFT_ENABLE_AQE: ${{ matrix.enable-aqe }}

tests/test_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_env_var(daft_runner_envvar):
135135

136136

137137
def test_in_ray_job():
138-
"""Test that Ray job ID environment variable is being picked up."""
138+
"""Test that Ray job ID environment variable is being detected."""
139139
autodetect_script = """
140140
import daft
141141
df = daft.from_pydict({"foo": [1, 2, 3]})

0 commit comments

Comments
 (0)