Repository navigation
Use Task SDK TaskInstanceState in OpenSearch log handler - #72444
Conversation
Replaces the airflow.utils.state import with airflow.sdk to reduce the airflow-core dependency in the OpenSearch provider. closes: apache#72409
jroachgolf84
left a comment
There was a problem hiding this comment.
Please check the CI failures!
Airflow 3.0.6 does not export TaskInstanceState from airflow.sdk, so the direct import breaks provider compatibility tests. Use the compat SDK shim which falls back to airflow.utils.state on older 3.0.x releases.
|
The CI failure was in the Airflow 3.0.6 compatibility job, not in the normal provider tests. from airflow.sdk import TaskInstanceState Fix: Import it through the compat layer already used in this file: from airflow.providers.common.compat.sdk import AirflowException, TaskInstanceState, conf |
|
@jroachgolf84 @rawwar Checking if you have comment or feedback on this PR. |
|
cc: @rawwar - do you mind taking a look? |
|
@jroachgolf84 , @rawwar Thanks, I see my PR is approved. But how can I merge it? |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
Replace the
airflow.utils.stateimport withairflow.sdkin the OpenSearch task loghandler, so the provider relies on the Task SDK instead of
airflow-core.airflow.sdk.TaskInstanceStateandairflow.utils.state.TaskInstanceStateare twoindependently defined
(str, Enum)classes with matching member names and string values,so this is a like-for-like import swap with no behaviour change. The provider requires
apache-airflow>=3.0.0, soairflow.sdkis always available and no version guard isneeded here, unlike providers that still support Airflow 2.11+.
Existing unit tests pass unmodified.
closes: #72409
related: #62063
Was generative AI tooling used to co-author this PR?
Generated-by: Cursor (Claude Opus 5) following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.