feat(cli): add partitions clear to reset DagRun partition fields#66520
Open
Lee-W wants to merge 2 commits intoapache:mainfrom
Open
feat(cli): add partitions clear to reset DagRun partition fields#66520Lee-W wants to merge 2 commits intoapache:mainfrom
partitions clear to reset DagRun partition fields#66520Lee-W wants to merge 2 commits intoapache:mainfrom
Conversation
9a71e26 to
1b72e83
Compare
Introduce a new `airflow partitions` command group with a `clear` action that nulls out `partition_key` and `partition_date` on one or more DagRuns. Useful when migrating off a partitioned timetable or fixing a Dag run whose partition metadata was set incorrectly. Targeting: - `--dag-id` (required) - `--run-id` for a single run, or - `--start-date` / `--end-date` to clear a `partition_date` range (the two modes are mutually exclusive) Safety: - `--dry-run` previews matching runs without writing - Prints the existing `partition_key` / `partition_date` before clearing each run, and skips runs already cleared
Augment `airflow partitions clear` with `--clear-task-instances`: in addition to nulling `partition_key` / `partition_date`, clear the matched DagRuns' task instances so finished runs go back to QUEUED and re-execute. Useful after fixing partition metadata when the runs themselves should also re-run against the corrected logic. Behavior: - Default behavior is unchanged — only partition fields are nulled. - With `--clear-task-instances`, runs whose partition fields are already None are no longer skipped (their TIs are still cleared). - `--dry-run` reports both projected actions without writing.
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.
Introduce a new
airflow partitionscommand group with aclearaction that nulls outpartition_keyandpartition_dateon one or more DagRuns. Useful when migrating off a partitioned timetable or fixing a Dag run whose partition metadata was set incorrectly.Targeting:
--dag-id(required)--run-idfor a single run, or--start-date/--end-dateto clear apartition_daterange (the two modes are mutually exclusive)Safety:
--dry-runpreviews matching runs without writingpartition_key/partition_datebefore clearing each run, and skips runs already clearedWas generative AI tooling used to co-author this PR?
Generated-by: [Claude] following the guidelines
{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.