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

   Fixes #68532
   
   ## What
   
   Adds a new `/dags/schedule` page that visualizes the **typical (mean / 
median) start and end time of each Dag over a 24-hour timeline**, aggregated 
from recent successful Dag runs. This complements the existing per-Dag Gantt 
view, which only shows a single run at a time. The new view operates at a 
different level: it aggregates across all Dags to answer "across my whole 
deployment, when during the day does each Dag usually run?"
   
   ## Why
   
   Operators running many Dags currently have no at-a-glance way to see how 
scheduled load is distributed across the day. The new view makes the whole 
schedule visible at once, which helps to:
   - spot overlapping heavy windows where many Dags pile up at the same hour,
   - find quiet windows for maintenance / deploys / resource-intensive jobs,
   - notice drift when a Dag's typical run time shifts over recent runs,
   - plan capacity and SLAs across the fleet.
   
   ## How
   
   ### Backend
   - New `/ui/dag_schedule_overview` endpoint (in 
`api_fastapi/core_api/routes/ui/dag_schedule_overview.py`) gated by 
`requires_access_dag(method="GET", access_entity=DagAccessEntity.RUN)`.
   - New `DagScheduleOverviewService` 
(`api_fastapi/core_api/services/ui/dag_schedule_overview.py`) that:
     - fetches all DagModel rows (so dags with no runs still appear as 
zero-statistic rows),
     - pulls up to 200 most-recent successful `DagRun`s per dag, optionally 
scoped by a `run_after` window,
     - computes mean/median of `start_date` and `end_date` mapped to 
seconds-of-day in UTC, plus mean/median duration,
     - supports `dag_id_pattern` and `dag_display_name_pattern` filters.
   - New datamodels `DagScheduleOverviewEntry` + 
`DagScheduleOverviewCollectionResponse` 
(`api_fastapi/core_api/datamodels/ui/dag_schedule_overview.py`).
   - 11 backend tests in 
`tests/unit/api_fastapi/core_api/routes/ui/test_dag_schedule_overview.py`: 
200/401/403, all-three-dag fixture, morning/evening/no-runs statistics, 
FAILED-run exclusion, pattern filters, run_after window edges.
   - OpenAPI `_private_ui.yaml` updated; `pnpm codegen` regenerated.
   
   ### Frontend
   - New page `src/pages/DagsList/ScheduleOverview/` mounted at 
`/dags/schedule` with:
     - one row per Dag (linkable to the Dag detail page),
     - a 24h tick rail at 0/3/6/9/12/15/18/21/24 hours,
     - a horizontal bar showing the mean start→end window,
     - a hover tooltip with mean and median start / end, mean and median 
duration, and the recent-runs date range,
     - a client-side dag-id filter input.
   - New sidebar nav button `Schedule Overview` (`FiBarChart2`) on the main 
nav, alongside `Dags`.
   - New i18n keys under `dags.scheduleOverview.*` and 
`common.nav.scheduleOverview` (English locale).
   
   ## Verification
   
   ```bash
   # Backend
   uv run --project airflow-core pytest 
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dag_schedule_overview.py
 --with-db-init
   # 11 passed
   uv run --project airflow-core ruff check + ruff format --check + mypy
   # All clean
   ```
   
   ```bash
   # Frontend
   pnpm lint      # eslint --quiet && tsc -p tsconfig.app.json — passes
   pnpm prettier --check public/i18n/locales/en/dags.json 
public/i18n/locales/en/common.json
   # Passes
   ```
   
   The two pre-existing vitest failures in `useTagFilter.test.tsx` and 
`Logs.test.tsx` reproduce on `main` (verified with `git stash`), so they are 
unrelated to this PR.


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