Skip to content

Fix deferrable mode for SparkKubernetesOperator #51956

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

Merged

Conversation

MaksYermak
Copy link
Contributor

@MaksYermak MaksYermak commented Jun 20, 2025

In this PR I have fixed deferrable mode for SparkKubernetesOperator.

The error appears at the beginning of execute_async when the operator tries to run the build_pod_request_obj function. This function builds a pod object, but the SparkKubernetesOperator operator also creates this object in its execute method. And creating the second time this object produce the error:
Screenshot 2025-06-24 9 40 57 AM

But KubernetesPodOperator produces the error only for deferrable mode in the execute_async method. Because for execute_sync the logic was updated to prevent this error in the initial PR aa25aff#diff-93707635f12195e7b94d14cf99675542592a28a6eb552895fb3ff37d42713740 for SparkKubernetesOperator.

In the current PR I have equalized the logic for both modes.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues labels Jun 20, 2025
@eladkal eladkal requested a review from romsharon98 June 20, 2025 11:22
Copy link
Collaborator

@sunank200 sunank200 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate more on the issue with current deferrable logic on PR description please?

Can we update the test as well please?

@MaksYermak MaksYermak force-pushed the fix-def-mode-for-spark-k8s-operator branch from db40f8e to 7666db9 Compare June 24, 2025 14:12
@MaksYermak
Copy link
Contributor Author

Can you elaborate more on the issue with current deferrable logic on PR description please?

Can we update the test as well please?

@sunank200 I have updated the description and added a new test

@MaksYermak MaksYermak force-pushed the fix-def-mode-for-spark-k8s-operator branch from 7666db9 to 359d7bd Compare June 24, 2025 14:19
@MaksYermak MaksYermak force-pushed the fix-def-mode-for-spark-k8s-operator branch from 359d7bd to c453684 Compare June 25, 2025 09:24
@VladaZakharova
Copy link
Contributor

@potiuk Hi there!
Can you please check this PR?:)
thank you :)

@potiuk potiuk merged commit 67df7f3 into apache:main Jun 30, 2025
80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants