Siddharth-Dangi opened a new pull request, #77770: URL: https://github.com/apache/airflow/pull/77770
Closes #52882 ### Summary - Add `airflow dags delete-runs <dag_id> [--start-date] [--end-date] [--yes]` to `DAGS_COMMANDS` (`airflow-core/src/airflow/cli/cli_config.py`) and implement `dag_delete_runs` (`airflow-core/src/airflow/cli/commands/dag_command.py`). - Require at least one of `--start-date` or `--end-date`, validate `start_date <= end_date`, and exclude Airflow 3 runs with `logical_date=None` when filtering by logical date range. - Handle zero matching runs gracefully without prompting, reject non-deletable (`running`, etc.) runs before deleting any records, and prompt for confirmation unless `--yes` is passed. - Delete matched `DagRun` rows via `session.delete(run)` so ORM cascades clean up dependent records. ### Testing - Added unit tests in `airflow-core/tests/unit/cli/commands/test_dag_command.py` covering logical-date range filtering, `logical_date=None` preservation, missing/invalid bounds, zero-match handling, prompt cancellation, and non-deletable state rejection. - Verified `test_dag_command.py` and `test_cli_parser.py` (`181 passed`; 2 unrelated `graphviz` print tests failed without `graphviz` installed), `ruff check`, `ruff format --check`, and `check_no_conventional_commit_message.py`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
