You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "pierrejeambrun (via GitHub)" <gi...@apache.org> on 2025/01/27 16:38:48 UTC
[PR] AIP-38 Mark TI as success/failed [airflow]
pierrejeambrun opened a new pull request, #46138:
URL: https://github.com/apache/airflow/pull/46138
Depends on https://github.com/apache/airflow/pull/46018, only last commit is relevant:
Closes: https://github.com/apache/airflow/issues/46137
--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #46138:
URL: https://github.com/apache/airflow/pull/46138#issuecomment-2619492794
> Looking good, but we may want to change how we use the statusbadge for the dropdown
Yes that's not great. I just added a small marging for now. So it looks a bit better but not ideal.

--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #46138:
URL: https://github.com/apache/airflow/pull/46138#discussion_r1932330605
##########
airflow/ui/src/queries/usePatchTaskInstanceDryRun.ts:
##########
@@ -0,0 +1,59 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { useQuery, type UseQueryOptions } from "@tanstack/react-query";
+
+import { TaskInstanceService } from "openapi/requests/services.gen";
+import type { PatchTaskInstanceBody, PatchTaskInstanceDryRunResponse } from "openapi/requests/types.gen";
+
+type Props<TData, TError> = {
+ dagId: string;
+ dagRunId: string;
+ mapIndex: number;
+ options?: Omit<UseQueryOptions<TData, TError>, "queryFn" | "queryKey">;
+ requestBody: PatchTaskInstanceBody;
+ taskId: string;
+};
+
+export const usePatchTaskInstanceDryRun = <TData = PatchTaskInstanceDryRunResponse, TError = unknown>({
+ dagId,
+ dagRunId,
+ mapIndex,
+ options,
+ requestBody,
+ taskId,
+}: Props<TData, TError>) =>
+ useQuery<TData, TError>({
+ ...options,
+ queryFn: () =>
+ TaskInstanceService.patchTaskInstanceDryRun({
+ dagId,
+ dagRunId,
+ mapIndex,
+ requestBody,
+ taskId,
+ }) as TData,
+ queryKey: [
+ "patchTaskInstanceDryRun",
+ dagId,
+ dagRunId,
+ taskId,
+ mapIndex,
+ { ...requestBody, note: Boolean(requestBody.note) },
Review Comment:
The idea was to cache the request on 'there is a note' or 'there is not a note' in the update request. We don't want the dry_run query to trigger on every keystroke, but I figured it's simpler to not specify the `note` at all in the caching key. It's just more verbose as I can't do anymore:
```js
{...requestBody}
```
But something like that just to omit 1 key:
```js
requestBody.new_state,
requestBody.include_downstream,
requestBody.include_future,
requestBody.include_past,
requestBody.include_upstream,
```
--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #46138:
URL: https://github.com/apache/airflow/pull/46138#discussion_r1930928760
##########
airflow/ui/src/components/MarkAs/MarkAsAccordion.tsx:
##########
@@ -16,57 +16,95 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Editable, Text, VStack } from "@chakra-ui/react";
+import { Box, Editable, Text, VStack } from "@chakra-ui/react";
import type { ChangeEvent } from "react";
-import type { DAGRunResponse } from "openapi/requests/types.gen";
+import type { DAGRunResponse, TaskInstanceCollectionResponse } from "openapi/requests/types.gen";
import ReactMarkdown from "src/components/ReactMarkdown";
import { Accordion } from "src/components/ui";
+import { columns } from "../Clear/columns";
+import { DataTable } from "../DataTable";
+
type Props = {
+ readonly affectedTasks?: TaskInstanceCollectionResponse;
readonly note: DAGRunResponse["note"];
readonly setNote: (value: string) => void;
};
-const MarkAsAccordion = ({ note, setNote }: Props) => (
- <Accordion.Root collapsible defaultValue={["note"]} multiple={false} variant="enclosed">
- <Accordion.Item key="note" value="note">
- <Accordion.ItemTrigger>
- <Text fontWeight="bold">Note</Text>
- </Accordion.ItemTrigger>
- <Accordion.ItemContent>
- <Editable.Root
- onChange={(event: ChangeEvent<HTMLInputElement>) => setNote(event.target.value)}
- value={note ?? ""}
- >
- <Editable.Preview
- _hover={{ backgroundColor: "transparent" }}
- alignItems="flex-start"
- as={VStack}
- gap="0"
- height="200px"
- overflowY="auto"
- width="100%"
+const MarkAsAccordion = ({ affectedTasks, note, setNote }: Props) => {
+ const showTaskSection = affectedTasks !== undefined;
+
+ return (
+ <Accordion.Root
+ collapsible
+ defaultValue={showTaskSection ? ["tasks"] : ["note"]}
+ multiple={false}
+ variant="enclosed"
+ >
+ {showTaskSection ? (
+ <Accordion.Item key="tasks" value="tasks">
+ <Accordion.ItemTrigger>
+ <Text fontWeight="bold">Affected Tasks: {affectedTasks.total_entries}</Text>
+ </Accordion.ItemTrigger>
+ <Accordion.ItemContent>
+ <Box maxH="400px" overflowY="scroll">
+ <DataTable
+ columns={columns}
+ data={affectedTasks.task_instances}
+ displayMode="table"
+ initialState={{
+ pagination: {
+ pageIndex: 0,
+ pageSize: affectedTasks.total_entries,
+ },
+ sorting: [],
+ }}
Review Comment:
I'm not sure we need to set initialState if this isnt paginated or sortable
--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #46138:
URL: https://github.com/apache/airflow/pull/46138#discussion_r1930921565
##########
airflow/ui/src/components/MarkAs/MarkAsAccordion.tsx:
##########
@@ -16,57 +16,95 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Editable, Text, VStack } from "@chakra-ui/react";
+import { Box, Editable, Text, VStack } from "@chakra-ui/react";
import type { ChangeEvent } from "react";
-import type { DAGRunResponse } from "openapi/requests/types.gen";
+import type { DAGRunResponse, TaskInstanceCollectionResponse } from "openapi/requests/types.gen";
import ReactMarkdown from "src/components/ReactMarkdown";
import { Accordion } from "src/components/ui";
+import { columns } from "../Clear/columns";
+import { DataTable } from "../DataTable";
+
type Props = {
+ readonly affectedTasks?: TaskInstanceCollectionResponse;
readonly note: DAGRunResponse["note"];
readonly setNote: (value: string) => void;
};
-const MarkAsAccordion = ({ note, setNote }: Props) => (
- <Accordion.Root collapsible defaultValue={["note"]} multiple={false} variant="enclosed">
- <Accordion.Item key="note" value="note">
- <Accordion.ItemTrigger>
- <Text fontWeight="bold">Note</Text>
- </Accordion.ItemTrigger>
- <Accordion.ItemContent>
- <Editable.Root
- onChange={(event: ChangeEvent<HTMLInputElement>) => setNote(event.target.value)}
- value={note ?? ""}
- >
- <Editable.Preview
- _hover={{ backgroundColor: "transparent" }}
- alignItems="flex-start"
- as={VStack}
- gap="0"
- height="200px"
- overflowY="auto"
- width="100%"
+const MarkAsAccordion = ({ affectedTasks, note, setNote }: Props) => {
+ const showTaskSection = affectedTasks !== undefined;
+
+ return (
+ <Accordion.Root
+ collapsible
+ defaultValue={showTaskSection ? ["tasks"] : ["note"]}
+ multiple={false}
+ variant="enclosed"
+ >
+ {showTaskSection ? (
+ <Accordion.Item key="tasks" value="tasks">
+ <Accordion.ItemTrigger>
+ <Text fontWeight="bold">Affected Tasks: {affectedTasks.total_entries}</Text>
+ </Accordion.ItemTrigger>
+ <Accordion.ItemContent>
+ <Box maxH="400px" overflowY="scroll">
+ <DataTable
+ columns={columns}
+ data={affectedTasks.task_instances}
+ displayMode="table"
+ initialState={{
+ pagination: {
+ pageIndex: 0,
+ pageSize: affectedTasks.total_entries,
+ },
+ sorting: [],
+ }}
+ modelName="Task Instance"
+ total={affectedTasks.total_entries}
+ />
+ </Box>
+ </Accordion.ItemContent>
+ </Accordion.Item>
+ ) : undefined}
+ <Accordion.Item key="note" value="note">
+ <Accordion.ItemTrigger>
+ <Text fontWeight="bold">Note</Text>
+ </Accordion.ItemTrigger>
+ <Accordion.ItemContent>
+ <Editable.Root
+ onChange={(event: ChangeEvent<HTMLInputElement>) => setNote(event.target.value)}
+ value={note ?? ""}
>
- {Boolean(note) ? (
- <ReactMarkdown>{note}</ReactMarkdown>
- ) : (
- <Text color="gray" opacity={0.6}>
- Add a note...
- </Text>
- )}
- </Editable.Preview>
- <Editable.Textarea
- data-testid="notes-input"
- height="200px"
- overflowY="auto"
- placeholder="Add a note..."
- resize="none"
- />
- </Editable.Root>
- </Accordion.ItemContent>
- </Accordion.Item>
- </Accordion.Root>
-);
+ <Editable.Preview
+ _hover={{ backgroundColor: "transparent" }}
+ alignItems="flex-start"
+ as={VStack}
+ gap="0"
+ height="200px"
+ overflowY="auto"
+ width="100%"
+ >
+ {Boolean(note) ? (
+ <ReactMarkdown>{note}</ReactMarkdown>
+ ) : (
+ <Text color="gray" opacity={0.6}>
Review Comment:
We probably want to use something like `text.subtle`
<img width="427" alt="Screenshot 2025-01-27 at 12 29 35 PM" src="https://github.com/user-attachments/assets/a2a61dda-d417-4f72-b238-5a28fbea57e0" />
--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #46138:
URL: https://github.com/apache/airflow/pull/46138#issuecomment-2616316801
Draft. Some refactoring + cleaning is required before being ready for review.
--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #46138:
URL: https://github.com/apache/airflow/pull/46138#discussion_r1932352997
##########
airflow/ui/src/components/MarkAs/MarkAsAccordion.tsx:
##########
@@ -16,57 +16,95 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Editable, Text, VStack } from "@chakra-ui/react";
+import { Box, Editable, Text, VStack } from "@chakra-ui/react";
import type { ChangeEvent } from "react";
-import type { DAGRunResponse } from "openapi/requests/types.gen";
+import type { DAGRunResponse, TaskInstanceCollectionResponse } from "openapi/requests/types.gen";
import ReactMarkdown from "src/components/ReactMarkdown";
import { Accordion } from "src/components/ui";
+import { columns } from "../Clear/columns";
+import { DataTable } from "../DataTable";
+
type Props = {
+ readonly affectedTasks?: TaskInstanceCollectionResponse;
readonly note: DAGRunResponse["note"];
readonly setNote: (value: string) => void;
};
-const MarkAsAccordion = ({ note, setNote }: Props) => (
- <Accordion.Root collapsible defaultValue={["note"]} multiple={false} variant="enclosed">
- <Accordion.Item key="note" value="note">
- <Accordion.ItemTrigger>
- <Text fontWeight="bold">Note</Text>
- </Accordion.ItemTrigger>
- <Accordion.ItemContent>
- <Editable.Root
- onChange={(event: ChangeEvent<HTMLInputElement>) => setNote(event.target.value)}
- value={note ?? ""}
- >
- <Editable.Preview
- _hover={{ backgroundColor: "transparent" }}
- alignItems="flex-start"
- as={VStack}
- gap="0"
- height="200px"
- overflowY="auto"
- width="100%"
+const MarkAsAccordion = ({ affectedTasks, note, setNote }: Props) => {
+ const showTaskSection = affectedTasks !== undefined;
+
+ return (
+ <Accordion.Root
+ collapsible
+ defaultValue={showTaskSection ? ["tasks"] : ["note"]}
+ multiple={false}
+ variant="enclosed"
+ >
+ {showTaskSection ? (
+ <Accordion.Item key="tasks" value="tasks">
+ <Accordion.ItemTrigger>
+ <Text fontWeight="bold">Affected Tasks: {affectedTasks.total_entries}</Text>
+ </Accordion.ItemTrigger>
+ <Accordion.ItemContent>
+ <Box maxH="400px" overflowY="scroll">
+ <DataTable
+ columns={columns}
+ data={affectedTasks.task_instances}
+ displayMode="table"
+ initialState={{
+ pagination: {
+ pageIndex: 0,
+ pageSize: affectedTasks.total_entries,
+ },
+ sorting: [],
+ }}
Review Comment:
You are right, thanks, updated.
--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun merged PR #46138:
URL: https://github.com/apache/airflow/pull/46138
--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #46138:
URL: https://github.com/apache/airflow/pull/46138#discussion_r1932309915
##########
airflow/ui/src/components/MarkAs/MarkAsAccordion.tsx:
##########
@@ -16,57 +16,95 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Editable, Text, VStack } from "@chakra-ui/react";
+import { Box, Editable, Text, VStack } from "@chakra-ui/react";
import type { ChangeEvent } from "react";
-import type { DAGRunResponse } from "openapi/requests/types.gen";
+import type { DAGRunResponse, TaskInstanceCollectionResponse } from "openapi/requests/types.gen";
import ReactMarkdown from "src/components/ReactMarkdown";
import { Accordion } from "src/components/ui";
+import { columns } from "../Clear/columns";
+import { DataTable } from "../DataTable";
+
type Props = {
+ readonly affectedTasks?: TaskInstanceCollectionResponse;
readonly note: DAGRunResponse["note"];
readonly setNote: (value: string) => void;
};
-const MarkAsAccordion = ({ note, setNote }: Props) => (
- <Accordion.Root collapsible defaultValue={["note"]} multiple={false} variant="enclosed">
- <Accordion.Item key="note" value="note">
- <Accordion.ItemTrigger>
- <Text fontWeight="bold">Note</Text>
- </Accordion.ItemTrigger>
- <Accordion.ItemContent>
- <Editable.Root
- onChange={(event: ChangeEvent<HTMLInputElement>) => setNote(event.target.value)}
- value={note ?? ""}
- >
- <Editable.Preview
- _hover={{ backgroundColor: "transparent" }}
- alignItems="flex-start"
- as={VStack}
- gap="0"
- height="200px"
- overflowY="auto"
- width="100%"
+const MarkAsAccordion = ({ affectedTasks, note, setNote }: Props) => {
+ const showTaskSection = affectedTasks !== undefined;
+
+ return (
+ <Accordion.Root
+ collapsible
+ defaultValue={showTaskSection ? ["tasks"] : ["note"]}
+ multiple={false}
+ variant="enclosed"
+ >
+ {showTaskSection ? (
+ <Accordion.Item key="tasks" value="tasks">
+ <Accordion.ItemTrigger>
+ <Text fontWeight="bold">Affected Tasks: {affectedTasks.total_entries}</Text>
+ </Accordion.ItemTrigger>
+ <Accordion.ItemContent>
+ <Box maxH="400px" overflowY="scroll">
+ <DataTable
+ columns={columns}
+ data={affectedTasks.task_instances}
+ displayMode="table"
+ initialState={{
+ pagination: {
+ pageIndex: 0,
+ pageSize: affectedTasks.total_entries,
+ },
+ sorting: [],
+ }}
+ modelName="Task Instance"
+ total={affectedTasks.total_entries}
+ />
+ </Box>
+ </Accordion.ItemContent>
+ </Accordion.Item>
+ ) : undefined}
+ <Accordion.Item key="note" value="note">
+ <Accordion.ItemTrigger>
+ <Text fontWeight="bold">Note</Text>
+ </Accordion.ItemTrigger>
+ <Accordion.ItemContent>
+ <Editable.Root
+ onChange={(event: ChangeEvent<HTMLInputElement>) => setNote(event.target.value)}
+ value={note ?? ""}
>
- {Boolean(note) ? (
- <ReactMarkdown>{note}</ReactMarkdown>
- ) : (
- <Text color="gray" opacity={0.6}>
- Add a note...
- </Text>
- )}
- </Editable.Preview>
- <Editable.Textarea
- data-testid="notes-input"
- height="200px"
- overflowY="auto"
- placeholder="Add a note..."
- resize="none"
- />
- </Editable.Root>
- </Accordion.ItemContent>
- </Accordion.Item>
- </Accordion.Root>
-);
+ <Editable.Preview
+ _hover={{ backgroundColor: "transparent" }}
+ alignItems="flex-start"
+ as={VStack}
+ gap="0"
+ height="200px"
+ overflowY="auto"
+ width="100%"
+ >
+ {Boolean(note) ? (
+ <ReactMarkdown>{note}</ReactMarkdown>
+ ) : (
+ <Text color="gray" opacity={0.6}>
Review Comment:
Yes, the reason I did that in the first place is because I wanted the 'placeholder' of the markdown rendering to be exactly the same as the placeholder of the `Editable.Textarea` so there's no change when we focus on the item. But indeed it won't play nice with dark mode.
I switched to `fg.suble`
--
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] AIP-38 Mark TI as success/failed [airflow]
Posted by "bbovenzi (via GitHub)" <gi...@apache.org>.
bbovenzi commented on code in PR #46138:
URL: https://github.com/apache/airflow/pull/46138#discussion_r1930926607
##########
airflow/ui/src/queries/usePatchTaskInstanceDryRun.ts:
##########
@@ -0,0 +1,59 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { useQuery, type UseQueryOptions } from "@tanstack/react-query";
+
+import { TaskInstanceService } from "openapi/requests/services.gen";
+import type { PatchTaskInstanceBody, PatchTaskInstanceDryRunResponse } from "openapi/requests/types.gen";
+
+type Props<TData, TError> = {
+ dagId: string;
+ dagRunId: string;
+ mapIndex: number;
+ options?: Omit<UseQueryOptions<TData, TError>, "queryFn" | "queryKey">;
+ requestBody: PatchTaskInstanceBody;
+ taskId: string;
+};
+
+export const usePatchTaskInstanceDryRun = <TData = PatchTaskInstanceDryRunResponse, TError = unknown>({
+ dagId,
+ dagRunId,
+ mapIndex,
+ options,
+ requestBody,
+ taskId,
+}: Props<TData, TError>) =>
+ useQuery<TData, TError>({
+ ...options,
+ queryFn: () =>
+ TaskInstanceService.patchTaskInstanceDryRun({
+ dagId,
+ dagRunId,
+ mapIndex,
+ requestBody,
+ taskId,
+ }) as TData,
+ queryKey: [
+ "patchTaskInstanceDryRun",
+ dagId,
+ dagRunId,
+ taskId,
+ mapIndex,
+ { ...requestBody, note: Boolean(requestBody.note) },
Review Comment:
Why is note a boolean?
--
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