You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dabla (via GitHub)" <gi...@apache.org> on 2026/03/25 18:58:20 UTC

Re: [PR] Remove global from task_runner supervisor-comms [airflow]

dabla commented on code in PR #59876:
URL: https://github.com/apache/airflow/pull/59876#discussion_r2990358661


##########
airflow-core/src/airflow/models/connection.py:
##########
@@ -505,7 +504,9 @@ def get_connection_from_secrets(cls, conn_id: str) -> Connection:
 
         # If this is set it means are in some kind of execution context (Task, Dag Parse or Triggerer perhaps)
         # and should use the Task SDK API server path
-        if hasattr(sys.modules.get("airflow.sdk.execution_time.task_runner"), "SUPERVISOR_COMMS"):
+        from airflow.sdk.execution_time.task_runner import is_supervisor_comms_initialized

Review Comment:
   > Yeah. I think we should solve it differently, I would say here just checking if "task-sdk" is installed should be a better check?
   
   Something like:
   
   if find_spec("airflow.sdk.execution_time.task_runner") is not None:
   
   Used it for IBM MQ provider quite neat if you ask me, even though it's not fully the same as original check but at least it allows you to do a clean check if  "task-sdk" is installed, at least clean code wise.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org