You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ashb (via GitHub)" <gi...@apache.org> on 2026/10/09 08:44:36 UTC

Re: [PR] Consolidate in-process Execution API hosting [airflow]

ashb commented on code in PR #73327:
URL: https://github.com/apache/airflow/pull/73327#discussion_r4228279886


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -584,7 +577,7 @@ def make_client(self) -> Client:
         """
         from airflow.sdk.api.client import Client
 
-        client = Client(base_url=None, token="", dry_run=True, transport=in_process_api_server().transport)
+        client = Client(base_url=None, token="", dry_run=True, transport=InProcessExecutionAPI().transport)

Review Comment:
   Ditto about create_task_execution_api_app



##########
airflow-core/tests/unit/api_fastapi/execution_api/test_in_process.py:
##########
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import subprocess
+import sys
+
+import pytest
+
+
+@pytest.mark.parametrize(
+    "create_instance",
+    [
+        "from airflow.api_fastapi.execution_api.in_process import InProcessExecutionAPI; "
+        "api = InProcessExecutionAPI(); ",
+        "from airflow.dag_processing.manager import DagFileProcessorManager; "
+        "manager = DagFileProcessorManager(max_runs=1); ",
+    ],
+    ids=["in_process_api", "dag_processor_manager"],
+)
+def test_construction_defers_execution_api_imports(create_instance):

Review Comment:
   This seems like an expensive test. I wonder if there are other ways we could do it that doesn't involve loading a full copy of Airflow?
   
   At the very least, this proc should set the "airflow as library" env to speed up 



##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -304,7 +294,7 @@ class DagFileProcessorManager(LoggingMixin):
     )
     """Resolved once per process so file discovery and the deactivation scan use the same value."""
 
-    _api_server: InProcessExecutionAPI = attrs.field(init=False, factory=_make_execution_api)
+    _api_server: InProcessExecutionAPI = attrs.field(init=False, factory=InProcessExecutionAPI)

Review Comment:
   Is there a reason this didn't/shouldn't-now use `create_task_execution_api_app()`



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