Visitar URL original
Add abstraction to allow custom dag bundle configuration providers by samraj2k · Pull Request #73209 · apache/airflow · GitHub
Skip to content

Add abstraction to allow custom dag bundle configuration providers - #73209

Open
samraj2k wants to merge 22 commits into
apache:mainfrom
samraj2k:dag-bundle-provider
Open

samraj2k wants to merge 22 commits into
apache:mainfrom
samraj2k:dag-bundle-provider

Conversation

@samraj2k

@samraj2k samraj2k commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Currently, Airflow reads Dag bundle configuration from dag_bundle_config_list.
This works for static configuration, but it does not support configuration that can change while a Dag processor runs.
Though Dag processor does not have capability yet to support runtime hot reload of bundles, but this PR is pre-requisite of adding hot reload functioanlity.

Hot reload needs two separate changes:

  1. A way to get bundle configuration from a source that can change.
  2. A process that regularly reads that source and reconciles added and removed bundles.

This PR implements the first change only. The plan in further PR: #73217 is to add reload and reconciliation logic.

For example, assume these bundles are active:

finance
risk
marketing

A deployment can later provide this list from a file, service, or another configuration system. DagBundlesManager must not need source-specific code for each option.
A DagBundleProvider supplies:

  • The complete list of active bundle configurations.
  • A specific bundle for a retained Dag run.
    DagBundlesManager continues to manage validation, bundle state, teams, and database reconciliation. The existing dag_bundle_config_list remains the default configuration source, so this PR does not change current behavior.

A later PR will periodically ask the configured class for the current list:

Previous list: finance, risk, marketing
Current list:  finance, marketing, payments

Currently, this change adds DagBundleProvider. A configured class returns the full list of active bundle configurations.

The new [dag_processor] dag_bundle_provider option selects the configured class. ConfigDagBundleProvider is the default so we preserve the current dag_bundle_config_list behaviour. This is to add abstraction, so that other users can implement hot reload using file, or external system.

Test Plan

Combined testing perfomed in: #73217
Validation:

  • 169 tests passed and 1 test was skipped.
  • The pre-commit checks passed.
  • The manual checks passed.

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

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

@samraj2k
samraj2k force-pushed the dag-bundle-provider branch 4 times, most recently from 4109a7f to d153ff4 Compare September 17, 2026 06:11
@samraj2k samraj2k changed the title add abstraction to allow custom dag bundle configuration providers Allow configuring the Dag bundle loader class Sep 17, 2026
@samraj2k samraj2k changed the title Allow configuring the Dag bundle loader class add abstraction to allow custom dag bundle configuration providers Sep 17, 2026
@samraj2k
samraj2k force-pushed the dag-bundle-provider branch 3 times, most recently from faa6191 to b83ca13 Compare September 21, 2026 14:15
@samraj2k
samraj2k force-pushed the dag-bundle-provider branch 3 times, most recently from 1c92d44 to 1e8bfec Compare September 23, 2026 07:44
@kaxil

kaxil commented Oct 1, 2026

Copy link
Copy Markdown
Member

Who needs Dag bundles configured at runtime, and how does this relate to #71111? This adds a [dag_processor] dag_bundle_provider option, a public DagBundleProvider base class and a team_name field on DagFileParseRequest, all permanent surface, but on its own it changes no behavior and links no issue. #71111 already proposes dynamic bundle configuration with a different design (reading it from a file path), and both shouldn't land. Is there an issue or dev-list discussion where a maintainer has picked an approach? Converting to draft until there is.

@kaxil
kaxil marked this pull request as draft October 1, 2026 21:21
@samraj2k
samraj2k force-pushed the dag-bundle-provider branch 3 times, most recently from 3486188 to 965e33e Compare October 16, 2026 16:51
bundle_name: str
"""Bundle name for team-specific executor validation."""

