ashb commented on code in PR #56191:
URL: https://github.com/apache/airflow/pull/56191#discussion_r2387043309
##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -177,10 +203,13 @@ def _get_connection(conn_id: str) -> Connection:
# will make that module depend on Task SDK, which is not ideal because
we intend to
# keep Task SDK as a separate package than execution time mods.
# Also applies to _async_get_connection.
+ from airflow.sdk.execution_time import task_runner
from airflow.sdk.execution_time.comms import GetConnection
- from airflow.sdk.execution_time.task_runner import SUPERVISOR_COMMS
- msg = SUPERVISOR_COMMS.send(GetConnection(conn_id=conn_id))
+ if comms := getattr(task_runner, "SUPERVISOR_COMMS", None):
Review Comment:
I don't feel great about putting this here for two reasons:
1. What about xcom or variables?
2. If somehow you hit a path in the sdk where supervisor comss isn't set up
yet this will lead to super odd behaviour.
I think I'd prefer being explicit about when we enable this mode, and have a
` with Something()` inside the log reading path that only temporarily sets
SUPERVISOR_COMMS to a valid value (and listeners can do the same _if they need
it_)
--
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]