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

kaxilnaik pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 49556d9414233f7f9ca651a685aa8e49505f82db
Author: Kalyan R <[email protected]>
AuthorDate: Sun Oct 5 02:05:17 2025 +0530

    include task instance id in log printed by supervisor (#56383)
    
    * include task instance id in log printed by supervisor
    
    * fix test
    
    (cherry picked from commit 3a93f9b075b55fc3f657288e140cbdf46d92c56d)
---
 task-sdk/src/airflow/sdk/execution_time/supervisor.py     | 8 +++++++-
 task-sdk/tests/task_sdk/execution_time/test_supervisor.py | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/task-sdk/src/airflow/sdk/execution_time/supervisor.py 
b/task-sdk/src/airflow/sdk/execution_time/supervisor.py
index 632ceb9904b..c1301a94e46 100644
--- a/task-sdk/src/airflow/sdk/execution_time/supervisor.py
+++ b/task-sdk/src/airflow/sdk/execution_time/supervisor.py
@@ -1921,7 +1921,13 @@ def supervise(
 
     exit_code = process.wait()
     end = time.monotonic()
-    log.info("Task finished", exit_code=exit_code, duration=end - start, 
final_state=process.final_state)
+    log.info(
+        "Task finished",
+        task_instance_id=str(ti.id),
+        exit_code=exit_code,
+        duration=end - start,
+        final_state=process.final_state,
+    )
     if log_path and log_file_descriptor:
         log_file_descriptor.close()
     return exit_code
diff --git a/task-sdk/tests/task_sdk/execution_time/test_supervisor.py 
b/task-sdk/tests/task_sdk/execution_time/test_supervisor.py
index e3b34620662..8ccb1bab4d5 100644
--- a/task-sdk/tests/task_sdk/execution_time/test_supervisor.py
+++ b/task-sdk/tests/task_sdk/execution_time/test_supervisor.py
@@ -667,6 +667,7 @@ class TestWatchedSubprocess:
             "level": "info",
             "logger": "supervisor",
             "loc": mocker.ANY,
+            "task_instance_id": str(ti.id),
         } in captured_logs
 
     def test_supervisor_handles_already_running_task(self):

Reply via email to