kaxil commented on a change in pull request #8651:
URL: https://github.com/apache/airflow/pull/8651#discussion_r419009982



##########
File path: airflow/models/taskinstance.py
##########
@@ -1009,19 +1010,25 @@ def signal_handler(signum, frame):
                     self.log.error("Failed when executing execute callback")
                     self.log.exception(e3)
 
-                # If a timeout is specified for the task, make it fail
-                # if it goes beyond
-                result = None
-                if task_copy.execution_timeout:
+                with ExitStack() as exit_stack:
+                    from airflow.task.context.current import 
set_current_context
                     try:
-                        with timeout(int(
-                                task_copy.execution_timeout.total_seconds())):
-                            result = task_copy.execute(context=context)
+                        exit_stack.enter_context(set_current_context(context))
+                        user_defined_exec_context = 
self.get_user_defined_execute_context(context)
+                        if user_defined_exec_context is not None:
+                            exit_stack.enter_context(user_defined_exec_context)
+
+                        if task_copy.execution_timeout:
+                            # If a timeout is specified for the task, make it 
fail
+                            # if it goes beyond
+                            timeout_secs = int(
+                                task_copy.execution_timeout.total_seconds())

Review comment:
       ```suggestion
                               timeout_secs = 
int(task_copy.execution_timeout.total_seconds())
   ```




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


Reply via email to