Skip to content

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
apache:mainfrom
astronomer:partition-key-fallback-noncron
Draft

Pre-fill a suggested partition key when manually triggering asset-driven or runtime partitioned Dags#71393
Lee-W wants to merge 1 commit into
apache:mainfrom
astronomer:partition-key-fallback-noncron

Conversation

@Lee-W

@Lee-W Lee-W commented Aug 11, 2026

Copy link
Copy Markdown
Member

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?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {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.

@Lee-W
Lee-W force-pushed the partition-key-fallback-noncron branch 4 times, most recently from 050e642 to 5879d29 Compare August 12, 2026 11:26
…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
Lee-W force-pushed the partition-key-fallback-noncron branch from 5879d29 to 794bc49 Compare August 12, 2026 13:54
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.

1 participant