You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "kaxil (via GitHub)" <gi...@apache.org> on 2026/04/14 19:18:07 UTC

Re: [PR] Cache InProcessExecutionAPI in dag.test() to avoid per-task FastAPI app creation [airflow]

kaxil commented on code in PR #65235:
URL: https://github.com/apache/airflow/pull/65235#discussion_r3081843124


##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -1692,15 +1694,18 @@ def start(  # type: ignore[override]
     @staticmethod
     def _api_client(dag=None):
         api = in_process_api_server()
+        from airflow.api_fastapi.common.dagbag import dag_bag_from_app
+
         if dag is not None:
-            from airflow.api_fastapi.common.dagbag import dag_bag_from_app
             from airflow.models.dagbag import DBDagBag
 
             # This is needed since the Execution API server uses the DBDagBag in its "state".
             # This `app.state.dag_bag` is used to get some Dag properties like `fail_fast`.
             dag_bag = DBDagBag()
 
             api.app.dependency_overrides[dag_bag_from_app] = lambda: dag_bag
+        else:
+            api.app.dependency_overrides.pop(dag_bag_from_app, None)

Review Comment:
   done



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org