Skip to content

Spark: Promote private SparkSubmitHook attributes used by strategy backends to public interface - #71059

Open
onlyarnav wants to merge 2 commits into
apache:mainfrom
onlyarnav:refactor-spark-hook-public-methods
Open

Spark: Promote private SparkSubmitHook attributes used by strategy backends to public interface#71059
onlyarnav wants to merge 2 commits into
apache:mainfrom
onlyarnav:refactor-spark-hook-public-methods

Conversation

@onlyarnav

Copy link
Copy Markdown
Contributor

Description

During the refactoring of SparkSubmitOperator into backend strategy classes (_KubernetesSparkSubmitBackend, _YarnSparkSubmitBackend, _StandaloneSparkSubmitBackend), the strategy backends reached directly into internal/private attributes and methods of SparkSubmitHook:

  • hook._conf
  • hook._kubernetes_driver_pod
  • hook._yarn_application_id
  • hook._driver_id / hook._driver_status
  • hook._connection
  • hook._poll_k8s_driver_via_api()
  • hook._start_yarn_application_status_tracking()
  • hook._kill_yarn_application()
  • hook._start_driver_status_tracking()
  • hook._run_post_submit_commands()

Reaching into private _ members across class boundaries breaks object encapsulation.

This PR promotes these key internal attributes and methods on SparkSubmitHook to clean public interface members:

  • Public Properties: @property def conf, @property def kubernetes_driver_pod (with setter), @property def yarn_application_id, @property def driver_id (with setter), @property def driver_status, @property def connection.
  • Public Methods: poll_k8s_driver_via_api(), start_yarn_application_status_tracking(), kill_yarn_application(), start_driver_status_tracking(), run_post_submit_commands().

The strategy backend classes in spark_submit.py have been updated to use these clean public hook interfaces, and a unit test has been added to test_spark_submit.py.

Related Context

Follow-up thought from PR #68679 review.

fixes: #71058

Fix implicit string literal concatenation missing a space between 'conflicts' and 'with' in _YarnSparkSubmitBackend.
…backends

Promote internal SparkSubmitHook attributes (_conf, _kubernetes_driver_pod, _yarn_application_id, _poll_k8s_driver_via_api, etc.) to public properties and methods, and update operator deployment backends to use them.
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.

Spark: Promote private SparkSubmitHook attributes used by strategy backends to public interface

1 participant