pierrejeambrun opened a new pull request, #67095:
URL: https://github.com/apache/airflow/pull/67095

   Re-introduces the Airflow 2.x \"select many runs, then clear / mark / 
delete\" workflow that the
   Flask-AppBuilder ``DagRunModelView`` exposed. Closes #52439.
   
   ## Summary
   
   - **Backend**: new ``PATCH /dags/{dag_id}/dagRuns`` endpoint that mirrors 
the existing
     bulk task instances endpoint (``BulkTaskInstanceService``). The new
     ``BulkDagRunService`` supports:
     - bulk **update** (state to ``queued`` / ``success`` / ``failed`` and/or 
note)
     - bulk **delete** (refuses runs in non-final states, matching the 
single-run delete)
     - per-Dag authorization caching when the wildcard path ``/dags/~/dagRuns`` 
is used
     - ``action_on_non_existence: fail | skip`` semantics
     - state transitions go through 
``set_dag_run_state_to_{success,failed,queued}``
       (the same helpers used by the single-run patch endpoint) and emit the
       ``on_dag_run_success`` / ``on_dag_run_failed`` listener hooks.
   
   - **UI**: the runs list page (``/dags/<dag_id>/runs`` and the global 
``/dag_runs``)
     now has row-selection checkboxes and an action bar with three buttons that 
match the
     TaskInstances list page: **Clear**, **Mark as success/failed**, 
**Delete**. Files
     added next to ``DagRuns.tsx``:
     - ``BulkClearDagRunsButton.tsx`` (uses a new ``useBulkClearDagRuns`` hook 
that fans
       out to the existing single-run clear endpoint so ``only_failed`` keeps 
working)
     - ``BulkMarkDagRunsAsButton.tsx``
     - ``BulkDeleteDagRunsButton.tsx``
     - ``bulkDagRunsColumns.tsx`` (shared affected-runs table)
     - ``useBulkDagRuns.ts`` (mutation hook calling the new bulk endpoint)
   
   - **Tests**: ``TestBulkDagRuns`` in ``test_dag_run.py`` covers update by 
state, update
     by note, cross-Dag wildcard, deletion, deletion of running runs (409), 404
     fail/skip, ``create`` returning a 405-style error in ``BulkResponse``, 
mixed
     update+delete actions, listener-hook emission, and 401/403 responses. All 
17
     pass against the postgres backend.
   
   - **Generated**: ``v2-rest-api-generated.yaml`` and the generated UI client 
are
     regenerated; ``airflow-ctl``'s ``datamodels/generated.py`` is regenerated 
via
     the pre-commit hook.
   
   ## Grid view
   
   In 2.x the Grid view did **not** support multi-select either — bulk actions
   lived on the ``/dagrun`` list view. This PR keeps the same scope: the runs 
list
   page is the place to filter runs (e.g. ``?state=failed``) and act on a batch.
   Adding multi-select to the grid is out of scope for the parity fix and can 
be a
   separate follow-up if the user need warrants it.
   
   ## Test plan
   
   - [x] ``breeze run --backend postgres pytest 
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py::TestBulkDagRuns
 -xvs`` — 17/17 pass
   - [x] ``prek run --hook-stage pre-commit`` on changed files passes
   - [x] UI ``pnpm lint`` (eslint + tsc) passes
   - [ ] Manual end-to-end on the runs list page (select runs → Clear / Mark as 
/ Delete)
   - [ ] Manual smoke: cross-Dag wildcard call via API
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.7)
   
   Generated-by: Claude Code (Opus 4.7) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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]

Reply via email to