{{ message }}
Skip executor validation when a worker parses a Dag - #73172
Draft
namanjain24-sudo wants to merge 1 commit into
Draft
namanjain24-sudo wants to merge 1 commit into
namanjain24-sudo wants to merge 1 commit into
Conversation
A worker loads the Dag through BundleDagBag, which validated every task's executor against the worker's own [core] executor setting. Worker pods usually have only their own executor configured (the cncf-kubernetes pod templates set LocalExecutor), so a task with executor="KubernetesExecutor" was dropped and could not start. The Dag processor already validates executors, so add a validate_executors argument to DagBag and turn it off in the task runner.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

A task with
executor="KubernetesExecutor"fails to start when the worker it lands on has a different executor configured, with the error from #56271:parse()in the task runner loads the Dag throughBundleDagBag, andDagBag.process_fileruns_validate_executor_fieldson every Dag it bags. A worker usually has only its own executor configured. The cncf-kubernetes pod templates, for examplekubernetes_executor_templates/basic_template.yamland the files inpod_template_file_examples/, setAIRFLOW__CORE__EXECUTOR=LocalExecutor. So the check fails inside the pod, the Dag is dropped from the bag, and the task cannot start.The Dag processor has already run this check when it parsed the file, so the worker does not need to repeat it. This adds a
validate_executorsargument toDagBagthat defaults toTrue, and the task runner passesFalse. The Dag processor, the CLI anddag.test()keep validating as before.Tests:
test_parse_does_not_validate_task_executorsparses a Dag whose task uses an executor the worker does not know. It fails on main with the error above and passes with this change.test_validate_executorsintest_dagbag.pycovers both values of the new argument.test_task_runner.py(536 passed withTZ=UTC; in a non-UTC local timezone eightTestTriggerDagRunOperatortests fail on main as well),test_dagbag.py(76 passed, 1 skipped) and prek, including mypy for airflow-core and task-sdk, pass locally.closes: #56271
Was generative AI tooling used to co-author this PR?
Generated-by: a Gen-AI coding assistant, following the guidelines. I reviewed the change and ran the checks above.