Skip to content

Add AthenaSparkSensor - #72229

Draft
SameerMesiah97 wants to merge 2 commits into
apache:mainfrom
SameerMesiah97:Add-AthenaSparkSensor
Draft

Add AthenaSparkSensor#72229
SameerMesiah97 wants to merge 2 commits into
apache:mainfrom
SameerMesiah97:Add-AthenaSparkSensor

Conversation

@SameerMesiah97

@SameerMesiah97 SameerMesiah97 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Description

This change introduces a new sensor, AthenaSparkSensor, to wait for an existing Amazon Athena Spark calculation execution to reach a terminal state.

The sensor delegates to AthenaHook Spark calculation helpers to poll the calculation status. It succeeds when the calculation reaches COMPLETED, continues poking while the calculation is in an in-progress state, and raises when the calculation reaches a failed, canceled, or unexpected state.

Rationale

Amazon Athena Spark calculations are identified by a calculation_execution_id after they are submitted. While AthenaSparkOperator can submit Spark code and wait for completion, users may also need to monitor calculations started outside the operator, for example by another task or by an external system.

Adding AthenaSparkSensor gives DAG authors a provider-native way to wait on an existing Athena Spark calculation without writing custom polling logic around boto3.

Tests

Added unit tests verifying that:

  • the sensor inherits the expected AWS hook configuration behavior.
  • successful calculation states are handled correctly.
  • in-progress states such as CREATING, CREATED, QUEUED, and RUNNING continue waiting.
  • failed and canceled calculation states raise an error.
  • the state change reason is included when Athena provides one.

Example DAG

Updated the Athena Spark example DAG to demonstrate waiting for an existing Athena Spark calculation execution using AthenaSparkSensor.

Documentation

Added documentation for AthenaSparkSensor, including its expected calculation_execution_id input and an example usage snippet.

Backwards Compatibility

This is a new sensor and does not modify existing Athena sensor behavior. No breaking changes are introduced.

Acknowledgements

This change builds on the Athena Spark provider support previously explored in PR #66576 by @Andisha2004 which proposed adding an Athena Spark hook, sensor, and operator to the Amazon provider. This PR carries that direction forward with a narrower initial scope focused on AthenaSparkSensor methods, along with updated tests, documentation, and an example DAG aligned with current provider conventions.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [GPT 5.5] following the guidelines

Sameer Mesiah added 2 commits August 28, 2026 23:03
Athena Spark calculations through the Athena calculation APIs.

Add AthenaSparkOperator to submit Spark code to an existing Athena Spark
session and wait until the calculation reaches a terminal state. The
operator returns calculation metadata including status, session, working
directory, and result S3 URIs.

Add unit coverage for the new hook methods and operator execution paths,
plus provider documentation and an example DAG for Athena Spark usage.
execution until it reaches a terminal state.

The sensor uses AthenaHook Spark calculation helpers to poll calculation
status, succeeds on completed calculations, continues for in-progress
states, and raises on failed, canceled, or unexpected states.

Add unit coverage for success, intermediate, and failure sensor states,
plus documentation and an example DAG showing how to wait for an existing
Athena Spark calculation execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant