Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid, fix 404 taskInstance errors #26575

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 44 additions & 37 deletions airflow/www/static/js/dag/details/taskInstance/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
Tbody,
Tr,
Td,
Heading,
Divider,
} from '@chakra-ui/react';

import { finalStatesMap } from 'src/utils';
Expand All @@ -34,8 +34,8 @@ import { SimpleStatus } from 'src/dag/StatusBox';
import Time from 'src/components/Time';
import { ClipboardText } from 'src/components/Clipboard';
import type { Task, TaskInstance, TaskState } from 'src/types';
import useTaskInstance from 'src/api/useTaskInstance';
import DatasetUpdateEvents from './DatasetUpdateEvents';
import useTaskInstance from '../../../api/useTaskInstance';

interface Props {
instance: TaskInstance;
Expand All @@ -57,16 +57,21 @@ const Details = ({ instance, group, dagId }: Props) => {
mapIndex,
} = instance;

const { data: apiTI } = useTaskInstance({
dagId, dagRunId: runId, taskId, mapIndex, enabled: true,
});
const {
isMapped,
tooltip,
operator,
hasOutletDatasets,
} = group;

const { data: apiTI } = useTaskInstance({
dagId,
dagRunId: runId,
taskId,
mapIndex,
enabled: !isGroup && !isMapped,
});

const numMap = finalStatesMap();
let numMapped = 0;
if (isGroup) {
Expand Down Expand Up @@ -109,21 +114,12 @@ const Details = ({ instance, group, dagId }: Props) => {
const isOverall = (isMapped || isGroup) && 'Overall ';
return (
<Flex flexWrap="wrap" justifyContent="space-between">
<Table variant="striped">
<Tbody>
{tooltip && (
<Tr>
<Td colSpan={2}>{tooltip}</Td>
</Tr>
)}
{state === 'deferred' && (
<>
<Tr borderBottomWidth={2} borderBottomColor="gray.300">
<Td>
<Heading size="sm">Triggerer info</Heading>
</Td>
<Td />
</Tr>
{state === 'deferred' && (
<>
<Text as="strong">Triggerer info</Text>
<Divider my={2} />
<Table variant="striped" mb={3}>
<Tbody>
<Tr>
<Td>Trigger class</Td>
<Td>{`${apiTI?.trigger?.classpath}`}</Td>
Expand All @@ -140,17 +136,20 @@ const Details = ({ instance, group, dagId }: Props) => {
<Td>Latest triggerer heartbeat</Td>
<Td>{`${apiTI?.triggererJob?.latestHeartbeat}`}</Td>
</Tr>
</>
</Tbody>
</Table>
</>
)}

<Text as="strong">Task Instance Details</Text>
<Divider my={2} />
<Table variant="striped">
<Tbody>
{tooltip && (
<Tr>
<Td colSpan={2}>{tooltip}</Td>
</Tr>
)}
<Tr
borderBottomWidth={2}
borderBottomColor="gray.300"
>
<Td>
<Heading size="sm">Task Instance Details</Heading>
</Td>
<Td />
</Tr>
<Tr>
<Td>
{isOverall}
Expand All @@ -173,16 +172,20 @@ const Details = ({ instance, group, dagId }: Props) => {
</Td>
</Tr>
)}
{summary.length > 0 && (
summary
)}
{summary.length > 0 && summary}
<Tr>
<Td>{taskIdTitle}</Td>
<Td><ClipboardText value={taskId} /></Td>
<Td>
<ClipboardText value={taskId} />
</Td>
</Tr>
<Tr>
<Td>Run ID</Td>
<Td><Text whiteSpace="nowrap"><ClipboardText value={runId} /></Text></Td>
<Td>
<Text whiteSpace="nowrap">
<ClipboardText value={runId} />
</Text>
</Td>
</Tr>
{mapIndex !== undefined && (
<Tr>
Expand All @@ -206,13 +209,17 @@ const Details = ({ instance, group, dagId }: Props) => {
{startDate && (
<Tr>
<Td>Started</Td>
<Td><Time dateTime={startDate} /></Td>
<Td>
<Time dateTime={startDate} />
</Td>
</Tr>
)}
{endDate && isStateFinal && (
<Tr>
<Td>Ended</Td>
<Td><Time dateTime={endDate} /></Td>
<Td>
<Time dateTime={endDate} />
</Td>
</Tr>
)}
</Tbody>
Expand Down
16 changes: 8 additions & 8 deletions airflow/www/static/js/dag/details/taskInstance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ const TaskInstance = ({
{/* Mapped Task Instances Tab */}
{
isMappedTaskSummary && (
<TabPanel>
<MappedInstances
dagId={dagId}
runId={runId}
taskId={taskId}
onRowClicked={(row) => onSelect({ runId, taskId, mapIndex: row.values.mapIndex })}
/>
</TabPanel>
<TabPanel>
<MappedInstances
dagId={dagId}
runId={runId}
taskId={taskId}
onRowClicked={(row) => onSelect({ runId, taskId, mapIndex: row.values.mapIndex })}
/>
</TabPanel>
)
}
</TabPanels>
Expand Down