seanghaeli commented on code in PR #54083:
URL: https://github.com/apache/airflow/pull/54083#discussion_r2286676110


##########
task-sdk/src/airflow/sdk/bases/hook.py:
##########
@@ -56,19 +56,10 @@ def get_connection(cls, conn_id: str) -> Connection:
         :param conn_id: connection id
         :return: connection
         """
-        import sys
+        from airflow.sdk.definitions.connection import Connection
 
-        # if SUPERVISOR_COMMS is set, we're in task sdk context
-        if hasattr(sys.modules.get("airflow.sdk.execution_time.task_runner"), 
"SUPERVISOR_COMMS"):
-            from airflow.sdk.definitions.connection import Connection
-
-            conn = Connection.get(conn_id)
-            log.debug("Connection Retrieved '%s' (via task-sdk)", conn.conn_id)
-            return conn
-        from airflow.models.connection import Connection as ConnectionModel
-
-        conn = ConnectionModel.get_connection_from_secrets(conn_id)
-        log.debug("Connection Retrieved '%s' (via core Airflow)", conn.conn_id)
+        conn = Connection.get(conn_id)
+        log.debug("Connection Retrieved '%s' (via task-sdk)", conn.conn_id)

Review Comment:
   Hey, after this commit was merged, many of the Amazon provider system tests 
went down:
   
   https://aws-mwaa.github.io/#/open-source/system-tests/dashboard.html
   
   The change to `get_connection` here is the culprit. The common error message 
I'm getting across different tests and executors, is:
   
   ```
   from airflow.sdk.execution_time.task_runner import SUPERVISOR_COMMS
   ImportError: cannot import name 'SUPERVISOR_COMMS' from 
'airflow.sdk.execution_time.task_runner' 
(/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py)
   ```
   
   @amoghrajesh , what are your thoughts on reverting this to the old logic so 
that we only get the connection via task-sdk if the Task Runner has 
SUPERVISOR_COMMS defined, and otherwise use the connection via core Airflow?



-- 
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]

Reply via email to