This is an automated email from the ASF dual-hosted git repository.
amoghrajesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 426357062fb Prevent Databricks task failure after successful repair
(#76904)
426357062fb is described below
commit 426357062fb8857d8188a14b60db32e0492b954d
Author: Amogh Desai <[email protected]>
AuthorDate: Thu Nov 12 11:00:34 2026 +0530
Prevent Databricks task failure after successful repair (#76904)
---
.../airflow/providers/databricks/operators/databricks.py | 1 +
.../tests/unit/databricks/operators/test_databricks.py | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git
a/providers/databricks/src/airflow/providers/databricks/operators/databricks.py
b/providers/databricks/src/airflow/providers/databricks/operators/databricks.py
index b17259b6775..e864881492a 100644
---
a/providers/databricks/src/airflow/providers/databricks/operators/databricks.py
+++
b/providers/databricks/src/airflow/providers/databricks/operators/databricks.py
@@ -177,6 +177,7 @@ def _handle_databricks_operator_execution(
repair_json["job_parameters"] =
operator._merged_json["job_parameters"]
hook.repair_run(repair_json)
_handle_databricks_operator_execution(operator, hook, log,
context)
+ return
raise AirflowException(error_message)
log.info("%s in run state: %s", operator.task_id, run_state)
diff --git
a/providers/databricks/tests/unit/databricks/operators/test_databricks.py
b/providers/databricks/tests/unit/databricks/operators/test_databricks.py
index 1f284e530f9..b933eeade54 100644
--- a/providers/databricks/tests/unit/databricks/operators/test_databricks.py
+++ b/providers/databricks/tests/unit/databricks/operators/test_databricks.py
@@ -2593,6 +2593,22 @@ class TestDatabricksRunNowOperator:
assert repair_json_passed["job_parameters"] == {"k": "v"}
assert mock_handle_exec.called
+
@mock.patch("airflow.providers.databricks.operators.databricks.DatabricksHook")
+ def test_sync_repair_that_succeeds_does_not_fail_the_task(self,
db_mock_class):
+ op = DatabricksRunNowOperator(durable=False, task_id=TASK_ID,
job_id=JOB_ID, repair_run=True)
+ db_mock = db_mock_class.return_value
+ db_mock.run_now.return_value = RUN_ID
+ db_mock.get_run.side_effect = [
+ make_run_with_state_mock("TERMINATED", "FAILED").return_value,
+ make_run_with_state_mock("TERMINATED", "SUCCESS").return_value,
+ ]
+ db_mock.get_latest_repair_id.return_value = None
+
+ op.execute(None)
+
+ db_mock.repair_run.assert_called_once()
+ assert db_mock.get_run.call_count == 2
+
@mock.patch("airflow.providers.databricks.operators.databricks.DatabricksHook")
def test_sync_repair_reads_job_parameters_from_merged_json(self,
db_mock_class):
"""Exercise the synchronous (non-deferrable) repair branch in