Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions airflow-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ dependencies = [
"eventlet>=0.37.0",
"gevent>=25.4.1",
"greenlet>=3.1.0",
"greenback>=1.2.1",
]
"graphviz" = [
# The graphviz package creates friction when installing on MacOS as it needs graphviz system package to
Expand Down
15 changes: 15 additions & 0 deletions task-sdk/src/airflow/sdk/definitions/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment thread
dstandish marked this conversation as resolved.
Outdated

log.exception("async_to_sync failed")
raise

@classmethod
async def async_get(cls, conn_id: str) -> Any:
Expand Down
Loading