SameerMesiah97 commented on code in PR #64051:
URL: https://github.com/apache/airflow/pull/64051#discussion_r3142033976


##########
providers/airbyte/src/airflow/providers/airbyte/operators/airbyte.py:
##########
@@ -125,10 +140,24 @@ def execute_complete(self, context: Context, event: Any = 
None) -> None:
         Relies on trigger to throw an exception, otherwise it assumes 
execution was
         successful.
         """
+        hook = AirbyteHook(airbyte_conn_id=self.airbyte_conn_id, 
api_version=self.api_version)
         if event["status"] == "error":
             self.log.debug("Error occurred with context: %s", context)
             raise RuntimeError(event["message"])
 
+        job_id = event.get("job_id")
+        if event["status"] == "timeout":
+            if job_id:
+                self.log.info("Cancelling Airbyte job %s due to execution 
timeout", job_id)
+                try:
+                    hook.cancel_job(job_id=job_id)
+                except Exception as e:
+                    self.log.warning("Failed to cancel Airbyte job %s: %s", 
job_id, e)
+            else:
+                self.log.warning("No job_id found; skipping cancellation")
+
+            raise RuntimeError(event["message"])

Review Comment:
   Fixed. I have used `RuntimeError` because `AirflowException` is blocked by 
CI now.



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