-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Move in-process API Client creation to DagFileProcessorManager
#50558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 tasks
jedcunningham
approved these changes
May 13, 2025
2 tasks
e5a74f0
to
fb7c183
Compare
closes apache#50097 closes apache#49887 Previously, each `DagFileProcessorProcess` created its own `InProcessExecutionAPI` client instance, leading to unnecessary thread creation and resource use. This commit ensures that a single `Client` backed by `InProcessExecutionAPI` is created and owned by `DagFileProcessorManager`, and passed into all DAG file processor subprocesses.
fb7c183
to
7802104
Compare
ashb
approved these changes
May 13, 2025
Doc failures are unrelated |
github-actions bot
pushed a commit
that referenced
this pull request
May 13, 2025
closes #50097 closes #49887 Previously, each `DagFileProcessorProcess` created its own `InProcessExecutionAPI` client instance, leading to unnecessary thread creation and resource use. This commit ensures that a single `Client` backed by `InProcessExecutionAPI` is created and owned by `DagFileProcessorManager`, and passed into all DAG file processor subprocesses. (cherry picked from commit 3dc597f) Co-authored-by: Kaxil Naik <[email protected]>
kaxil
added a commit
that referenced
this pull request
May 13, 2025
closes #50097 closes #49887 Previously, each `DagFileProcessorProcess` created its own `InProcessExecutionAPI` client instance, leading to unnecessary thread creation and resource use. This commit ensures that a single `Client` backed by `InProcessExecutionAPI` is created and owned by `DagFileProcessorManager`, and passed into all DAG file processor subprocesses. (cherry picked from commit 3dc597f) Co-authored-by: Kaxil Naik <[email protected]>
github-actions bot
pushed a commit
to aws-mwaa/upstream-to-airflow
that referenced
this pull request
May 13, 2025
closes apache#50097 closes apache#49887 Previously, each `DagFileProcessorProcess` created its own `InProcessExecutionAPI` client instance, leading to unnecessary thread creation and resource use. This commit ensures that a single `Client` backed by `InProcessExecutionAPI` is created and owned by `DagFileProcessorManager`, and passed into all DAG file processor subprocesses. (cherry picked from commit 3dc597f) Co-authored-by: Kaxil Naik <[email protected]>
2 tasks
kaxil
added a commit
that referenced
this pull request
May 14, 2025
closes #50097 closes #49887 Previously, each `DagFileProcessorProcess` created its own `InProcessExecutionAPI` client instance, leading to unnecessary thread creation and resource use. This commit ensures that a single `Client` backed by `InProcessExecutionAPI` is created and owned by `DagFileProcessorManager`, and passed into all DAG file processor subprocesses. (cherry picked from commit 3dc597f) Co-authored-by: Kaxil Naik <[email protected]>
2 tasks
kaxil
added a commit
that referenced
this pull request
Jun 3, 2025
closes #50097 closes #49887 Previously, each `DagFileProcessorProcess` created its own `InProcessExecutionAPI` client instance, leading to unnecessary thread creation and resource use. This commit ensures that a single `Client` backed by `InProcessExecutionAPI` is created and owned by `DagFileProcessorManager`, and passed into all DAG file processor subprocesses. (cherry picked from commit 3dc597f) Co-authored-by: Kaxil Naik <[email protected]>
sanederchik
pushed a commit
to sanederchik/airflow
that referenced
this pull request
Jun 7, 2025
closes apache#50097 closes apache#49887 Previously, each `DagFileProcessorProcess` created its own `InProcessExecutionAPI` client instance, leading to unnecessary thread creation and resource use. This commit ensures that a single `Client` backed by `InProcessExecutionAPI` is created and owned by `DagFileProcessorManager`, and passed into all DAG file processor subprocesses.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:DAG-processing
backport-to-v3-0-test
Mark PR with this label to backport to v3-0-test branch
type:bug-fix
Changelog: Bug Fixes
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #50097
closes #49887
Previously, each
DagFileProcessorProcess
created its ownInProcessExecutionAPI
client instance, leading to unnecessary thread creation and memory build up.This commit ensures that a single
Client
backed byInProcessExecutionAPI
is created and owned byDagFileProcessorManager
, and passed into all DAG file processor subprocesses.Reproduction
Use following DAG:
Run the dag-processor with following command for quicker reproduction:
Check the number of threads grow as the dag is parsed:

Add following diff to check in logs:
Another easy way to reproduce, thanks to @tirkarthi in #49887 (comment)
Command:
watch -n 2 "pgrep -f dag-processor | xargs -I{} ls -l /proc/{}/fd/ 2>/dev/null | grep -i socket | wc -l"
Before:
After:
In a follow-up, I will add some cleanup to
InProcessExecutionAPI
itself so our test have no side-effects when used withdag.test
.The Triggerer is the other thing that uses it but because it is a long-running process that doesn't spawn any other processes like DAG File processor, it remains unaffected.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in airflow-core/newsfragments.