Skip to content

Commit ddf99d8

Browse files
salazarmgibsondan
authored andcommitted
[Run Timeline] Don't drop job data if locations within the FutureTicksQuery fails (#27944)
## Summary & Motivation Currently, if the FutureTicksQuery itself fails we recover by returning the ongoing runs and complete runs data that we have. However, if the query doesn't fail then we end up iterating over all of the locations within it and constructing a `jobs` array with all of the rows of the timeline. The problem is that this construction relies on the jobs returned by FutureTicksQuery. If FutureTicksQuery doesn't return a particular job then we drop the data for that job completely. To fix this track which keys we've added via the FutureTicksQuery and then do a second pass where we add data for any jobs that were not in the FutureTicksQuery ## How I Tested These Changes Loaded the Run timeline for a customer with a failing location entry ## Changelog > Insert changelog entry or delete this section.
1 parent a0acc42 commit ddf99d8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

js_modules/dagster-ui/packages/ui-core/src/runs/useRunsForTimeline.tsx

+13
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,16 @@ export const useRunsForTimeline = ({
442442
return Object.values(jobsWithCompletedRunsAndOngoingRuns);
443443
}, [jobsWithCompletedRunsAndOngoingRuns]);
444444

445+
const allKeys = useMemo(
446+
() => Object.keys(jobsWithCompletedRunsAndOngoingRuns),
447+
[jobsWithCompletedRunsAndOngoingRuns],
448+
);
449+
445450
const unsortedJobs: TimelineRow[] = useMemo(() => {
446451
if (!workspaceOrError || workspaceOrError.__typename === 'PythonError' || _end < Date.now()) {
447452
return jobsWithCompletedRunsAndOngoingRunsValues;
448453
}
454+
const addedJobKeys = new Set();
449455
const addedAdHocJobs = new Set();
450456
const jobs: TimelineRow[] = [];
451457
for (const locationEntry of workspaceOrError.locationEntries) {
@@ -501,6 +507,7 @@ export const useRunsForTimeline = ({
501507

502508
const jobName = isAdHoc ? 'Ad hoc materializations' : pipeline.name;
503509

510+
addedJobKeys.add(jobKey);
504511
const jobRuns = Object.values(runsByJobKey[jobKey] || {});
505512
if (!jobTicks.length && !jobRuns.length) {
506513
continue;
@@ -531,6 +538,11 @@ export const useRunsForTimeline = ({
531538
}
532539
}
533540
}
541+
allKeys.forEach((key) => {
542+
if (!addedJobKeys.has(key)) {
543+
jobs.push(jobsWithCompletedRunsAndOngoingRuns[key]!);
544+
}
545+
});
534546
return jobs;
535547
// Don't add start/end time as a dependency here since it changes often.
536548
// Instead rely on the underlying runs changing in response to start/end changing
@@ -540,6 +552,7 @@ export const useRunsForTimeline = ({
540552
jobsWithCompletedRunsAndOngoingRunsValues,
541553
runsByJobKey,
542554
jobsWithCompletedRunsAndOngoingRuns,
555+
allKeys,
543556
]);
544557

545558
const jobsWithRuns = useMemo(() => {

0 commit comments

Comments
 (0)