Skip to content

Commit

Permalink
Update Materialization Warning (#7265)
Browse files Browse the repository at this point in the history
  • Loading branch information
clairelin135 committed Apr 19, 2022
1 parent 98cdc50 commit 83bfccf
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 279 deletions.
30 changes: 8 additions & 22 deletions js_modules/dagit/packages/core/src/asset-graph/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import {
import {AssetNodeLiveFragment} from './types/AssetNodeLiveFragment';
import {
RepositoryLiveFragment,
RepositoryLiveFragment_latestRunByStep_JobRunsCount,
RepositoryLiveFragment_latestRunByStep_LatestRun_run,
RepositoryLiveFragment_latestRunByStep_run,
} from './types/RepositoryLiveFragment';

type AssetNode = AssetGraphQuery_assetNodes;
Expand Down Expand Up @@ -161,8 +160,7 @@ export interface LiveDataForNode {
computeStatus: Status;
unstartedRunIds: string[]; // run in progress and step not started
inProgressRunIds: string[]; // run in progress and step in progress
runsSinceMaterialization: RepositoryLiveFragment_latestRunByStep_JobRunsCount | null;
runWhichFailedToMaterialize: RepositoryLiveFragment_latestRunByStep_LatestRun_run | null;
runWhichFailedToMaterialize: RepositoryLiveFragment_latestRunByStep_run | null;
lastMaterialization: AssetGraphLiveQuery_assetNodes_assetMaterializations | null;
lastChanged: number;
}
Expand Down Expand Up @@ -192,12 +190,10 @@ export const buildLiveData = (
const runs = repo?.inProgressRunsByStep.find((r) => r.stepKey === liveNode.opName);
const info = repo?.latestRunByStep.find((r) => r.stepKey === liveNode.opName);

const runsSinceMaterialization = info?.__typename === 'JobRunsCount' ? info : null;
const latestRunForStepKey = info?.__typename === 'LatestRun' ? info.run : null;

const runWhichFailedToMaterialize =
(!runsSinceMaterialization &&
latestRunForStepKey?.status === 'FAILURE' &&
(latestRunForStepKey?.status === 'FAILURE' &&
(!lastMaterialization || lastMaterialization.runId !== latestRunForStepKey?.id) &&
latestRunForStepKey) ||
null;
Expand All @@ -207,7 +203,6 @@ export const buildLiveData = (
lastMaterialization,
inProgressRunIds: runs?.inProgressRuns.map((r) => r.id) || [],
unstartedRunIds: runs?.unstartedRuns.map((r) => r.id) || [],
runsSinceMaterialization,
runWhichFailedToMaterialize,
computeStatus: isSourceAsset(graphNode.definition)
? 'good' // foreign nodes are always considered up-to-date
Expand Down Expand Up @@ -272,20 +267,11 @@ export const IN_PROGRESS_RUNS_FRAGMENT = gql`
`;

export const LAST_RUNS_WARNINGS_FRAGMENT = gql`
fragment LastRunsWarningsFragment on RunStatsByStep {
__typename
... on LatestRun {
stepKey
run {
id
status
}
}
... on JobRunsCount {
stepKey
jobNames
count
sinceLatestMaterialization
fragment LastRunsWarningsFragment on LatestRun {
stepKey
run {
id
status
}
}
`;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,14 @@ import {Warning} from '@dagster-io/ui';
import React from 'react';
import {Link} from 'react-router-dom';

import {isAssetGroup, LiveDataForNode} from '../asset-graph/Utils';
import {LiveDataForNode} from '../asset-graph/Utils';
import {titleForRun} from '../runs/RunUtils';
import {runsPathWithFilters} from '../runs/RunsFilterInput';

export const FailedRunsSinceMaterializationBanner: React.FC<{liveData?: LiveDataForNode}> = ({
liveData,
}) => {
const {runsSinceMaterialization, runWhichFailedToMaterialize} = liveData || {};
const {runWhichFailedToMaterialize} = liveData || {};

if (runsSinceMaterialization) {
const {jobNames, count} = runsSinceMaterialization;
const jobNamesCleaned = jobNames.map((j) =>
isAssetGroup(j) ? 'Asset materialization runs' : j,
);
const jobNamesSummary =
jobNamesCleaned.length > 1
? `${jobNamesCleaned.slice(0, -1).join(', ')} and ${jobNamesCleaned.slice(-1)[0]}`
: jobNamesCleaned[0];

const jobsPage = runsPathWithFilters(
jobNames.length === 1 ? [{token: 'job', value: jobNames[0]}] : [],
);
return (
<Warning>
<span>
{`${jobNamesSummary} ran `}
<Link to={jobsPage}>{count} times</Link> but did not materialize this asset
</span>
</Warning>
);
}
if (runWhichFailedToMaterialize) {
return (
<Warning errorBackground>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

11 changes: 1 addition & 10 deletions js_modules/dagit/packages/core/src/graphql/schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 83bfccf

Please sign in to comment.