team_name: str | None = None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewer: team_name has been added (and this PR contains lots of changes to support this). The reason for this addition is that previously we used to look team from bundle config, thus with abstracted custom bundle source, it can do IO etc, and everytime it would require its loading. Thus we simplify this, and pass team name

Deployments need to load Dag bundle configuration from sources other than the static Airflow configuration. A provider boundary lets the Dag processor select that source without coupling it to bundle reconciliation.
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.
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.
Deployments need an unambiguous configuration source contract. A temporary loading failure must not disable an existing configured bundle or discard its ownership.
Deployments need the configuration reference to identify the first intended release for bundle source support.
Processor credential provisioning and Job registration need the names and teams declared by the deployment source without constructing bundles.
Custom bundle sources can supply remote bundles even when the static list remains at its default, so the local discovery shortcut must not change their refresh cadence.
Configuration documentation omits settings introduced after the current development version, so the bundle source guide must not depend on that generated link.
@samraj2k
samraj2k force-pushed the dag-bundle-provider branch from 965e33e to 067bbaa Compare October 16, 2026 17:19

@shahar1 shahar1 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work on this stack. I'd like to suggest a different split:

  1. Make #73217 the reload-only PR, based on main: the Dag processor re-reads
    dag_bundle_config_list on an opt-in interval, the key is marked sensitive: true
    so _cmd / _secret can supply a changing value, and your reconcile loop does the rest.
    A failed or empty read must keep the last good list, and --bundle-name processors
    keep today's never-deactivate behaviour. No new option, no new class, no change to
    DagFileParseRequest.
  2. Keep this PR for DagBundleSource (with its docs, the team_name protocol change and
    the provides_complete_bundle_list flag), gated on an AIP or an AIP-66 amendment.

Reasons:

  • DagBundleSource is not needed for hot reload. The reconcile loop in #73217 only calls
    DagBundlesManager methods, and the default source in this stack keeps a cached snapshot,
    so as written nothing reloads unless a custom class is installed.
  • A new public extension point loaded in every component is what the AIP process exists for
    (compare AIP-85 for Dag importers). Jarek asked for one in #61645. Reload of an existing
    option does not need that bar.

For the reload-only PR, I think a dev-list [DISCUSS] thread that spells out deactivation,
failure handling and multi-processor behaviour, followed by lazy consensus, is sufficient.
I am happy to start or co-sign that thread.

@judahrand, since #71111 targets the same problem, would you be open to joining the reload PR?

--

Drafted with Claude Fable 5, reviewed by me.

@samraj2k

Copy link
Copy Markdown
Contributor Author

Thanks for the work on this stack. I'd like to suggest a different split:

  1. Make reload dag bundle configuration without restarts #73217 the reload-only PR, based on main: the Dag processor re-reads
    dag_bundle_config_list on an opt-in interval, the key is marked sensitive: true
    so _cmd / _secret can supply a changing value, and your reconcile loop does the rest.
    A failed or empty read must keep the last good list, and --bundle-name processors
    keep today's never-deactivate behaviour. No new option, no new class, no change to
    DagFileParseRequest.
  2. Keep this PR for DagBundleSource (with its docs, the team_name protocol change and
    the provides_complete_bundle_list flag), gated on an AIP or an AIP-66 amendment.

Reasons:

For the reload-only PR, I think a dev-list [DISCUSS] thread that spells out deactivation, failure handling and multi-processor behaviour, followed by lazy consensus, is sufficient. I am happy to start or co-sign that thread.

@judahrand, since #71111 targets the same problem, would you be open to joining the reload PR?

--

Drafted with Claude Fable 5, reviewed by me.

Thanks a lot @shahar1 for the comment.
I would explain my I kept the bundle source PR first.
We already have many use case of reading dynamic bundle: through file, API etc, and having this configurable source allows a native support. Though, I completely agree that _CMD can support the use cases.
For now, as per comment I will make changes to have hot reload capability directly on main.
@judahrand I will be working on this, and would implement using _CMD (making sensitive), let me know if you have any concerns

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants