You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Aaryan123456679 (via GitHub)" <gi...@apache.org> on 2026/06/15 12:56:46 UTC
[PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Aaryan123456679 opened a new pull request, #68570:
URL: https://github.com/apache/airflow/pull/68570
The Gantt tooltip showed the wrong **End Date** when hovering over the queued or scheduled segment of a task bar: it reported the end of that segment (e.g. the instant queueing ended) rather than the task's actual end.
This was a regression from #68176, which fixed the **Start Date** by carrying the task's real `start_date` on every segment of a try (`start_when`) but left the End Date derived from each segment's own bounds (`max_end_date = segment.x[1]`).
This PR mirrors that approach for the end: each segment of a try now carries the task's effective end (`end_date`, or "now" while the task is still running) as `end_when`, and the tooltip uses it for the End Date. As a result, the scheduled, queued, and execution bars of the same try all report a consistent Start Date, End Date, and duration.
Tests added in `Gantt/utils.test.ts` assert that `start_when`/`end_when` are carried consistently across all segments of a finished task and of a running task.
closes: #68174
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 4.8)
Generated-by: Claude Code (Opus 4.8) 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #68570:
URL: https://github.com/apache/airflow/pull/68570#issuecomment-4708143582
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our [Contributors' Guide](https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:
- Pay attention to the quality of your code (ruff, mypy and type annotations). Our [prek-hooks]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-prek-hooks) will help you with that.
- In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/airflow-core/docs/howto/custom-operator.rst) Consider adding an example Dag that shows how users should use it.
- Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
- Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
- Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
- Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
- Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
Apache Airflow is a community-driven project and together we are making it better 🚀.
In case of doubts contact the developers at:
Mailing List: dev@airflow.apache.org
Slack: https://s.apache.org/airflow-slack
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "Aaryan123456679 (via GitHub)" <gi...@apache.org>.
Aaryan123456679 commented on code in PR #68570:
URL: https://github.com/apache/airflow/pull/68570#discussion_r3509277631
##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/utils.ts:
##########
Review Comment:
Done — removed the verbose inline comments; the code stands on its own now. Pushed in 4214722.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "Aaryan123456679 (via GitHub)" <gi...@apache.org>.
Aaryan123456679 commented on PR #68570:
URL: https://github.com/apache/airflow/pull/68570#issuecomment-4754000735
Hi @eladkal , any update on this?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "Aaryan123456679 (via GitHub)" <gi...@apache.org>.
Aaryan123456679 commented on code in PR #68570:
URL: https://github.com/apache/airflow/pull/68570#discussion_r3476673296
##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/utils.test.ts:
##########
@@ -237,6 +237,65 @@ describe("transformGanttData", () => {
expect(result[2]?.state).toBe("success");
});
+ it("carries the task's actual start and end on every segment of the try", () => {
+ const result = transformGanttData({
+ allTries: [
+ {
+ end_date: "2024-03-14T10:05:00+00:00",
+ is_mapped: false,
+ queued_dttm: "2024-03-14T09:59:00+00:00",
+ scheduled_dttm: "2024-03-14T09:58:00+00:00",
+ start_date: "2024-03-14T10:00:00+00:00",
+ state: "success",
+ task_display_name: "task_1",
+ task_id: "task_1",
+ try_number: 1,
+ },
+ ],
+ flatNodes: [{ depth: 0, id: "task_1", is_mapped: false, label: "task_1" }],
+ gridSummaries: [],
+ });
+
+ expect(result).toHaveLength(3);
+ // The scheduled, queued, and execution bars all report the task's real start_date/end_date so
+ // the tooltip is consistent no matter which segment is hovered (regression from #68174).
+ const expectedEnd = new Date("2024-03-14T10:05:00+00:00").toISOString();
+
+ for (const segment of result) {
+ expect(segment.start_when).toBe("2024-03-14T10:00:00+00:00");
+ expect(segment.end_when).toBe(expectedEnd);
+ }
+ });
+
+ it("uses the current time as end_when on every segment while the task is still running", () => {
+ const result = transformGanttData({
+ allTries: [
+ {
+ end_date: null,
+ is_mapped: false,
+ queued_dttm: "2024-03-14T09:59:00+00:00",
+ scheduled_dttm: null,
+ start_date: "2024-03-14T10:00:00+00:00",
+ state: "running",
+ task_display_name: "task_1",
+ task_id: "task_1",
+ try_number: 1,
+ },
+ ],
+ flatNodes: [{ depth: 0, id: "task_1", is_mapped: false, label: "task_1" }],
+ gridSummaries: [],
+ });
+
+ // Queued + execution bars, both reporting the same (running) end so the tooltip is consistent.
+ expect(result.length).toBeGreaterThan(0);
+ const [firstEnd] = result.map((segment) => segment.end_when);
+
+ for (const segment of result) {
+ expect(segment.end_when).toBe(firstEnd);
+ expect(segment.end_when).not.toBeUndefined();
+ }
Review Comment:
Done — switched the running-task test to `vi.useFakeTimers()` + `vi.setSystemTime(...)` and now assert `end_when === now.toISOString()` for every segment, so a stale or zero timestamp would fail the test rather than slip through. Pushed in 9f81693.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "Aaryan123456679 (via GitHub)" <gi...@apache.org>.
Aaryan123456679 commented on code in PR #68570:
URL: https://github.com/apache/airflow/pull/68570#discussion_r3476675844
##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/utils.ts:
##########
@@ -152,6 +147,17 @@ export const transformGanttData = ({
endMs = dayjs(endDate).valueOf();
}
+ // Include scheduled/queued/start/end times in tooltip data whenever the timestamps exist.
+ // start_when/end_when are carried on every segment of a try so the tooltip reports the
+ // task's actual start and end on the scheduled and queued bars too, not just the
+ // execution bar's own bounds.
+ const tryWhenForTooltip = {
+ ...(scheduledMs === undefined ? {} : { scheduled_when: scheduledDttm }),
+ ...(queuedMs === undefined ? {} : { queued_when: queuedDttm }),
+ ...(startDate === null ? {} : { start_when: startDate }),
+ ...(startDate === null && !hasTaskRunning ? {} : { end_when: dayjs(endMs).toISOString() }),
Review Comment:
Good call — collapsed both into a single symmetric form. Now `effectiveEndDate = endDate ?? (hasTaskRunning && startDate !== null ? new Date().toISOString() : null)` and `end_when` is gated on it exactly like `start_when` is gated on `startDate`:
- **Value:** finished tasks keep the raw API `end_date` string (no `dayjs(endMs).toISOString()` re-serialization), so the test now asserts the raw `2024-03-14T10:05:00+00:00` just like `start_when`.
- **Gate:** a not-yet-started task (no `start_date`) now skips `start_when` and `end_when` together and both bars fall back to their own bounds — no more mismatched scales in one tooltip.
- **Ordering:** since `effectiveEndDate` no longer needs `endMs`, the `tryWhenForTooltip` block moved back above the `endMs` computation, removing that dependency.
Pushed in 9f81693.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #68570:
URL: https://github.com/apache/airflow/pull/68570#discussion_r3459932039
##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/utils.ts:
##########
@@ -152,6 +147,17 @@ export const transformGanttData = ({
endMs = dayjs(endDate).valueOf();
}
+ // Include scheduled/queued/start/end times in tooltip data whenever the timestamps exist.
+ // start_when/end_when are carried on every segment of a try so the tooltip reports the
+ // task's actual start and end on the scheduled and queued bars too, not just the
+ // execution bar's own bounds.
+ const tryWhenForTooltip = {
+ ...(scheduledMs === undefined ? {} : { scheduled_when: scheduledDttm }),
+ ...(queuedMs === undefined ? {} : { queued_when: queuedDttm }),
+ ...(startDate === null ? {} : { start_when: startDate }),
+ ...(startDate === null && !hasTaskRunning ? {} : { end_when: dayjs(endMs).toISOString() }),
Review Comment:
These two lines aren't symmetric with each other:
- Gate: `start_when` skips only when `startDate === null`; `end_when` adds `&& !hasTaskRunning`. The extra branch only fires for queued/scheduled tasks (`isStatePending` is true) with no `start_date`, where the tooltip would then show `Start Date` = the bar's own start (segment fallback) + `End Date` = `Date.now()`. Two different scales in the same tooltip.
- Value: `start_when` keeps the raw API string (`"2024-03-14T10:00:00+00:00"`); `end_when` is re-serialized via `dayjs(endMs).toISOString()` to `"...Z"` with `.000` millis. The test even pins this skew. Renders fine because dayjs reparses, but it's needless and it's the reason the `tryWhenForTooltip` block had to move below `endMs`.
Suggest collapsing both into a single symmetric form — derive an `effectiveEndDate` and gate on it like `start_when` does on `startDate`:
```suggestion
const effectiveEndDate = hasTaskRunning ? new Date().toISOString() : endDate;
// Include scheduled/queued/start/end times in tooltip data whenever the timestamps exist.
// start_when/end_when are carried on every segment of a try so the tooltip reports the
// task's actual start and end on the scheduled and queued bars too, not just the
// execution bar's own bounds.
const tryWhenForTooltip = {
...(scheduledMs === undefined ? {} : { scheduled_when: scheduledDttm }),
...(queuedMs === undefined ? {} : { queued_when: queuedDttm }),
...(startDate === null ? {} : { start_when: startDate }),
...(effectiveEndDate === null ? {} : { end_when: effectiveEndDate }),
};
```
Then the block doesn't need to live below `endMs` anymore (no ordering dependency) and finished tasks keep the API's raw `end_date` string. The test for the finished task can drop the `new Date(...).toISOString()` wrapping and assert against the raw `"2024-03-14T10:05:00+00:00"` like it does for `start_when`.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #68570:
URL: https://github.com/apache/airflow/pull/68570#discussion_r3459888694
##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/utils.test.ts:
##########
@@ -237,6 +237,65 @@ describe("transformGanttData", () => {
expect(result[2]?.state).toBe("success");
});
+ it("carries the task's actual start and end on every segment of the try", () => {
+ const result = transformGanttData({
+ allTries: [
+ {
+ end_date: "2024-03-14T10:05:00+00:00",
+ is_mapped: false,
+ queued_dttm: "2024-03-14T09:59:00+00:00",
+ scheduled_dttm: "2024-03-14T09:58:00+00:00",
+ start_date: "2024-03-14T10:00:00+00:00",
+ state: "success",
+ task_display_name: "task_1",
+ task_id: "task_1",
+ try_number: 1,
+ },
+ ],
+ flatNodes: [{ depth: 0, id: "task_1", is_mapped: false, label: "task_1" }],
+ gridSummaries: [],
+ });
+
+ expect(result).toHaveLength(3);
+ // The scheduled, queued, and execution bars all report the task's real start_date/end_date so
+ // the tooltip is consistent no matter which segment is hovered (regression from #68174).
+ const expectedEnd = new Date("2024-03-14T10:05:00+00:00").toISOString();
+
+ for (const segment of result) {
+ expect(segment.start_when).toBe("2024-03-14T10:00:00+00:00");
+ expect(segment.end_when).toBe(expectedEnd);
+ }
+ });
+
+ it("uses the current time as end_when on every segment while the task is still running", () => {
+ const result = transformGanttData({
+ allTries: [
+ {
+ end_date: null,
+ is_mapped: false,
+ queued_dttm: "2024-03-14T09:59:00+00:00",
+ scheduled_dttm: null,
+ start_date: "2024-03-14T10:00:00+00:00",
+ state: "running",
+ task_display_name: "task_1",
+ task_id: "task_1",
+ try_number: 1,
+ },
+ ],
+ flatNodes: [{ depth: 0, id: "task_1", is_mapped: false, label: "task_1" }],
+ gridSummaries: [],
+ });
+
+ // Queued + execution bars, both reporting the same (running) end so the tooltip is consistent.
+ expect(result.length).toBeGreaterThan(0);
+ const [firstEnd] = result.map((segment) => segment.end_when);
+
+ for (const segment of result) {
+ expect(segment.end_when).toBe(firstEnd);
+ expect(segment.end_when).not.toBeUndefined();
+ }
Review Comment:
Could you tighten this to pin the actual value of `end_when`, not just that it's consistent across segments? With `vi.useFakeTimers()` + `vi.setSystemTime(...)` you can also assert `end_when` matches that fixed "now" — otherwise a regression returning a stale or zero timestamp would slip past.
```suggestion
it("uses the current time as end_when on every segment while the task is still running", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date("2024-03-14T10:02:00+00:00"));
try {
const result = transformGanttData({
allTries: [
{
end_date: null,
is_mapped: false,
queued_dttm: "2024-03-14T09:59:00+00:00",
scheduled_dttm: null,
start_date: "2024-03-14T10:00:00+00:00",
state: "running",
task_display_name: "task_1",
task_id: "task_1",
try_number: 1,
},
],
flatNodes: [{ depth: 0, id: "task_1", is_mapped: false, label: "task_1" }],
gridSummaries: [],
});
const expectedEnd = new Date("2024-03-14T10:02:00+00:00").toISOString();
for (const segment of result) {
expect(segment.end_when).toBe(expectedEnd);
}
} finally {
vi.useRealTimers();
}
});
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #68570:
URL: https://github.com/apache/airflow/pull/68570#discussion_r3492770194
##########
airflow-core/src/airflow/ui/src/layouts/Details/Gantt/utils.ts:
##########
Review Comment:
Most of the comments in here are irrelevant/noise, can you remove them.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "Aaryan123456679 (via GitHub)" <gi...@apache.org>.
Aaryan123456679 commented on PR #68570:
URL: https://github.com/apache/airflow/pull/68570#issuecomment-4709967203
<img width="1600" height="900" alt="after" src="https://github.com/user-attachments/assets/3d0a63d4-cefa-47db-be71-2e1b5fa5969b" />
<img width="1600" height="900" alt="before" src="https://github.com/user-attachments/assets/d38cc550-b5d3-4bc3-9523-f9bb941d14d1" />
@eladkal Pls find attached the screenshots.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] UI: Fix Gantt tooltip showing wrong end date on queued/scheduled bars [airflow]
Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on PR #68570:
URL: https://github.com/apache/airflow/pull/68570#issuecomment-4708365214
can you share before/after images?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org