-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(frontend): Feature reduce pipeline graph. Fixes #4924 #4925
feat(frontend): Feature reduce pipeline graph. Fixes #4924 #4925
Conversation
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Isn't something similar implemented on |
Thank you @StefanoFioravanzo! I prefer the generic graph simplification at UI layer. |
@Udiknedormin I answered to your question in the issue. Thanks @Bobgy ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read through code in details, left some thoughts.
A general question: why did you decide to show simplified graph by default?
I think in smaller graphs, seeing all the dependencies can be useful because each dependency means some parameter or artifact passing happens between the two tasks.
In bigger graphs, we might let users click the simplify graph switch by themselves.
return graph; | ||
} | ||
|
||
export function compareGraphEdges(graph1: dagre.graphlib.Graph, graph2: dagre.graphlib.Graph) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing why this is useful.
I think hiding the sth dynamically in the UI is generally a bad design, users will be confused, because when the switch doesn't show up. There's no clue why it doesn't.
In this specific case, I think the simplest design is enough:
- always show the simplify graph switch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is used both in RunDetails and PipelineDetails pages to compare the reduced graph vs the original one. If there is a difference then the reduced one gets picked to be displayed.
@Bobgy Thank you for the detailed review! I will go through all of your comments in a couple of weeks, after the Christmas break. |
@Bobgy I think I addressed all your comments. As for this:
I agree that in general we should leave it off as default, I changed that here 657bd6d Also, following up on this #4925 (comment) :
reduced Object is possibly 'undefined'. . That's obviously true, and I am not sure if we had better just return the unchanged graph instead of undefined or if we should handle this situation in a different way
|
Thanks, I'll take further look this week |
Hey @Bobgy any update here? 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StefanoFioravanzo Sorry for the late reply.
Code mostly looks good, I've read through it in details.
Despite some minor nit pickings -- can you write unit tests in RunDetails.test.tsx
and PipelineDetails.test.tsx
to verify UI behavior after clicking on the simplify graph switch?
const graph = await this._createGraph(templateString); | ||
let reducedGraph = graph ? transitiveReduction(graph) : null; | ||
if (graph && reducedGraph && compareGraphEdges(graph, reducedGraph)) { | ||
reducedGraph = null; // disable reduction switch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal opinion:
I think there's no need to disable the switch, when reduced graph is the same.
It's understandable -- when the graph is already simple, reducing it has no effect. We've got tooltip on the
switch too to explain this.
What do you think? anyway, this is not a blocker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave it disabled so that it's obvious that this features is not available for that particular pipeline. Otherwise users might try clicking it anyway, see that nothing changes, and wonder what is happening. I wouldn't rely on people actually reading and understanding what's in the tooltip, we can just prevent any potential misunderstanding by disabling the switch
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
80f3f1d
to
d080cc9
Compare
@Bobgy about unit tests, I have close to zero experience in writing tests for React components. So please bear with me a little bit here :) See the last commit d080cc9 where I try to test a diamond-shaped pipeline. Creating the graph and testing for its nodes and edges works. Now I want to query for the switch component, simulate its click and test that the graph is missing the edge "node1 to node4". How can I query for the switch element and click it? |
@StefanoFioravanzo that's a good start, There's a section that introduces all types of query you can use,
either of this sounds reasonable, because users would find your switch looking at the text on that switch. You can use https://testing-library.com/docs/dom-testing-library/api-events library to fire the click event easily. (I believe we didn't install it, but we've decided to use @testing-library/ family, so you can just install it). === Here are the information, Anyway, if you still cannot figure out in reasonable time. It's OK to log a remaining issue and leave it there. This PR is already great work! /cc @zijianjoy to also do some review |
@Bobgy: GitHub didn't allow me to request PR reviews from the following users: to, also, do, some, review. Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@Bobgy: GitHub didn't allow me to request PR reviews from the following users: review, to, also, do, some. Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
d080cc9
to
cc7cac4
Compare
@Bobgy Thanks that suggestion was spot on! I updated the commit with a complete unit test for the RunDetails page. I gave a look at PipelineDetails as well, but there doesn't seem to be an existing straightforward way to test the structure of a pipeline there, since there is no mock of the |
Yes, I think adding one test is enough for coverage. |
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Bobgy, StefanoFioravanzo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1 similar comment
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Bobgy, StefanoFioravanzo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thank you Stefano for this change! It helps improve pipeline visualization a lot! 👍 |
…ubeflow#4925) * Add Switch with label atom Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Add transitive reduction algorithm Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Reduce graph in RunDetails Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Reduce graph in PipelineDetails Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Update snaps Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Run prettier Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Change _graph name to graphToShow Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Deepcopy graph within the transitive reduction fn Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Add time complexity comment Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Safeguard against too big graphs Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Improve tests Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Move switch from atom to component Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Disable reduction by default Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Run prettier Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Update snaps Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Create reusable CardTooltip atom Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * RunDetails unit test Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Fix negated test checks Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Add return type in transtiveReduction signature Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Return undefined if graph is falsey Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com> * Fix use of inline snapshot Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Description of your changes:
Add a "Transitive Reduction" mechanism to simplify the graph in the Pipeline Details and in the Run Details pages. Activating this function will remove any redundant dependencies in the graph, thus making it simpler to read in many instances.
In case the graph cannot be reduced, the toggle will be disabled. Toggling again this option will revert the graph back to its original layout, so the user can switch it on and off to compare the two views, if needed.
More details at #4924
Checklist:
Do you want this pull request (PR) cherry-picked into the current release branch?
Learn more about cherry-picking updates into the release branch.