Repository navigation
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
|
8abfb21 to
02da222
Compare
34c19ff to
cc41051
Compare
|
Pinging for review after 72hrs: @ashb @XD-DENG @ephraimbuddy @jedcunningham |
cc41051 to
0847f64
Compare
|
Pinging for review again: @ashb @XD-DENG @ephraimbuddy @jedcunningham |
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.
0847f64 to
fb61d1e
Compare
|
Adding a +1 to this -- dynamic DAG bundles would unblock something I'm working on. |
|
+1 on this. |
|
I'm not really sure what the best way of going about getting review on this PR is. I'm more than happy to deal with any concerns etc. and put some work into this but without some feedback I'm not sure how to move this forwards. |
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.