Expose SparkSubmitHook fields used by submit backends - #71661
Open
Vamsi-klu wants to merge 1 commit into
Open
Conversation
K8s and YARN strategy backends were reaching through private hook state after apache#68679. Promote only the members those backends already use. Co-authored-by: Cursor <cursoragent@cursor.com>
Vamsi-klu
marked this pull request as ready for review
August 15, 2026 23:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#68679 moved K8s/YARN submit tracking into strategy backends. Those backends have to read and mutate
SparkSubmitHookstate that is still private:_conf,_kubernetes_driver_pod,_yarn_application_id,_poll_k8s_driver_via_api,_kill_yarn_application. Closed draft #71059 over-promoted about 10 members. This is the narrower follow-up.What I did
I promoted only the members the backends actually use:
conf— live dict, not a copy, so in-place key writes still workkubernetes_driver_pod— get/setyarn_application_id— get onlypoll_k8s_driver_via_apikill_yarn_application(Yarnon_killhas the same leak)Private names stay as the backing store, so existing hook tests that set
_yarn_application_id/_kubernetes_driver_podkeep working. I switched the K8s and YARN operator backends to the public names.Out of scope, on purpose:
_connection,_start_yarn_application_status_tracking,_run_post_submit_commands,_driver_id/_driver_status.How I did it
Properties and a rename on
SparkSubmitHook, then the same names in_KubernetesSparkSubmitBackendand_YarnSparkSubmitBackend. Operator MagicMock fixtures now use the public names so.conf/.yarn_application_idare not accidental new MagicMocks.Impact
Submit backends no longer reach through private attributes. External subclasses that need the YARN kill or K8s poll can call the public methods. Hook internals and tracking behavior are unchanged.
Testing
Hook tests:
test_conf_mutation_writes_throughtest_kubernetes_driver_pod_writes_throughtest_yarn_application_id_is_get_only(assignment raisesAttributeError)Operator tests updated so MagicMock fixtures hit the public surface, including
on_kill→kill_yarn_application.closes: #71058
Was generative AI tooling used to co-author this PR?
Generated-by: Cursor following the guidelines
Made with Cursor