Add three-level run_on_latest_version configuration hierarchy#61448
Draft
nathadfield wants to merge 1 commit intoapache:mainfrom
Draft
Add three-level run_on_latest_version configuration hierarchy#61448nathadfield wants to merge 1 commit intoapache:mainfrom
run_on_latest_version configuration hierarchy#61448nathadfield wants to merge 1 commit intoapache:mainfrom
Conversation
2d50dff to
fe9f45a
Compare
run_on_latest_version configuration hierarchy
fe9f45a to
f68e581
Compare
Implement global and DAG-level configuration for run_on_latest_version to control bundle version selection when creating DAG runs. This provides flexibility to configure the behavior at multiple levels with a clear precedence hierarchy: DAG-level > Global config > System default (False). Configuration levels: - Global: [core] run_on_latest_version config option - DAG-level: @dag(run_on_latest_version=True/False) parameter - UI: Clear/Rerun dialogs with checkbox when bundle versions differ Implementation: - Add run_on_latest_version parameter to DAG definition and serialization - Add global config option in config.yml with proper defaults - Implement three-level resolution logic in SerializedDAG._resolve_bundle_version() - Add BundleVersionUnavailable exception handling in scheduler for race conditions - Create custom React hook (useRunOnLatestVersion) for UI integration - Update Clear/Rerun dialogs to show version selection when applicable Exception handling: - Scheduler handles BundleVersionUnavailable gracefully for scheduled runs - Scheduler handles BundleVersionUnavailable gracefully for asset-triggered runs - Execution API returns 503 with retry guidance during bundle refresh windows - Runs are created on next scheduling cycle once bundle is parsed Testing: - Add comprehensive tests for all configuration levels and precedence - Add scheduler tests for exception handling during bundle refresh - Fix test isolation issues and database constraint violations - 648 tests passed across scheduler, DAG model, execution API, and serialization Fixes apache#60887 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
f68e581 to
4ed1fe5
Compare
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.
Description
Implements a three-level configuration hierarchy for
run_on_latest_versionto provide flexible control over bundle version selection when creating DAG runs.This PR adds:
[core] run_on_latest_versionoption inairflow.cfg@dag(run_on_latest_version=True/False)parameterThe precedence hierarchy is: DAG-level > Global config > System default (False)
Fixes #60887
Motivation
When working with bundle versioning in production, users need flexible control over which bundle version is used when creating DAG runs. Different DAGs may have different requirements:
Previously, this could only be controlled per-operation (trigger/clear). This PR enables configuration at the global and DAG levels for consistent behavior.
Implementation Details
Configuration Hierarchy
Resolution Logic
The resolution logic in
SerializedDAG._resolve_bundle_version()follows this precedence:run_on_latest_versionparameter[core] run_on_latest_versionconfigFalseUI Integration
Created a custom React hook (
useRunOnLatestVersion) that:The Clear/Rerun dialogs show a "Run on latest version" checkbox when the current run's bundle version differs from the latest available version. The checkbox's default state (checked/unchecked) is determined by the configuration hierarchy.
Screen.Recording.2026-01-30.at.14.23.09.mov
Breaking Changes
None. The system default remains
False, preserving existing behavior.Tests
Documentation
Updated
docs/administration-and-deployment/dag-bundles.rstwith:Related Issues/PRs
run_on_latest_versionbehavior on DAG clears/reruns #60887 - Global configuration for run_on_latest_versionGenerative AI Usage
Was generative AI tooling used to co-author this PR?
✅ Yes
Generated-by: Claude Sonnet 4.5 following the Airflow contribution guidelines