-
Notifications
You must be signed in to change notification settings - Fork 116
Tighten the Spark and SQL cancellation notes in the docs #920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -256,8 +256,10 @@ The `cancel()` method sends a [StopCalculationExecution](https://docs.aws.amazon | |
| request for the calculation. It does not terminate the session. | ||
| Athena cancels the calculation on a best-effort basis: | ||
|
|
||
| - A running Spark job, such as a DataFrame action, stops within seconds. | ||
| The calculation ends in the `CANCELED` state, and the session remains usable for later calculations. | ||
| - A running Spark job, such as a DataFrame action, usually stops within seconds. | ||
| The calculation then ends in the `CANCELED` state, and the session remains usable for later calculations. | ||
| - A request sent right after the calculation starts can occasionally have no effect. | ||
| The calculation then runs as if it had not been canceled. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent review (relayed): Codex CLI, reported model Scope: Covered surfaces: the exact hunk, the entire Cancellation section, cancellation/startup/polling/state/token paths in all four named source files, and the supplied Athena observations. Static review only. FINDINGS
The changed list matches the supplied observations and introduces no contradiction. Disposition: fixed in the next commit. Verified: |
||
| - Python code that runs on the driver without a Spark job, such as `time.sleep()`, runs to completion. | ||
| The calculation ends in the `COMPLETED` state, and the session rejects new calculations until then. | ||
| - Canceling a calculation that has already finished does not raise an error or change its state. | ||
|
|
@@ -283,12 +285,14 @@ with conn.cursor() as cursor: | |
| With `kill_on_interrupt` enabled, which is the default, a `KeyboardInterrupt` while `execute()` waits for the calculation | ||
| requests cancellation, waits until the calculation reaches a terminal state, and then propagates. | ||
| The `state` property returns that terminal state. | ||
| If the cancellation request fails, the `KeyboardInterrupt` propagates with the error as its cause. | ||
| If the cancellation request or that wait fails, the `KeyboardInterrupt` propagates with the error as its cause, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review of the repairs (both perspectives) and independent follow-up (relayed). Result: CLEAN Self-review of
Codex CLI, reported model Covered: every sentence in Spark’s Cancellation section and asyncio counterpart, Query cancellation on interrupt, and Task cancellation, against all nine named source files and the supplied Athena observations. Previous finding: resolved. The notes cover failed cancellation requests and failed subsequent waits, including Spark’s CLEAN — no remaining actionable false statements found. Static review only; no files changed or tests/network operations performed. |
||
| and the `state` property returns `None`. | ||
|
|
||
| A `KeyboardInterrupt` while `execute()` is still starting the calculation first waits for the | ||
| [StartCalculationExecution](https://docs.aws.amazon.com/athena/latest/APIReference/API_StartCalculationExecution.html) | ||
| request to finish, and then cancels the calculation it started in the same way. | ||
| The `calculation_id` property returns that calculation's ID. | ||
| If `execute()` has not begun the request when the interrupt is handled, the request is never sent and `calculation_id` is `None`. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent follow-up review (relayed): Codex CLI, reported model Covered: the new diff, the entire Cancellation section, all four named source files, and the supplied Athena observations. Static review only. Previous finding: resolved by FINDINGS
Disposition: fixed in 0c64829 (pre-existing text from #833, kept in scope because this PR tightens this section). Verified:
|
||
| A second `KeyboardInterrupt` during this wait propagates at once without cancelling the calculation. | ||
| A cancellation request sent right after a calculation starts can occasionally have no effect, so the calculation can still end in the `COMPLETED` state. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review rounds 1 and 2 (docs-only): range
2fcbcdbe7ae01b31a4a3bb613e6bccdfcd382014..b304b3c5a12546f7b8a0288b60e2a05cad10e326. Result: CLEANRound 1, content against the code:
cancel()and the interrupt paths sendStopCalculationExecutiononce, throughSparkBaseCursor._cancel/AioSparkCursor._cancel, and wait for whatever terminal state Athena reports. The cursor guarantees no particular outcome, which matches "usually".COMPLETEDstate").Round 2, claims against the evidence:
COMPLETEDafter about 95 s).paths-ignore: ['docs/**', '**.md']in.github/workflows/test.yaml.docs/orpyathena/contains the "within seconds" wording (git grep).