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

[dagit] Auto-refreshing materialization + in progress run overlays on Asset graph #5825

Merged
merged 27 commits into from
Dec 2, 2021

Conversation

bengotow
Copy link
Collaborator

@bengotow bengotow commented Nov 30, 2021

Summary

This PR adds in-progress spinners and status messages to the Asset explorer using @clairelin135's new repo-level graphql query! I also split the query made by the AssetGraphExplorer in half - we load the graph itself (node definitions with their upstream node references) once, and have a separate query that returns the in-progress runs and latest asset materialization for each node. We refresh the latter every 5 seconds to give the asset graph a nice real-time info overlay. My hope is that having a smaller initial query also makes the time-to-usable-DAG lower.

I think a 5 second polling interval is ideal, but if the query is slow on large DAGs it'll back off a bit - I double checked the Apollo source and pollInterval will skip and retry pollIntervalms later if the previous query is still in flight (https://github.com/apollographql/apollo-client/blob/8155890a3ee296799cd318ca2ca749961eb91ce1/src/core/ObservableQuery.ts#L633).

Screen Shot 2021-11-29 at 10 23 58 PM

image

Test Plan

Just tested on hacker_new_assets graph so far.

Checklist

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • I have added tests to cover my changes.

# Conflicts:
#	js_modules/dagit/packages/core/src/workspace/asset-graph/AssetGraphExplorer.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/Utils.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/types/AssetGraphQuery.ts
# Conflicts:
#	js_modules/dagit/packages/core/src/assets/AssetMaterializations.tsx
#	js_modules/dagit/packages/core/src/graph/PipelineGraph.tsx
#	js_modules/dagit/packages/core/src/pipelines/GraphExplorer.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/AssetGraphExplorer.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/SidebarAssetInfo.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/Utils.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/types/AssetGraphQuery.ts
@vercel
Copy link

vercel bot commented Nov 30, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/elementl/dagster/BE7HTXuFPusgWpsk7qp5PYFDDEi3
✅ Preview: Canceled

[Deployment for f940455 canceled]

>
<span>This asset may be materialized soon by </span>

{['12341514'].map((runId) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh whoops, will fix 🤦‍♂️

<span>This asset may be materialized soon by </span>

{['12341514'].map((runId) => (
<Link to={`/instance/runs/${runId}`} key={runId}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think elsewhere we put the link on the ID text or other inner info, rather than the tag itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yeah I can move the link to the ID text 👍

@bengotow bengotow changed the title Auto-refreshing materialization + in progress run overlays on Asset graph [dagit] Auto-refreshing materialization + in progress run overlays on Asset graph Nov 30, 2021
@sryza
Copy link
Contributor

sryza commented Nov 30, 2021

I gave this a spin. It's pretty cool. Some comments:

  • The "Latest run" spinner in the header appears to still be spinning after the asset spinner has stopped, which is a little confusing. Are we able to get that to auto-refresh as well?
  • I think "This asset may be materialized soon by Run X" comes off as a little too tentative. Maybe "Run X is currently refreshing this asset" instead?
  • It would be helpful to add a spinner or similar progress indicator to the asset page, so someone who depends on an asset can discover whether it's in the process of being regenerated, e.g. answer the question "is this just running slow today, or do I need to bother someone about it?".
  • It feels a little sluggish to wait five seconds for the spinner to show up after launching a run. Would we be able to do some sort of immediate check after launch, and then update every five seconds after that?
  • For assets that aren't currently being updated but that are pending in an in-progress run, it would be helpful to have some way to represent that they're slated for an update. That might require backend additions though? Could leave that as a separate chunk of work.

@bengotow
Copy link
Collaborator Author

That all sounds great! The asset details version of this definitely needs to happen, it'd be super cool - just waiting on one of the two PRs to merge. I think we can address #1 (the latest run header being static) and #2 + #4 today, will get those knocked out!

I think the last point is interesting. Right now, the spinner would be spinning for any asset covered by an in-progress run - the spinner isn't tied to the current step state, just to the current state of the run. Not sure if it'd be helpful to get more granular - we could technically pull not just the current run Ids but the step logs inside those runs? (cc @sryza )

…h-in-progress

# Conflicts:
#	js_modules/dagit/packages/core/src/workspace/asset-graph/AssetGraphExplorer.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/AssetNode.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/types/AssetGraphQuery.ts
…in-progress

# Conflicts:
#	js_modules/dagit/packages/core/src/assets/AssetNodeDefinition.tsx
#	js_modules/dagit/packages/core/src/assets/AssetView.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/AssetGraphExplorer.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/AssetNode.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/Utils.tsx
#	js_modules/dagit/packages/core/src/workspace/asset-graph/types/AssetGraphQuery.ts
@bengotow
Copy link
Collaborator Author

Interesting, it looks like I was wrong! get_in_progress_runs_by_in_progress_step returns step + run IDs only if the step is currently IN_PROGRESS.

@clairelin135 what do you think of breaking this into two states? It'd be ideal if launching a run immediately returned some sort of in-progress state for the launched steps. Right now it takes a while for the spinner to start because the asset you picked actually needs to start, but this granular data is great.

What if we returned both?

inProgressRunsByStep: [{
  stepKey: 'a',
  unstarted: [{runId: 'aaaa'}],
  inProgress: [{runId: 'cccc'}],
}]

Something like this would also be ok as well:

inProgressAssetOps: [{
   run: { id: 'aaaa'},
   unstartedOps: ['a'],
   inProgressOps: [],
}, {
   run: { id: 'cccc'},
   unstartedOps: [],
   inProgressOps: ['a'],
}]

@bengotow
Copy link
Collaborator Author

bengotow commented Dec 1, 2021

Hey folks! I talked with Claire today about this and it sounds like we'll hold off on the "going to be refreshed by a run, but hasn't been yet" status. This status will address Sandy's points 4 and 5 above - right now there's a delay before the spinner appears because the run needs to launch and begin the step.

The other feedback has all been addressed - there's now live status on the asset details page as well! I think this is ready for another look if you get a minute @hellendag

@bengotow bengotow requested a review from hellendag December 1, 2021 22:39
if (paramsTimeWindowOnly) {
return;
}
console.log('refetch');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eep

@bengotow bengotow merged commit 5fc0088 into master Dec 2, 2021
@bengotow bengotow deleted the bg/graph-in-progress branch December 2, 2021 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants