Uh oh!
There was an error while loading. Please reload this page.
feat(cli): add partitions clear to reset DagRun partition fields - #66520
Conversation
f4a47d7 to
af063eaComparepotiuk
commented
May 9, 2026
Rebase is needed I guess. |
b809562 to
e842cfaCompare3481fdb to
dc42fcaCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
961c171 to
1f1e52aCompare
jason810496
left a comment
There was a problem hiding this comment.
LGTM overall. Not sure do I understand the batch clearing logic correctly.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
a9e83e6 to
995da42CompareIntroduce 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.
- `--partition-key VALUE`: clear all DagRuns whose partition_key matches this exact value. - `--date a~b`: shorthand range syntax equivalent to `--start-date a --end-date b`. The four selection modes (--run-id, --partition-key, --start-date/--end-date, --date) are mutually exclusive.
Uh oh!
There was an error while loading. Please reload this page.
part of #65921
Why
airflow tasks clear --start-date / --end-datefilters bylogical_date, so it cannot reach Dag runs whosepartition_date/partition_keyis what identifies them (rollup or offset partitions). Today the only ways to bulk-reprocess such runs are N API calls or N UI clicks.What
airflow dags clear <dag_id>with three mutually-exclusive selectors:--run-id(single run)--partition-key(every run with that exact key)--partition-date-start/--partition-date-end(inclusivepartition_datewindow; runs with NULLpartition_dateare never matched;inverted window is rejected)
Dag.clear()per matchedrun_id, so TI reset + Dag run re-queue behave identically to every other clear path.run_id,partition_key,partition_date) before prompting;--yesskips the prompt.Was 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.