Pre-fill a suggested partition key when manually triggering asset-driven or runtime partitioned Dags - #71393
Draft
Lee-W wants to merge 1 commit into
Draft
Pre-fill a suggested partition key when manually triggering asset-driven or runtime partitioned Dags#71393Lee-W wants to merge 1 commit into
Lee-W wants to merge 1 commit into
Conversation
Lee-W
force-pushed
the
partition-key-fallback-noncron
branch
4 times, most recently
from
August 12, 2026 11:26
050e642 to
5879d29
Compare
…ven or runtime partitioned Dags Asset-driven partitioned Dags and partitioned_at_runtime Dags have no schedule tick to derive a partition key from, so the manual-trigger form left the field empty and users had to guess the key that the scheduler or a previous run had used. Runtime-partitioned Dags did not even get the field rendered. The suggestion is a guess, not a derivation, so the form warns that the key may already have run and every source is best-effort: the pending partition lookup follows the scheduler's FIFO claim order so it names the partition that will actually run next, and nothing de-duplicates a partition that has already run, because re-materializing a partition is legitimate.
Lee-W
force-pushed
the
partition-key-fallback-noncron
branch
from
August 12, 2026 13:54
5879d29 to
794bc49
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.
The manual-trigger form's partition key field is empty for asset-driven (PartitionedAssetTimetable) and partitioned_at_runtime Dags, since neither type has a natural schedule tick to derive a value from. Submitting without a key creates an unpartitioned run, which asset-driven downstream Dags can never satisfy.
This adds a best-effort suggestion, tried in order: a pending AssetPartitionDagRun already waiting on this Dag, a purely time-based guess from the timetable's own asset partition mappers, and finally the partition key of the most recent successful run. The suggestion only pre-fills the UI field; validate_partition_key still accepts None, and users can edit or clear the field before submitting.
The partitioned_at_runtime type's partition key field was also not rendered at all in the trigger form, even though the backend already accepts a partition_key for it; this fixes that visibility gap alongside the suggestion feature.
Track 1 of the same issue (#71284) adds the same base class method (Timetable.suggest_partition_key) and the same two DAGResponse fields (suggested_partition_key, timetable_partitioned_at_runtime) for the Cron timetable case, as a parallel, not-yet-merged PR. This PR temporarily duplicates those declarations so it can be developed independently; once Track 1 merges, this PR should be rebased to drop the duplicated base class method and API field declarations, keeping only the asset-driven and runtime-specific fallback logic, resolver, and UI/tests.
Was generative AI tooling used to co-author this PR?
{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.