You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jason810496 (via GitHub)" <gi...@apache.org> on 2026/10/01 15:14:55 UTC
[PR] Move the Dag file processor's shared plumbing into a base class [airflow]
jason810496 opened a new pull request, #74040:
URL: https://github.com/apache/airflow/pull/74040
STACKLINE
related: #71929
Part of the native Dag e2e stack, split out of #74035. Builds on #74034 ([layer diff](https://github.com/apache/airflow/compare/jason/lang-sdk-e2e/02b-shared-dag-cycle-detection...jason/lang-sdk-e2e/03a-dag-processor-base)).
## Why
A native Lang-SDK Dag file is parsed by a different child process than a Python Dag file (P4). Both need the same plumbing for the Dag processor manager.
## What changes
No behavior change. `DagFileProcessorProcess` is split into a new `BaseDagFileProcessorProcess`, which holds what any parse child needs: the parse log, the requests answered with the API client, the parse result and the readiness check. `DagFileProcessorProcess` keeps the Python-specific start and callbacks. Each class declares its own `_request_handlers`, typed with itself, from the base's `_common_request_handlers`.
## How to test
```bash
uv run --project airflow-core pytest airflow-core/tests/unit/dag_processing/test_processor.py airflow-core/tests/unit/dag_processing/test_manager.py -xvs
```
---
##### Was generative AI tooling used to co-author this PR?
- [x] Yes, with help of Claude Code Opus 5.5 following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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
Re: [PR] Move the Dag file processor's shared plumbing into a base class [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #74040:
URL: https://github.com/apache/airflow/pull/74040#discussion_r4165740630
##########
airflow-core/src/airflow/dag_processing/processor.py:
##########
@@ -573,18 +573,17 @@ def in_process_api_server() -> InProcessExecutionAPI:
@attrs.define(kw_only=True)
-class DagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
+class BaseDagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
"""
- Parses dags with Task SDK API.
-
- This class provides a wrapper and management around a subprocess to parse a specific DAG file.
+ Parse one Dag file in a child process for the Dag processor manager.
- Since DAGs are written with the Task SDK, we need to parse them in a task SDK process such that
- we can use the Task SDK definitions when serializing. This prevents potential conflicts with classes
- in core Airflow.
+ The child's output goes to the file's parse log, and its requests are answered with
+ :attr:`client`. The parse is done once the child has exited and all its sockets are closed;
+ :attr:`parsing_result` then holds what it sent. Subclasses start the child and send it the
+ parse request.
"""
- logger_filehandle: BinaryIO
+ logger_filehandle: BinaryIO | None = None
Review Comment:
Should this attribute be removed from the base class completely? Other langsdk process use sockets and won't use this. It feels weird to always have this declared in the base class while only the python one will actually use it.
Maybe that should be moved down. Base class can use 'has attr' instead.
##########
airflow-core/src/airflow/dag_processing/processor.py:
##########
@@ -573,18 +573,17 @@ def in_process_api_server() -> InProcessExecutionAPI:
@attrs.define(kw_only=True)
-class DagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
+class BaseDagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
"""
- Parses dags with Task SDK API.
-
- This class provides a wrapper and management around a subprocess to parse a specific DAG file.
+ Parse one Dag file in a child process for the Dag processor manager.
- Since DAGs are written with the Task SDK, we need to parse them in a task SDK process such that
- we can use the Task SDK definitions when serializing. This prevents potential conflicts with classes
- in core Airflow.
+ The child's output goes to the file's parse log, and its requests are answered with
+ :attr:`client`. The parse is done once the child has exited and all its sockets are closed;
+ :attr:`parsing_result` then holds what it sent. Subclasses start the child and send it the
+ parse request.
"""
- logger_filehandle: BinaryIO
+ logger_filehandle: BinaryIO | None = None
Review Comment:
Should this attribute be removed from the base class completely? Other langsdk process use sockets and won't use this. It feels weird to always have this declared in the base class while only the python one will actually use it.
Maybe that should be moved down. Base class can use 'has attr' instead if necessary.
--
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
Re: [PR] Move the Dag file processor's shared plumbing into a base class [airflow]
Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 merged PR #74040:
URL: https://github.com/apache/airflow/pull/74040
--
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
Re: [PR] Move the Dag file processor's shared plumbing into a base class [airflow]
Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 commented on code in PR #74040:
URL: https://github.com/apache/airflow/pull/74040#discussion_r4166631901
##########
airflow-core/src/airflow/dag_processing/processor.py:
##########
@@ -573,18 +573,17 @@ def in_process_api_server() -> InProcessExecutionAPI:
@attrs.define(kw_only=True)
-class DagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
+class BaseDagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
"""
- Parses dags with Task SDK API.
-
- This class provides a wrapper and management around a subprocess to parse a specific DAG file.
+ Parse one Dag file in a child process for the Dag processor manager.
- Since DAGs are written with the Task SDK, we need to parse them in a task SDK process such that
- we can use the Task SDK definitions when serializing. This prevents potential conflicts with classes
- in core Airflow.
+ The child's output goes to the file's parse log, and its requests are answered with
+ :attr:`client`. The parse is done once the child has exited and all its sockets are closed;
+ :attr:`parsing_result` then holds what it sent. Subclasses start the child and send it the
+ parse request.
"""
- logger_filehandle: BinaryIO
+ logger_filehandle: BinaryIO | None = None
Review Comment:
Remove in current PR, but the further https://github.com/apache/airflow/pull/74043/changes/9c3e5f0c0d5276d4ba135d63e355cee619c04a48 will still need the attribute at Lang SDK processor only, the Python processor still keep the existing attributes.
--
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
Re: [PR] Move the Dag file processor's shared plumbing into a base class [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #74040:
URL: https://github.com/apache/airflow/pull/74040#discussion_r4165740630
##########
airflow-core/src/airflow/dag_processing/processor.py:
##########
@@ -573,18 +573,17 @@ def in_process_api_server() -> InProcessExecutionAPI:
@attrs.define(kw_only=True)
-class DagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
+class BaseDagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
"""
- Parses dags with Task SDK API.
-
- This class provides a wrapper and management around a subprocess to parse a specific DAG file.
+ Parse one Dag file in a child process for the Dag processor manager.
- Since DAGs are written with the Task SDK, we need to parse them in a task SDK process such that
- we can use the Task SDK definitions when serializing. This prevents potential conflicts with classes
- in core Airflow.
+ The child's output goes to the file's parse log, and its requests are answered with
+ :attr:`client`. The parse is done once the child has exited and all its sockets are closed;
+ :attr:`parsing_result` then holds what it sent. Subclasses start the child and send it the
+ parse request.
"""
- logger_filehandle: BinaryIO
+ logger_filehandle: BinaryIO | None = None
Review Comment:
Should this attribute be removed from the base class completely? Other langsdk process use sockets and won't use this. It feels weird to always have this declared in the base class while only the python one will actually use it.
Maybe that should be moved down. Base class can use 'has attr' instead if necessary when accessing this.
--
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
Re: [PR] Move the Dag file processor's shared plumbing into a base class [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #74040:
URL: https://github.com/apache/airflow/pull/74040#discussion_r4165740630
##########
airflow-core/src/airflow/dag_processing/processor.py:
##########
@@ -573,18 +573,17 @@ def in_process_api_server() -> InProcessExecutionAPI:
@attrs.define(kw_only=True)
-class DagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
+class BaseDagFileProcessorProcess(WatchedSubprocess, LoggingMixin):
"""
- Parses dags with Task SDK API.
-
- This class provides a wrapper and management around a subprocess to parse a specific DAG file.
+ Parse one Dag file in a child process for the Dag processor manager.
- Since DAGs are written with the Task SDK, we need to parse them in a task SDK process such that
- we can use the Task SDK definitions when serializing. This prevents potential conflicts with classes
- in core Airflow.
+ The child's output goes to the file's parse log, and its requests are answered with
+ :attr:`client`. The parse is done once the child has exited and all its sockets are closed;
+ :attr:`parsing_result` then holds what it sent. Subclasses start the child and send it the
+ parse request.
"""
- logger_filehandle: BinaryIO
+ logger_filehandle: BinaryIO | None = None
Review Comment:
Should this be removed from the base class? Other langsdk process use sockets and won't use this. It feels weird to always have this declared in the base class.
Maybe that should be moved down. Base class can use 'has attr' instead.
--
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