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

ephraimanierobi pushed a commit to branch v2-8-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit f40e1c17ee07ebeb6ebf1494e1fc845a00e599dc
Author: Daniel Standish <15932138+dstand...@users.noreply.github.com>
AuthorDate: Tue Nov 21 05:42:18 2023 -0800

    Set mark_end_on_close after set_context (#35761)
    
    In ES task handler, set_context applies its own logic for 
mark_end_on_close, so it we must set the attr after for our override to persist.
---
 airflow/utils/log/task_context_logger.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airflow/utils/log/task_context_logger.py 
b/airflow/utils/log/task_context_logger.py
index 0661789f5b..84ed207e3a 100644
--- a/airflow/utils/log/task_context_logger.py
+++ b/airflow/utils/log/task_context_logger.py
@@ -98,9 +98,9 @@ class TaskContextLogger:
 
         task_handler = copy(self.task_handler)
         try:
+            task_handler.set_context(ti, identifier=self.component_name)
             if hasattr(task_handler, "mark_end_on_close"):
                 task_handler.mark_end_on_close = False
-            task_handler.set_context(ti, identifier=self.component_name)
             filename, lineno, func, stackinfo = logger.findCaller()
             record = logging.LogRecord(
                 self.component_name, level, filename, lineno, msg, args, None, 
func=func

Reply via email to