Add dynamic DAG bundle configuration from file path - #71111
Open
judahrand wants to merge 4 commits into
Open
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
judahrand
force-pushed
the
feature/dynamic-dag-bundle-config
branch
from
August 4, 2026 17:09
8abfb21 to
02da222
Compare
judahrand
marked this pull request as ready for review
August 4, 2026 17:21
judahrand
requested review from
XD-DENG,
ashb,
ephraimbuddy and
jedcunningham
as code owners
August 4, 2026 17:21
judahrand
force-pushed
the
feature/dynamic-dag-bundle-config
branch
from
August 4, 2026 17:38
02da222 to
34c19ff
Compare
Adds a new `dag_bundle_config_path` setting that allows loading DAG bundle configurations from JSON files in a directory. This enables hot-reloading of bundle configurations without restarting the DAG processor, which is particularly useful in Kubernetes environments where ConfigMaps can be mounted as files. When `dag_bundle_config_path` is set, it takes precedence over the existing `dag_bundle_config_list` setting. The DAG processor monitors the directory for file additions, removals, and modifications, and automatically reloads bundles when changes are detected. Key changes: - DagBundlesManager: new _parse_config_from_path(), check_config_path_changes(), and get_bundle_path_safe() methods - DagFileProcessorManager: reuses a single DagBundlesManager instance and detects config path changes in the refresh loop, cleaning up removed bundles - ParseImportError: graceful handling when bundles are removed - config.yml: new dag_bundle_config_path option
Rename loop variable to avoid shadowing Path-typed file_path with str-typed iteration variable from dict.items().
…nges The check_config_path_changes() call in _refresh_dag_bundles() must use `is True` identity check rather than truthiness, because MagicMock returns a truthy MagicMock object by default. Also restore sync_bundles() and get_all_bundles() to use throwaway DagBundlesManager instances (matching upstream pattern) to avoid mock interference.
Adds a prose section to dag-bundles.rst describing the directory convention, JSON file format, hot-reload semantics, precedence over dag_bundle_config_list, and validation behaviour for the new dag_bundle_config_path option (the previous PR commits only added a config.yml description). Also addresses review correctness/robustness feedback on the DagBundlesManager directory mode: - Track every *.json file's mtime regardless of parse outcome, so invalid or duplicate-name files no longer cause check_config_path_changes to report "changed" on every poll. - Use st_mtime_ns instead of float st_mtime for reliable detection on filesystems with coarse-resolution timestamps. - Validate that the JSON "name" is a non-empty string before adding it to the duplicate-detection set; non-string names previously raised TypeError when added to a set. - Clear bundle_config and config_path_mtime on the early-return paths (missing directory, no valid configs found) so removed bundles get cleaned up instead of staying configured. - Replace time.sleep(0.01) in the test with an explicit os.utime mtime bump so the test doesn't depend on filesystem timestamp granularity.
judahrand
force-pushed
the
feature/dynamic-dag-bundle-config
branch
from
August 6, 2026 08:20
34c19ff to
cc41051
Compare
Author
|
Pinging for review after 72hrs: @ashb @XD-DENG @ephraimbuddy @jedcunningham |
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.
This PR picks up where #63928 left off.
closes: #59799 #60859 #66858
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.6) 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.