1fanwang opened a new pull request, #72419:
URL: https://github.com/apache/airflow/pull/72419
A synchronous Athena task submits another query when its worker exits after
`StartQueryExecution` and Airflow retries it. The retry now resumes the stored
query. A completed query returns without resubmission; failed or cancelled
queries submit normally.
AIP-103 task state is used only for synchronous polling. The operator stores
the query ID before polling, reconnects active queries, and restores the ID and
results link. Deferrable tasks and `client_request_token` behavior do not
change.
## Testing
`uv run --project providers/amazon pytest
providers/amazon/tests/unit/amazon/aws/operators/test_athena.py -xq`
The live test drove the real operator `execute()` path and task state API
against fresh SQLite with a local Athena hook stand-in.
```console
UPSTREAM=/tmp/airflow-athena-main
git worktree add --detach "$UPSTREAM" upstream/main
AIRFLOW_HOME="$PWD/.tmp-athena-e2e" \
LEGACY_ATHENA_OPERATOR_PATH="$UPSTREAM/providers/amazon/src/airflow/providers/amazon/aws/operators/athena.py"
\
uv run --project providers/amazon pytest -p tests_common.pytest_plugin \
dev/test_athena_resumability_e2e.py -xvs
git worktree remove "$UPSTREAM"
```
<details>
<summary>Raw logs</summary>
```text
TASK_STATE_AFTER_CRASH api=query-1 db=query-1
BEFORE stored=query-1 result=query-2 submitted=['query-2']
Reconnecting to existing job external_id=query-1
external_id_key=athena_query_execution_id status=RUNNING
AFTER stored=query-1 result=query-1 submitted=[] operator_id=query-1
link_id=query-1
PASSED
1 passed, 1 warning in 50.94s
```
</details>
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (GitHub Copilot CLI (GPT-5.6 Sol))
Generated-by: GitHub Copilot CLI (GPT-5.6 Sol) following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]