nuclearpinguin commented on a change in pull request #7232: [AIRFLOW-6569] 
Flush pending Sentry exceptions before exiting forked process
URL: https://github.com/apache/airflow/pull/7232#discussion_r374117216
 
 

 ##########
 File path: airflow/task/task_runner/standard_task_runner.py
 ##########
 @@ -80,8 +81,11 @@ def _start_by_fork(self):
 
             try:
                 args.func(args, dag=self.dag)
+                # Explicitly flush any pending exception to Sentry if enabled
+                Sentry.flush()
                 os._exit(0)
             except Exception:
+                Sentry.flush()
                 os._exit(1)
 
 Review comment:
   How about:
   ```python
   try:
       args.func(args, dag=self.dag)
       return_code = 0
   except Exception:
       return_code = 1
   finally:
       Sentry.flush()
       os._exit(return_code)
   ```
       

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to