Skip to content

Conversation

@ashb
Copy link
Member

@ashb ashb commented Nov 13, 2025

This change relates to #51422, #54706 and gives us a single function that we can call from the Python Virtual env script to re-connect the SUPERVISOR_COMMS and logs socket, so variables and connections are accessible from within the VEnv task, as long as task-sdk is installed.

This also fixes logs produced by a venv task to not be double "encoded" (i.e. so that we directly see the actual log, not a stringification of the entire log line with two timestamps etc.)

There is a matching change to the Venv script to use this function, but it is separated into a different PR so that we don't merge core/sdk and provider changes in one PR.

The crux of the change in the venv operator (that I've already tested) is this

+try:
+    from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+    pass
+else:
+  reinit_supervisor_comms = getattr(task_runner, "reinit_supervisor_comms")
+  if reinit_supervisor_comms:
+      reinit_supervisor_comms()

(cherry picked from commit ff4e471)


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

…in task processes (#57212)

This change relates to #51422, #54706 and gives us a single function that we
can call from the Python Virtual env script to re-connect the SUPERVISOR_COMMS
and logs socket, so variables and connections are accessible from within the
VEnv task, as long as task-sdk is installed.

This also fixes logs produced by a venv task to not be double "encoded" (i.e.
so that we directly see the actual log, not a stringification of the entire
log line with two timestamps etc.)

There is a matching change to the Venv script to use this function, but it is
separated into a different PR so that we don't merge core/sdk and provider
changes in one PR.

The crux of the change in the venv operator (that I've already tested) is this

```diff
+try:
+    from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+    pass
+else:
+  reinit_supervisor_comms = getattr(task_runner, "reinit_supervisor_comms")
+  if reinit_supervisor_comms:
+      reinit_supervisor_comms()
```
(cherry picked from commit ff4e471)

Co-authored-by: Ash Berlin-Taylor <ash@apache.org>
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ashb ashb merged commit d1af245 into v3-1-test Nov 13, 2025
64 checks passed
@ashb ashb deleted the backport-ff4e471-v3-1-test branch November 13, 2025 13:05
ephraimbuddy pushed a commit that referenced this pull request Nov 18, 2025
…in task processes (#57212) (#58263)

This change relates to #51422, #54706 and gives us a single function that we
can call from the Python Virtual env script to re-connect the SUPERVISOR_COMMS
and logs socket, so variables and connections are accessible from within the
VEnv task, as long as task-sdk is installed.

This also fixes logs produced by a venv task to not be double "encoded" (i.e.
so that we directly see the actual log, not a stringification of the entire
log line with two timestamps etc.)

There is a matching change to the Venv script to use this function, but it is
separated into a different PR so that we don't merge core/sdk and provider
changes in one PR.

The crux of the change in the venv operator (that I've already tested) is this

```diff
+try:
+    from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+    pass
+else:
+  reinit_supervisor_comms = getattr(task_runner, "reinit_supervisor_comms")
+  if reinit_supervisor_comms:
+      reinit_supervisor_comms()
```
(cherry picked from commit ff4e471)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
ephraimbuddy pushed a commit that referenced this pull request Nov 19, 2025
…in task processes (#57212) (#58263)

This change relates to #51422, #54706 and gives us a single function that we
can call from the Python Virtual env script to re-connect the SUPERVISOR_COMMS
and logs socket, so variables and connections are accessible from within the
VEnv task, as long as task-sdk is installed.

This also fixes logs produced by a venv task to not be double "encoded" (i.e.
so that we directly see the actual log, not a stringification of the entire
log line with two timestamps etc.)

There is a matching change to the Venv script to use this function, but it is
separated into a different PR so that we don't merge core/sdk and provider
changes in one PR.

The crux of the change in the venv operator (that I've already tested) is this

```diff
+try:
+    from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+    pass
+else:
+  reinit_supervisor_comms = getattr(task_runner, "reinit_supervisor_comms")
+  if reinit_supervisor_comms:
+      reinit_supervisor_comms()
```
(cherry picked from commit ff4e471)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
ephraimbuddy pushed a commit that referenced this pull request Nov 19, 2025
…in task processes (#57212) (#58263)

This change relates to #51422, #54706 and gives us a single function that we
can call from the Python Virtual env script to re-connect the SUPERVISOR_COMMS
and logs socket, so variables and connections are accessible from within the
VEnv task, as long as task-sdk is installed.

This also fixes logs produced by a venv task to not be double "encoded" (i.e.
so that we directly see the actual log, not a stringification of the entire
log line with two timestamps etc.)

There is a matching change to the Venv script to use this function, but it is
separated into a different PR so that we don't merge core/sdk and provider
changes in one PR.

The crux of the change in the venv operator (that I've already tested) is this

```diff
+try:
+    from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+    pass
+else:
+  reinit_supervisor_comms = getattr(task_runner, "reinit_supervisor_comms")
+  if reinit_supervisor_comms:
+      reinit_supervisor_comms()
```
(cherry picked from commit ff4e471)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
ephraimbuddy pushed a commit that referenced this pull request Nov 20, 2025
…in task processes (#57212) (#58263)

This change relates to #51422, #54706 and gives us a single function that we
can call from the Python Virtual env script to re-connect the SUPERVISOR_COMMS
and logs socket, so variables and connections are accessible from within the
VEnv task, as long as task-sdk is installed.

This also fixes logs produced by a venv task to not be double "encoded" (i.e.
so that we directly see the actual log, not a stringification of the entire
log line with two timestamps etc.)

There is a matching change to the Venv script to use this function, but it is
separated into a different PR so that we don't merge core/sdk and provider
changes in one PR.

The crux of the change in the venv operator (that I've already tested) is this

```diff
+try:
+    from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+    pass
+else:
+  reinit_supervisor_comms = getattr(task_runner, "reinit_supervisor_comms")
+  if reinit_supervisor_comms:
+      reinit_supervisor_comms()
```
(cherry picked from commit ff4e471)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Dec 1, 2025
@ephraimbuddy ephraimbuddy added this to the Airflow 3.1.4 milestone Dec 2, 2025
ephraimbuddy pushed a commit that referenced this pull request Dec 3, 2025
…in task processes (#57212) (#58263)

This change relates to #51422, #54706 and gives us a single function that we
can call from the Python Virtual env script to re-connect the SUPERVISOR_COMMS
and logs socket, so variables and connections are accessible from within the
VEnv task, as long as task-sdk is installed.

This also fixes logs produced by a venv task to not be double "encoded" (i.e.
so that we directly see the actual log, not a stringification of the entire
log line with two timestamps etc.)

There is a matching change to the Venv script to use this function, but it is
separated into a different PR so that we don't merge core/sdk and provider
changes in one PR.

The crux of the change in the venv operator (that I've already tested) is this

```diff
+try:
+    from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+    pass
+else:
+  reinit_supervisor_comms = getattr(task_runner, "reinit_supervisor_comms")
+  if reinit_supervisor_comms:
+      reinit_supervisor_comms()
```
(cherry picked from commit ff4e471)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:task-sdk type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants