This is an automated email from the ASF dual-hosted git repository.

eladkal 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 80522b91bb catch sentry flush if exception happens in _execute_in_fork 
finally block (#40060)
80522b91bb is described below

commit 80522b91bb9802a6de6546ca9796a46cc1894f07
Author: Wei Lee <[email protected]>
AuthorDate: Fri Jun 7 17:01:18 2024 +0900

    catch sentry flush if exception happens in _execute_in_fork finally block 
(#40060)
    
    * feat(providers/celery): catch sentry flush exception in _execute_in_fork
    
    * feat(providers/celery): add logging.shutdown into finally block
---
 airflow/providers/celery/executors/celery_executor_utils.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/airflow/providers/celery/executors/celery_executor_utils.py 
b/airflow/providers/celery/executors/celery_executor_utils.py
index 48db3f14ae..5dd2d59ab0 100644
--- a/airflow/providers/celery/executors/celery_executor_utils.py
+++ b/airflow/providers/celery/executors/celery_executor_utils.py
@@ -175,8 +175,12 @@ def _execute_in_fork(command_to_exec: CommandType, 
celery_task_id: str | None =
         log.exception("[%s] Failed to execute task.", celery_task_id)
         ret = 1
     finally:
-        Sentry.flush()
-        logging.shutdown()
+        try:
+            Sentry.flush()
+            logging.shutdown()
+        except Exception:
+            log.exception("[%s] Failed to clean up.", celery_task_id)
+            ret = 1
         os._exit(ret)
 
 

Reply via email to