adiranjan25 commented on code in PR #75923:
URL: https://github.com/apache/airflow/pull/75923#discussion_r4430218750
##########
providers/apache/spark/tests/unit/apache/spark/hooks/test_spark_submit.py:
##########
@@ -1125,6 +1125,32 @@ def test_process_spark_driver_status_log(self):
assert hook._driver_status == "RUNNING"
+ @patch("airflow.providers.apache.spark.hooks.spark_submit.time.sleep")
+
@patch("airflow.providers.apache.spark.hooks.spark_submit.subprocess.Popen")
+ def test_standalone_status_tracking_resets_failures_after_success(self,
mock_popen, mock_sleep):
+ """Intermittent polling failures must not exhaust the consecutive
retry limit."""
+ hook = SparkSubmitHook(conn_id="spark_standalone_cluster")
+ hook._driver_id = "driver-123"
+ hook._driver_status = "RUNNING"
+
+ returncodes = [code for _ in range(11) for code in (1, 0)] + [0]
+ processes = []
+
+ for index, returncode in enumerate(returncodes):
+ process = MagicMock()
Review Comment:
Thanks for the review and suggestion, @aaron-y-chen!
I've updated the process mock to use `MagicMock(spec=["stdout", "wait"])` in
commit `4b3fd171`, following the project's `AGENTS.md` guidance.
I also reran the targeted regression test locally, and it passed
successfully.
Thanks again for your feedback!
--
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]