hunnguye opened a new pull request, #71949:
URL: https://github.com/apache/airflow/pull/71949
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull
request.
Write a good git commit message following this guide:
https://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the
documentation.
For user-facing UI changes, please attach before/after screenshots (or a
short
screen recording) so reviewers can assess the visual impact.
Feel free to ping (in general) for the review if you do not see reaction for
a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we
sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
* closes #71881
# Short Description
Using the SparkSubmitOperator to submit an applicaiton to a Spark standalone
cluster results in `Failed to poll for the driver status 10 times: returncode =
1` even though the job finished correctly on the spark Server side.
The issue is caused by the current driver-status polling logic, which
derives its behavior from the configured master URL but does not sufficiently
distinguish between a master URL pointing to the RPC endpoint on port 7077 and
one pointing to the REST endpoint on port 6066.
# Changes:
* add a rest_endpoint attribute into the connection dictionary, this
contains the correct rest endpoint
* modified and extend _build_spark_driver_kill_command and
_build_track_driver_status_command to apply the corrected rest_endpoint logic
with minimal change to current behaviour
* new rest_endpoint information has also been applied to the the operator
job status request
# Tests:
* extended test cases with separate connection id for the rpc endpoint at
7077
* fully tested against live spark standalone cluster successfully (status
polling, killing, job retry)
# Notes
*
[operators/spark_submit.py](https://github.com/apache/airflow/compare/main...hunnguye:airflow:fix/spark-submit-standalone-status-polling?expand=1#diff-e814d66fc380bd97c78bab6653452aebadf73d8b7ac7cadec52138a785d30664)
assumes a comma separated list of master urls, but as I understand that is not
possible as the hook itself always assumes a single url. I therefore ignored
that assumption.
* Although the kill operation could be handled entirely through the REST
endpoint, I preserved the existing binary kill command to avoid unintended side
effects.
---
##### Was generative AI tooling used to co-author this PR?
- [X ] Yes (ChatGPT for brainstorming. I wrote the code most of the code,
ChatGPT refactored minimally)
<!--
Generated-by: [Tool Name] following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information. Note: commit author/co-author name and email in commits
become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License
Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment:
`{pr_number}.significant.rst`, in
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
You can add this file in a follow-up commit after the PR is created so you
know the PR number.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]