You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reuse Athena Spark sessions across Spark tests #849
Spark tests cost about $20 of the September bill (58 DPU-hours; see #834).
The spark_cursor and async_spark_cursor fixtures in tests/pyathena/conftest.py and aio_spark_cursor in tests/pyathena/aio/conftest.py are function-scoped.
Every Spark test starts a new Athena Spark session and waits for it to become idle.
The cursor's close() terminates the session.
So the DPU cost of starting a session is paid once per test.
Since #837, Spark tests run on pull requests only when Spark code or tests change, plus weekly and on dispatch. The Spark lifecycle work tracked in #791 changes those files, so they run often while that work is in progress.
Proposed change
Reuse Spark sessions across tests where isolation allows it:
Provide a module- or worker-scoped Spark connection/session fixture for tests that only run calculations.
Keep function-scoped sessions for tests that exercise session lifecycle: creation failure, termination, cancellation, and close() behavior.
2026-09-23 to 2026-09-26 (every Python version, #791 in progress)
$2.8–3.4 (8–10 DPU-hours)
2026-09-27 (after #863: pull requests test Python 3.14 only)
$0.65 (1.87 DPU-hours)
2026-09-28
$0
One Spark test run now (the latest CI run, for #861, on Python 3.14): 15 sessions with 345 session-seconds in total. The engine configuration is CoordinatorDpuSize: 1, MaxConcurrentDpus: 2, DefaultExecutorDpuSize: 1.
Activity
laughingman7743 commentedon Sep 28, 2026
Closing as not planned. Measurements on 2026-09-28 show that the remaining saving no longer justifies the change.
Spark DPU cost (Cost Explorer,
USW2-CodeExecutionInDPUHours):One Spark test run now (the latest CI run, for #861, on Python 3.14): 15 sessions with 345 session-seconds in total. The engine configuration is
CoordinatorDpuSize: 1,MaxConcurrentDpus: 2,DefaultExecutorDpuSize: 1.Remaining saving
What the change would cost
--dist loadgroup.If Spark work picks up again and the Spark DPU cost becomes significant, this can be reopened. The cost is tracked in #846.