Skip to content

reload dag bundle configuration without restarts - #73217

Open
samraj2k wants to merge 26 commits into
apache:mainfrom
samraj2k:dynamic-dag-bundle-reload
Open

samraj2k wants to merge 26 commits into
apache:mainfrom
samraj2k:dynamic-dag-bundle-reload

Conversation

@samraj2k

@samraj2k samraj2k commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PR 2/2 of stack:
#73209
#73217

Dag processors currently read the bundle list only at startup. A deployment must restart them to add, update, or remove a bundle. In a large deployment, these restarts arent feasible if the bundles are being added frequently.

This PR makes adds the capability of hot reload. That means each Dag processor request the active bundle list at the existing bundle_refresh_check_interval. The configured class returns the complete list of active bundles. A missing bundle is inactive.

Note

The approach here allows eventual convergence.
Consider the following case. At time t the following bundles are active:

finance
risk
marketing

and total 3 Dag processor hosts are running.

Now, at time t + x, DagP_1 recieves the latest list, which omits bundle risk. Now, this DagP correctly marks the dags with bundle risk as stale. At time t+y, (x ~= y), the DagP_2 is still working on stale list, it will mark the Dags coming from bundle risk as non-stale. Though, eventually DagP_2 will recieve the correct list, and correctly marks Dags as stale, or even a different DagP host can do the same. Thus, we establish this contract for anyone who intend to use

A similar scenario can happen with the bundles list too

For example:

  1. DagP_A still sees [sales].
  2. DagP_B sees [] and marks sales inactive.
  3. DagP_A runs later and marks sales active again. DagP_A then stops permanently (due to downscale etc).

Thus, each processor also reconciles the bundle list with database on every check. This repeated reconciliation makes the database converge.

A bundle name identifies stable construction settings. If settings such as the bundle class, repository, branch, connection, or refresh interval change, the provider must use a new bundle name. The provider must continue to resolve the previous name while retained Dag runs can still need it.

The default configuration provider can be used by filtered Dag processors that have different local bundle lists. In that case, absence from one processor's partial list does not deactivate a bundle. A dynamic provider supplies the complete active list, so a filtered processor can still reconcile every bundle while it parses only its assigned bundles.

This PR depends on #73209. So once that code is landed, this will be landed

Related alternative: #71111.
Though, the PR stack solves this differently by providing relevant abstractions.

Test Plan

This was tested on local by creating a temporary FileDagBundleProvider which reads from a file: active_bundles.json.

Initially, only bundle-a was present:
["bundle-a"]

Screenshot 2026-09-16 at 10 04 01 PM

Logs:
Screenshot 2026-09-16 at 10 04 15 PM

Then, without restarting the service bundle-b was added:
Screenshot 2026-09-16 at 10 07 06 PM

Then, bundle-a was removed
Screenshot 2026-09-16 at 10 40 58 PM

Service logs during removal:

DAG bundle bundle-a ... has been disabled
Refreshed Dag bundle configuration: added=[], removed=['bundle-a']
Deactivating Dag bundle_a_reload_test...
Deactivated 1 DAGs...
Screenshot 2026-09-16 at 11 00 58 PM

Validation:

  • Ruff formatting and lint checks passed.
  • Airflow core mypy passed.
  • Fast and manual prek checks passed.

Was generative AI tooling used to co-author this PR?
  • Yes — Codex (GPT-5.6)

Generated-by: Codex (GPT-5.6) following the guidelines


Drafted-by: Codex (GPT-5.6); reviewed by @samraj2k before posting

@samraj2k
samraj2k force-pushed the dynamic-dag-bundle-reload branch from e59f9e7 to a2d35dc Compare September 15, 2026 18:35
@samraj2k samraj2k changed the title Reload Dag bundle configuration without restarts reload dag bundle configuration without restarts Sep 16, 2026
@samraj2k
samraj2k force-pushed the dynamic-dag-bundle-reload branch 5 times, most recently from 864b594 to b15603f Compare September 16, 2026 11:11
@samraj2k
samraj2k force-pushed the dynamic-dag-bundle-reload branch 4 times, most recently from 3c0d161 to 60923d4 Compare September 21, 2026 14:15
@samraj2k
samraj2k force-pushed the dynamic-dag-bundle-reload branch 5 times, most recently from e288ff2 to 5277d4f Compare September 22, 2026 13:13
Airflow also uses provider to describe installable integrations. Clear configuration wording prevents this extension class from being mistaken for a new provider package.
Keeping Airflow-owned validation and example Dag handling in the manager gives custom providers one consistent contract and avoids requiring each implementation to reproduce manager behavior.
Bundle discovery and team ownership must work consistently for coordinators and both parser paths after upstream language SDK support.
@samraj2k
samraj2k force-pushed the dynamic-dag-bundle-reload branch from e0c81bc to e0de561 Compare October 10, 2026 18:04
Team-owned tasks must retain their executor and pool during worker parsing. The provider refactor otherwise leaves them without the ownership already resolved for their Dag run.
Dag processors currently read bundle configuration only at startup. Large deployments need additions, updates, and removals to converge across processors without restarting each process.
Repeated synchronization otherwise retries cleanup and emits the same warning on every cycle after a bundle has already been disabled.
Existing refresh tests use controlled bundle objects to verify refresh and version behavior. Dynamic configuration reconciliation must not replace those fixtures before their assertions run.
Provider also describes installable Airflow integrations. Referring to the configured class and implementation makes the extension contract clear to deployment managers.
Using one provider snapshot keeps runtime reconciliation and stored bundle state aligned when configurations change while the Dag processor is running.
A file-discovery failure must remain distinct from a provider removing a bundle. The upstream discovery tests need to isolate that behavior when periodic bundle reconciliation is enabled.
@samraj2k
samraj2k force-pushed the dynamic-dag-bundle-reload branch from e0de561 to f7f24bd Compare October 10, 2026 18:41
@samraj2k

Copy link
Copy Markdown
Contributor Author

This builds on #73209, so the question there applies here too: which deployment needs runtime bundle reloads, and how does this relate to the other open design in #71111? Converting to draft until that's settled.

Hey @kaxil replied on the parent PR: #73209 (comment)

@samraj2k
samraj2k marked this pull request as ready for review October 10, 2026 18:44
@samraj2k
samraj2k requested a review from uranusjr as a code owner October 10, 2026 18:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants