Repository navigation
Conversation
b0d491f to
784b981
Compare
Some Python tasks need fresh interpreter startup semantics without forcing every task in the deployment onto the slower global mode.
The provider docs build treats mismatched RST heading underline lengths as warnings, which fail CI for documentation builds.
Serialized PythonOperator tasks can omit default None values, so the deserialized placeholder needs to know the field exists for roundtrip comparisons.
Provider compatibility jobs run standard provider tests against older Airflow releases, so serialization tests need the cross-version helper used by other provider tests.
75f0a30 to
02288f5
Compare
The ExecuteTask workload now carries the per-task interpreter override, so generated worker API schemas need to expose the field used by static validation.
02288f5 to
82514c1
Compare
|
Not a review, just something I ran into that seems relevant. I think this PR does more than add a per-task override. The config fallback in The Celery code that reads it sits behind an I opened #70901 in parallel to document that and get So if this merges it's a behaviour change for anyone still running Celery or Local with |
|
Thanks, that makes sense. Since this PR restores the global |
|
If I understand this correctly… this won’t work. |
|
Good catch, thanks for review. |
|
I don’t think this is going to fly either, at least as-is. |
|
Thanks, that makes sense. While working on this, I noticed a related bug. So this PR is now a smaller bugfix related to #41093, rather than closing it. The per-task override can be handled separately with a more complete design for provider executor compatibility. |
potiuk
left a comment
There was a problem hiding this comment.
Thanks for narrowing this down, but the bug this PR now fixes has already landed on main in #72164, and the remaining hunk would undo how that PR scoped the option, so I'm closing this one as superseded rather than asking for a rebase.
Superseded by #72164
def _should_use_exec() -> bool:
"""Whether forked children should ``exec`` a fresh interpreter."""
return sys.platform in _FORK_EXEC_PLATFORMS or conf.getboolean( # ← already on main as _task_process_uses_exec()
"core", "execute_tasks_new_python_interpreter", fallback=False
)#72164 ("Allow opting into fork+exec task processes via execute_tasks_new_python_interpreter", merged 2026-09-14) added _task_process_uses_exec() with exactly this or conf.getboolean(...) fallback, a TestTaskProcessUsesExec test, the 72164.significant.rst newsfragment and an updated config.yml description. This PR's diff no longer applies to main, and the green CI from 2026-08-08 predates that merge.
The hunk also changes the Dag processor and the triggerer
_should_use_exec() is not task-only; it is the shared platform gate:
airflow-core/src/airflow/dag_processing/processor.py:619: use_exec = target is _parse_file_entrypoint and supervisor._should_use_exec()
airflow-core/src/airflow/jobs/triggerer_job_runner.py:551: use_exec=supervisor._should_use_exec(),
Reading the config here means execute_tasks_new_python_interpreter=True execs a fresh interpreter for every Dag-file parse and for the triggerer too, which the option has never described. #72164 avoided exactly this by introducing a separate _task_process_uses_exec() and leaving _should_use_exec() platform-only; its newsfragment states that the Dag processor, the triggerer and task callbacks keep bare fork. If this PR were rebased with this hunk kept, it would silently revert that scoping.
Smaller observations
test_should_use_exec_honors_platform_and_configstubssupervisor.conf.getbooleanwithlambda *args, **kwargs: config_value, which returns the value for any section/key;conf_vars(already imported in this file) is the way to override config in tests.- The title, body and labels still describe the per-task
PythonOperatoroverride that was removed on 2026-08-08, and70280.bugfix.rstduplicates the merged72164.significant.rstentry. - If you want to pursue the original per-task override, that needs a new design that answers
uranusjr's points (providers constructExecuteTaskthemselves; unsupported version combinations must fail at parse time), best as a fresh PR.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. After you've
addressed the points above and pushed an update, an Apache Airflow
maintainer — a real person — will take the next look
at the PR. The findings cite the project's review criteria;
if you think one of them is mis-applied, please reply on the
PR and a maintainer will weigh in.More on how Apache Airflow handles maintainer review:
contributing-docs/05_pull_requests.rst.
|
Closing as superseded by #72164 (see the review above). Thanks for the work on this; a fresh PR is the best route if you want to pursue the per-task override. |
Why
[core] execute_tasks_new_python_interpretercurrently applies globally, so enabling fresh Python interpreter startup affects every task in the deployment.Some Python tasks need that behavior, for example to pick up plugin changes immediately, but forcing all tasks onto the slower execution mode is unnecessary.
relates: #41093
Solution
Add
execute_tasks_new_python_interpretertoPythonOperatoras a task-level override.When set to
TrueorFalse, the task value is carried through Dag serialization, theExecuteTaskworkload, and the task supervisor. When left asNone, task execution keeps using the global[core] execute_tasks_new_python_interpreterconfiguration.Was generative AI tooling used to co-author this PR?
-
[X]Yes (please specify the tool below)Generated-by: [Codex] following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.