dstandish commented on code in PR #55799:
URL: https://github.com/apache/airflow/pull/55799#discussion_r2356782072
##########
task-sdk/src/airflow/sdk/definitions/connection.py:
##########
@@ -203,6 +203,21 @@ def get(cls, conn_id: str) -> Any:
return _get_connection(conn_id)
except AirflowRuntimeError as e:
cls._handle_connection_error(e, conn_id)
+ except RuntimeError as e:
+ # The error from async_to_sync is a RuntimeError, so we have to
fall back to text matching
+ if str(e).startswith("You cannot use AsyncToSync in the same
thread as an async event loop"):
+ import warnings
+
+ import greenback
+
+ warnings.warn(
+ "You should not use sync calls here -- use `await
Conn.async_get` instead", stacklevel=2
+ )
+
+ return greenback.with_portal_run(cls.async_get, conn_id)
Review Comment:
doh
--
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]