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

[ui] Dagre changes to support more flexible asset graph rendering #20525

Merged
merged 15 commits into from
Mar 19, 2024

Conversation

bengotow
Copy link
Collaborator

@bengotow bengotow commented Mar 17, 2024

Summary & Motivation

The asset layout engine takes a wider range of it's hardcoded constants as configuration (previously just direction), and you can override Dagre layout settings. This allows us to run asset layout (with the worker, indexdb caching, etc), but with smaller column nodes. The options were already part of the cache keys, so this all works pretty smoothly!

I found an open PR on Dagre that fixes the issue with asset groups overlapping occasionally because the layout engine could not account for the presence of the "title bar" we render on them! I added the adjustments to our existing dagre.patch file. This is important in this PR because the nodes are the columns and the groups are the assets, so they overlap badly without this fix.

@bengotow bengotow requested review from salazarm and hellendag March 17, 2024 14:48
@rexledesma rexledesma force-pushed the rl/column-lineage-metadata branch 10 times, most recently from 9c2119a to c33f5da Compare March 18, 2024 21:06
Comment on lines 19 to 30
export function useLastSavedZoomLevel(
viewportEl: MutableRefObject<SVGViewport | undefined>,
layout: import('../asset-graph/layout').AssetGraphLayout | null,
assetGraphId: string,
) {
useEffect(() => {
if (viewportEl.current && layout) {
const lastZoomLevel = Number(getJSONForKey(LINEAGE_GRAPH_ZOOM_LEVEL));
viewportEl.current.autocenter(false, lastZoomLevel);
viewportEl.current.focus();
}
}, [viewportEl, layout, assetGraphId]);
Copy link
Contributor

Choose a reason for hiding this comment

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

You didn't actually use the assetGraphId here? I imagine the intent was to persist the zoom levels of different graphs independently?

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 interesting... let me dig into this a bit, I think we may have been trying to make sure the zoom resets to the saved zoom when you select assets

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like that was the case - i renamed this var so it's more obvious what it's doing here!

@rexledesma rexledesma force-pushed the rl/column-lineage-metadata branch from c33f5da to 579cb49 Compare March 18, 2024 22:07
@bengotow bengotow force-pushed the bengotow-2024-03/column-lineage-metadata branch from fc6a86e to 3fb3117 Compare March 19, 2024 13:50
@bengotow bengotow changed the base branch from rl/column-lineage-metadata to master March 19, 2024 13:51
@bengotow bengotow merged commit 4d77c2a into master Mar 19, 2024
3 checks passed
@bengotow bengotow deleted the bengotow-2024-03/column-lineage-metadata branch March 19, 2024 22:15
bengotow pushed a commit that referenced this pull request Mar 19, 2024
@dagster-io dagster-io deleted a comment from github-actions bot Mar 19, 2024
@dagster-io dagster-io deleted a comment from github-actions bot Mar 19, 2024
@dagster-io dagster-io deleted a comment from bengotow Mar 19, 2024
@bengotow bengotow changed the title [ui] Asset view support for column lineage metadata [ui] Dagre changes to support more flexible asset graph rendering Mar 19, 2024
);
};

export function useColumnLineageDataForAssets(assetKeys: AssetKeyInput[]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this use LiveDataProvider for the batching/chunking polling benefits?

benpankow pushed a commit that referenced this pull request Mar 21, 2024
## Summary & Motivation

This PR adds a new "Column" selector to the Asset > Lineage page for
assets that emit `lineage` materialization event metadata. Choosing a
column switches you to a column-oriented version of the graph, which
supports the same upstream/downstream scoping + navigation as the normal
lineage view, but shows column-level arrows and info.

This PR makes a few changes to our asset layout system in order to
support this new DAG styling:

- The asset layout engine takes a wider range of it's hardcoded
constants as configuration (previously just `direction`), and you can
override Dagre layout settings. This allows us to run asset layout (with
the worker, indexdb caching, etc), but with smaller `column` nodes. The
options were already part of the cache keys, so this all works pretty
smoothly!

- I found an open PR on Dagre that fixes the issue with asset groups
overlapping occasionally because the layout engine could not account for
the presence of the "title bar" we render on them! I added the
adjustments to our existing `dagre.patch` file. This is important in
this PR because the nodes are the columns and the groups are the assets,
so they overlap badly without this fix.
 
## How I Tested These Changes

<img width="1728" alt="image"
src="https://github.com/dagster-io/dagster/assets/1037212/0f5aebfd-cb5b-436e-b344-23b6a8f85870">
<img width="1563" alt="image"
src="https://github.com/dagster-io/dagster/assets/1037212/4eccf376-4835-42b1-ad2c-590cb3917b1a">
<img width="1205" alt="image"
src="https://github.com/dagster-io/dagster/assets/1037212/16f659a9-cb90-489b-b0ce-03a09a4e1a9c">

---------

Co-authored-by: bengotow <[email protected]>
PedramNavid pushed a commit that referenced this pull request Mar 28, 2024
## Summary & Motivation

This PR adds a new "Column" selector to the Asset > Lineage page for
assets that emit `lineage` materialization event metadata. Choosing a
column switches you to a column-oriented version of the graph, which
supports the same upstream/downstream scoping + navigation as the normal
lineage view, but shows column-level arrows and info.

This PR makes a few changes to our asset layout system in order to
support this new DAG styling:

- The asset layout engine takes a wider range of it's hardcoded
constants as configuration (previously just `direction`), and you can
override Dagre layout settings. This allows us to run asset layout (with
the worker, indexdb caching, etc), but with smaller `column` nodes. The
options were already part of the cache keys, so this all works pretty
smoothly!

- I found an open PR on Dagre that fixes the issue with asset groups
overlapping occasionally because the layout engine could not account for
the presence of the "title bar" we render on them! I added the
adjustments to our existing `dagre.patch` file. This is important in
this PR because the nodes are the columns and the groups are the assets,
so they overlap badly without this fix.
 
## How I Tested These Changes

<img width="1728" alt="image"
src="https://github.com/dagster-io/dagster/assets/1037212/0f5aebfd-cb5b-436e-b344-23b6a8f85870">
<img width="1563" alt="image"
src="https://github.com/dagster-io/dagster/assets/1037212/4eccf376-4835-42b1-ad2c-590cb3917b1a">
<img width="1205" alt="image"
src="https://github.com/dagster-io/dagster/assets/1037212/16f659a9-cb90-489b-b0ce-03a09a4e1a9c">

---------

Co-authored-by: bengotow <[email protected]>
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.

2 participants