andreahlert commented on code in PR #61630:
URL: https://github.com/apache/airflow/pull/61630#discussion_r2924381919
##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -1747,28 +1747,19 @@ def set_supervisor_comms(temp_comms):
by injecting a test Comms implementation (e.g. `InProcessSupervisorComms`)
in place of the real inter-process communication layer.
- Some parts of the code (e.g. models.Variable.get) check for the presence
- of `task_runner.SUPERVISOR_COMMS` to determine if the code is running in a
Task SDK execution context.
- This override ensures those code paths behave correctly during in-process
tests.
+ Some parts of the code (e.g. models.Variable.get) check that
+ `task_runner.SUPERVISOR_COMMS` is not None to determine if the code is
running in a Task SDK
Review Comment:
Done. Reverted to bare type annotation and switched all checks to hasattr.
##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -820,7 +820,7 @@ def parse(what: StartupDetails, log: Logger) ->
RuntimeTaskInstance:
# deeply nested execution stack.
# - By defining `SUPERVISOR_COMMS` as a global, it ensures that this
communication mechanism is readily
# accessible wherever needed during task execution without modifying every
layer of the call stack.
-SUPERVISOR_COMMS: CommsDecoder[ToTask, ToSupervisor]
+SUPERVISOR_COMMS: CommsDecoder[ToTask, ToSupervisor] = None # type:
ignore[assignment]
Review Comment:
Agreed, reverted. SUPERVISOR_COMMS stays as a bare annotation and the few
places that need to check use hasattr now.
--
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]