You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ashb (via GitHub)" <gi...@apache.org> on 2026/05/05 14:02:29 UTC

[PR] [v3-2-test] Show the task ID attributes (ti_id, task_id, etc.) once, not on every log line (#66036) [airflow]

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

   A recent PR changed the structured log output to include these attributes on
   every log message, which is very helpful for when the task logs make it to an
   external system, but when viewing them in Airflow directly it quickly becomes
   "noise" as they never change.
   
   This PR "extracts" them out and shows them once at the the start just after
   the source info and removes it from every other message.
   
   They are also injected back in to the copy and download content
   
   (cherry picked from commit d139d3765f8625589c4142d140497794000cafe7)
   


-- 
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] [v3-2-test] Show the task ID attributes (ti_id, task_id, etc.) once, not on every log line (#66036) [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #66421:
URL: https://github.com/apache/airflow/pull/66421#discussion_r3189151563


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.test.tsx:
##########
@@ -134,6 +134,253 @@ describe("Task log grouping", () => {
     await waitFor(() => expect(screen.queryByText(/Marking task as SUCCESS/iu)).not.toBeVisible());
   }, 10_000);
 
+  it("renders nested groups correctly", async () => {
+    render(
+      <AppWrapper initialEntries={["/dags/log_grouping/runs/manual__2025-02-18T12:19/tasks/generate"]} />,
+    );
+
+    await waitForLogs();
+
+    // The nested group "Dependency check details" should have a header
+    // First expand the parent group "Pre task execution logs"
+    const summaryPre = screen.getByTestId("summary-Pre task execution logs");
+
+    fireEvent.click(summaryPre);
+
+    // The nested group header should now be visible
+    await waitFor(() => expect(screen.getByTestId("summary-Dependency check details")).toBeInTheDocument());
+
+    // But nested group content is collapsed
+    expect(screen.queryByText(/dep_context=non-requeueable/iu)).toBeNull();
+
+    // Expand the nested group
+    fireEvent.click(screen.getByTestId("summary-Dependency check details"));
+    await waitFor(() => expect(screen.getByText(/dep_context=non-requeueable/iu)).toBeInTheDocument());
+  }, 10_000);
+});
+
+describe("Task Identity preamble", () => {
+  it("renders Task Identity preamble after the Log message source details group", async () => {
+    render(
+      <AppWrapper initialEntries={["/dags/log_grouping/runs/manual__2025-02-18T12:19/tasks/ti_context"]} />,
+    );
+
+    await waitForLogs();
+
+    const sourceGroup = screen.getByTestId(
+      'summary-Log message source details sources=["/home/airflow/logs/dag_id=log_grouping/run_id=manual__2025-02-18T12:19/task_id=ti_context/attempt=1.log"]',
+    );
+
+    expect(sourceGroup).toBeInTheDocument();
+
+    // Task Identity preamble should be visible
+    expect(screen.getByText("Task Identity")).toBeInTheDocument();
+    expect(screen.getByText("ti_id")).toBeInTheDocument();
+    // Value is a text node adjacent to =; match via partial text
+    expect(screen.getByText(/01951900-16f6-7c1c-ae66-91bdfe9e0cfd/u)).toBeInTheDocument();
+
+    // Preamble should come after the source details group in DOM order.
+    const preamble = screen.getByText("Task Identity");
+
+    expect(preamble).toBeInTheDocument();
+    expect(sourceGroup).toBeInTheDocument();
+
+    // DOCUMENT_POSITION_FOLLOWING (4) is set when preamble comes after the source group summary
+    // eslint-disable-next-line no-bitwise
+    expect(sourceGroup.compareDocumentPosition(preamble) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+  });
+
+  it("does not render TI context fields on individual log lines", async () => {
+    render(
+      <AppWrapper initialEntries={["/dags/log_grouping/runs/manual__2025-02-18T12:19/tasks/ti_context"]} />,
+    );
+
+    await waitForLogs();
+
+    const taskStarted = screen.getByText("Task started").closest('[data-testid^="virtualized-item-"]');
+
+    expect(taskStarted).toBeInTheDocument();
+
+    if (taskStarted !== null) {
+      expect(taskStarted.querySelector('[data-key="ti_id"]')).toBeNull();
+      expect(taskStarted.querySelector('[data-key="dag_id"]')).toBeNull();
+      expect(taskStarted.querySelector('[data-key="run_id"]')).toBeNull();
+    }
+  });
+});
+
+describe("Task log search", () => {

Review Comment:
   You can remove all the task log search tests. It is only in 3.3



-- 
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] [v3-2-test] Show the task ID attributes (ti_id, task_id, etc.) once, not on every log line (#66036) [airflow]

Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #66421:
URL: https://github.com/apache/airflow/pull/66421#discussion_r3189163575


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.test.tsx:
##########
@@ -134,6 +134,253 @@ describe("Task log grouping", () => {
     await waitFor(() => expect(screen.queryByText(/Marking task as SUCCESS/iu)).not.toBeVisible());
   }, 10_000);
 
+  it("renders nested groups correctly", async () => {

Review Comment:
   We can also remove this block since it is also only in 3.3



-- 
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] [v3-2-test] Show the task ID attributes (ti_id, task_id, etc.) once, not on every log line (#66036) [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on PR #66421:
URL: https://github.com/apache/airflow/pull/66421#issuecomment-4380004397

   I had to manually backport this and re-write the tests.
   
   PTAL @bbovenzi 


-- 
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] [v3-2-test] Show the task ID attributes (ti_id, task_id, etc.) once, not on every log line (#66036) [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #66421:
URL: https://github.com/apache/airflow/pull/66421#discussion_r3189173226


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.test.tsx:
##########
@@ -134,6 +134,253 @@ describe("Task log grouping", () => {
     await waitFor(() => expect(screen.queryByText(/Marking task as SUCCESS/iu)).not.toBeVisible());
   }, 10_000);
 
+  it("renders nested groups correctly", async () => {

Review Comment:
   YEah, bad rebase. Thanks



-- 
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] [v3-2-test] Show the task ID attributes (ti_id, task_id, etc.) once, not on every log line (#66036) [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb merged PR #66421:
URL: https://github.com/apache/airflow/pull/66421


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