henry3260 commented on code in PR #65587:
URL: https://github.com/apache/airflow/pull/65587#discussion_r3228687532


##########
airflow-core/src/airflow/api_fastapi/execution_api/app.py:
##########
@@ -300,6 +301,17 @@ def get_extra_schemas() -> dict[str, dict]:
     }
 
 
+class _RequestScopedServerContextApp:
+    """Wrap an ASGI app so in-process requests behave like server-side API 
handling."""
+
+    def __init__(self, app: FastAPI) -> None:
+        self.app = app
+
+    async def __call__(self, scope: Any, receive: Any, send: Any) -> None:
+        with override_process_context("server"):
+            await self.app(scope, receive, send)

Review Comment:
   > > if ContextVar is server in should_use_task_sdk_api_path where will 
return false directly,
   > 
   > My bad. I mean `client` in previous comment. The point here is whether 
there will be the case that `ContextVar` is set correctly but 
`SUPERVISOR_COMMS` is not initialized at all.
   > 
   > The `test_in_process_execution_api_uses_request_scoped_server_context` 
test still assume `SUPERVISOR_COMMS` is initialized properly.
   
   oh I got it, thanks jason!



-- 
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]

Reply via email to