amoghrajesh commented on code in PR #57154:
URL: https://github.com/apache/airflow/pull/57154#discussion_r2455289959
##########
task-sdk/src/airflow/sdk/execution_time/secrets/execution_api.py:
##########
@@ -63,6 +63,25 @@ def get_connection(self, conn_id: str) -> Connection | None:
# type: ignore[ove
# Convert ExecutionAPI response to SDK Connection
return _process_connection_result_conn(msg)
+ except RuntimeError as e:
+ # The error from async_to_sync is a RuntimeError, so we have to
fall back to text matching
+ # Handle async_to_sync forbidden in event loop (greenback portal
context)
Review Comment:
Oh the indent.
##########
task-sdk/src/airflow/sdk/execution_time/secrets/execution_api.py:
##########
@@ -63,6 +63,25 @@ def get_connection(self, conn_id: str) -> Connection | None:
# type: ignore[ove
# Convert ExecutionAPI response to SDK Connection
return _process_connection_result_conn(msg)
+ except RuntimeError as e:
+ # The error from async_to_sync is a RuntimeError, so we have to
fall back to text matching
+ # Handle async_to_sync forbidden in event loop (greenback portal
context)
Review Comment:
```suggestion
# SUPERVISOR_COMMS.send() uses async_to_sync internally, which raises
RuntimeError when
# called from within the triggerer's asyncio event loop. In async contexts
like triggers,
# aget_connection() should be used instead. We catch this and return None to
allow
# the connection lookup to fall back to other backends (e.g.,
EnvironmentVariablesBackend).
```
--
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]