Under which category would you file this issue?
Providers
Apache Airflow version
3.3.0
What happened and how to reproduce it?
Description
Following the refactoring of SparkSubmitOperator into backend strategy classes (_KubernetesSparkSubmitBackend, _YarnSparkSubmitBackend, _StandaloneSparkSubmitBackend), several operator backend methods reach directly into private attributes and methods of SparkSubmitHook:
hook._conf
hook._kubernetes_driver_pod
hook._yarn_application_id
hook._poll_k8s_driver_via_api()
Reaching into private _ members across class boundaries weakens object encapsulation between SparkSubmitOperator and SparkSubmitHook.
Proposed Solution
Promote these key internal attributes and methods on SparkSubmitHook to clean public interface methods/properties:
- Expose
@property def conf(self) on SparkSubmitHook.
- Expose
@property def kubernetes_driver_pod(self) (getter and setter).
- Expose
@property def yarn_application_id(self).
- Promote
_poll_k8s_driver_via_api() to public poll_k8s_driver_via_api().
Update _SparkSubmitDeploymentBackend strategy classes in spark_submit.py to use these clean public hook methods.
Related Context
Follow-up thought from PR #68679 review.
Are you willing to submit PR?
Code of Conduct
Under which category would you file this issue?
Providers
Apache Airflow version
3.3.0
What happened and how to reproduce it?
Description
Following the refactoring of
SparkSubmitOperatorinto backend strategy classes (_KubernetesSparkSubmitBackend,_YarnSparkSubmitBackend,_StandaloneSparkSubmitBackend), several operator backend methods reach directly into private attributes and methods ofSparkSubmitHook:hook._confhook._kubernetes_driver_podhook._yarn_application_idhook._poll_k8s_driver_via_api()Reaching into private
_members across class boundaries weakens object encapsulation betweenSparkSubmitOperatorandSparkSubmitHook.Proposed Solution
Promote these key internal attributes and methods on
SparkSubmitHookto clean public interface methods/properties:@property def conf(self)onSparkSubmitHook.@property def kubernetes_driver_pod(self)(getter and setter).@property def yarn_application_id(self)._poll_k8s_driver_via_api()to publicpoll_k8s_driver_via_api().Update
_SparkSubmitDeploymentBackendstrategy classes inspark_submit.pyto use these clean public hook methods.Related Context
Follow-up thought from PR #68679 review.
Are you willing to submit PR?
Code of Conduct