ashb commented on code in PR #58148:
URL: https://github.com/apache/airflow/pull/58148#discussion_r2523733743
##########
providers/standard/src/airflow/providers/standard/utils/python_virtualenv_script.jinja2:
##########
@@ -40,6 +40,16 @@ if sys.version_info >= (3,6):
pass
{% endif %}
+try:
+ from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+ pass
+else:
+ {#- We are in an Airflow 3.x env, try and set up supervisor comms so virtual
env can still access tasks etc! #}
Review Comment:
"suprocess" is wrong here, as it is not a subprocess of where this code is
running, but the process where this is running. I'll tweak a bit.
##########
providers/standard/src/airflow/providers/standard/utils/python_virtualenv_script.jinja2:
##########
@@ -40,6 +40,16 @@ if sys.version_info >= (3,6):
pass
{% endif %}
+try:
+ from airflow.sdk.execution_time import task_runner
+except ModuleNotFoundError:
+ pass
+else:
+ {#- We are in an Airflow 3.x env, try and set up supervisor comms so virtual
env can still access tasks etc! #}
+ reinit_supervisor_comms = getattr(task_runner, "reinit_supervisor_comms",
None)
+ if reinit_supervisor_comms:
+ reinit_supervisor_comms()
Review Comment:
I purposefully didn't do that as that would limit it to only py3.8+, and
while we don't support it in Airflow, using this syntax would 100% break it if
anyone was using an older version of python. I'll add a comment here too
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]