sjyangkevin commented on code in PR #62393:
URL: https://github.com/apache/airflow/pull/62393#discussion_r2844013995


##########
providers/databricks/src/airflow/providers/databricks/operators/databricks.py:
##########
@@ -921,8 +921,15 @@ def execute(self, context: Context):
             self.json["job_id"] = job_id
             del self.json["job_name"]
 
-        if self.cancel_previous_runs and self.json["job_id"] is not None:
-            hook.cancel_all_runs(self.json["job_id"])
+        if self.cancel_previous_runs:
+            job_id = self.json.get("job_id")
+
+            if job_id is None:
+                raise AirflowException(

Review Comment:
   Thanks for the contribution. I would suggest don't raise `AirflowException` 
directly based on the discussion:
   
   https://lists.apache.org/thread/t8bnhyqy77kq4fk7fj3fmjd5wo9kv6w0
   
   as well as the contribution guide 
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#dont-raise-airflowexception-directly
   



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