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
Spark: stop readiness polling on failed, terminated, or degraded session states #792
SparkBaseCursor._wait_for_idle_session() checks session_status.state for IDLE, but compares the status object itself with the string constants for TERMINATED, DEGRADED, and FAILED.
That error branch cannot match an AthenaSessionStatus instance.
As long as the API continues returning one of those states, cursor construction keeps polling instead of reporting the failure reason.
This affects all three Spark cursor variants through their shared constructor.
Use a real AthenaSessionStatus with Status.State set to FAILED and a StateChangeReason.
Return it from a mocked _get_session_status() and intercept time.sleep() so the probe cannot hang.
The current implementation reaches sleep instead of raising OperationalError.
The same probe reproduced this for TERMINATED and DEGRADED; no AWS calls are needed.
Environment
Checked at a03bc2b4ea5dddcbf6230aafda0a359dce12ef0e with Python 3.13.1.
Evidence below is from source inspection and offline probes with AWS calls replaced by mocks; no live Athena validation was performed.
Proposed fix (optional)
Compare the state value in both branches and preserve the reported failure reason.
Keep this fix focused on the existing failure-state check; any new startup deadline is a separate policy decision.
Acceptance:
IDLE completes the wait; FAILED, TERMINATED, and DEGRADED raise with the available reason without sleeping again.
CREATING/BUSY followed by IDLE still works.
New-session and supplied-session paths use the corrected behavior.
Add deterministic regression coverage without invoking the AWS-dependent pytest session setup unnecessarily.
Activity