victorymakes commented on code in PR #69442:
URL: https://github.com/apache/airflow/pull/69442#discussion_r3635929061


##########
providers/databricks/src/airflow/providers/databricks/operators/databricks.py:
##########
@@ -1941,6 +1940,25 @@ def execute_complete(self, context: dict | None, event: 
dict) -> None:
         errors = event.get("errors", [])
         self._handle_terminal_run_state(run_state, errors)
 
+    def on_kill(self) -> None:
+        if self.databricks_run_id is None:
+            return
+        if self._databricks_workflow_task_group:
+            # Workflow member: cancel only this task's child run, not the 
shared parent workflow run.
+            # Cancelling the parent would also stop all sibling tasks.
+            try:
+                run_id_to_cancel = 
self._get_current_databricks_task()["run_id"]
+            except Exception:

Review Comment:
   Good catch. Removed the fallback — if `_get_current_databricks_task` raises, 
`on_kill` now logs the exception and returns without calling `cancel_run` at 
all. Added a test where the method raises and asserts `cancel_run` is not 
called with the parent id.



-- 
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]

Reply via email to