Repository navigation
Allow opting into fork+exec task processes via execute_tasks_new_python_interpreter #72164
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cb270fc
Allow opting into fork+exec task processes via execute_tasks_new_pyth…
gang-zh 56a70c7
Re-apply PR_SET_DUMPABLE in the exec'd task child
gang-zh fa5db25
Scope execute_tasks_new_python_interpreter to the task process
gang-zh c7da364
Test the exec opt-in through conf_vars like the rest of the file
gang-zh 024dc2e
Reword the security docs so the spellchecker accepts them
gang-zh 98afeea
Restore PR_SET_DUMPABLE in the exec bootstrap and pin the fork+exec w…
gang-zh 4b57824
Config/docs: fix the runaway rst literal, note callbacks keep bare fo…
gang-zh 163027f
Guard the bootstrap's ctypes import and run the exec bootstrap end to…
gang-zh b51701c
Docs: Yama scope of ptrace_scope, and that the task process reads the…
gang-zh f2aedc3
Tests: hoist the probe-target and subprocess imports to module level
gang-zh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ``[core] execute_tasks_new_python_interpreter`` now applies to Airflow 3 task processes | ||
|
|
||
| On Airflow 3 the option had no effect on task execution (only the Edge worker read it). When set to | ||
| ``True``, the task supervisor now ``exec``\ s a fresh interpreter right after forking the task process, | ||
| which prevents the fork from inheriting a lock held by a supervisor thread (a permanent hang at the | ||
| task's first TLS call). Deployments that kept the option ``True`` from Airflow 2 get this behaviour, | ||
| and its per-task interpreter start-up cost, on upgrade without further action; set it to ``False`` to | ||
| keep bare fork. The task process reads the global value, so a team-scoped Edge setting alone does not | ||
|
kaxil marked this conversation as resolved.
|
||
| turn it on. Edge workers with the option ``True`` already start a fresh interpreter for the supervisor | ||
|
kaxil marked this conversation as resolved.
|
||
| and will now start a second one for the task. The Dag processor, the triggerer and task | ||
| callbacks (which the callback supervisor runs from a closure that cannot be named for an exec'd | ||
| child) are not affected and keep bare fork. | ||
|
|
||
| * Types of change | ||
|
|
||
| * [ ] Dag changes | ||
| * [x] Config changes | ||
| * [ ] API changes | ||
| * [ ] CLI changes | ||
| * [x] Behaviour changes | ||
| * [ ] Plugin changes | ||
| * [ ] Dependency changes | ||
| * [ ] Code interface changes | ||
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
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
30 changes: 30 additions & 0 deletions
30
task-sdk/tests/task_sdk/execution_time/exec_probe_target.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # 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. | ||
| """Importable entry point for the fork+exec end-to-end test; it runs inside the exec'd child.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import sys | ||
|
|
||
| from airflow.sdk.execution_time.comms import CommsDecoder | ||
|
|
||
|
|
||
| def exec_probe_main() -> None: | ||
| """Stand-in for ``_subprocess_main``: consume the startup message, then report over stdout.""" | ||
| CommsDecoder()._get_response() | ||
| print("exec-probe-ok") | ||
| sys.stdout.flush() |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.