This is an automated email from the ASF dual-hosted git repository. jedcunningham pushed a commit to branch v2-9-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 5fcf36cc652a98f5405626d263d93ad55251a959 Author: Brent Bovenzi <[email protected]> AuthorDate: Tue Apr 16 21:54:30 2024 -0400 Check that the dataset<>task exists before trying to render graph (#39069) (cherry picked from commit 57c6a4bfdcee03ac11d7e1aff167a91453acceb8) --- airflow/www/static/js/dag/details/graph/index.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/airflow/www/static/js/dag/details/graph/index.tsx b/airflow/www/static/js/dag/details/graph/index.tsx index d7445f189a..e86801f28f 100644 --- a/airflow/www/static/js/dag/details/graph/index.tsx +++ b/airflow/www/static/js/dag/details/graph/index.tsx @@ -34,7 +34,7 @@ import { BiCollapse, BiExpand } from "react-icons/bi"; import { useDatasets, useGraphData, useGridData } from "src/api"; import useSelection from "src/dag/useSelection"; -import { getMetaValue, useOffsetTop } from "src/utils"; +import { getMetaValue, getTask, useOffsetTop } from "src/utils"; import { useGraphLayout } from "src/utils/graph"; import Edge from "src/components/Graph/Edge"; import type { DepNode, WebserverEdge } from "src/types"; @@ -68,6 +68,10 @@ const Graph = ({ const [hasRendered, setHasRendered] = useState(false); const [isZoomedOut, setIsZoomedOut] = useState(false); + const { + data: { dagRuns, groups }, + } = useGridData(); + useEffect(() => { setArrange(data?.arrange || "LR"); }, [data?.arrange]); @@ -104,7 +108,11 @@ const Graph = ({ ); const consumingDag = dataset?.consumingDags?.find((d) => d.dagId === dagId); if (dataset.id) { - if (producingTask?.taskId) { + // check that the task is in the graph + if ( + producingTask?.taskId && + getTask({ taskId: producingTask?.taskId, task: groups }) + ) { datasetEdges.push({ sourceId: producingTask.taskId, targetId: dataset.id.toString(), @@ -130,9 +138,6 @@ const Graph = ({ const { selected } = useSelection(); - const { - data: { dagRuns, groups }, - } = useGridData(); const { colors } = useTheme(); const { getZoom, fitView } = useReactFlow(); const latestDagRunId = dagRuns[dagRuns.length - 1]?.runId;
