Allow PythonOperator to override task interpreter mode - #70280
Allow PythonOperator to override task interpreter mode#70280fat-catTW wants to merge 12 commits into
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. |
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.