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

Collect live plots data from workspace #994

Closed
wants to merge 1 commit into from

Conversation

rogermparent
Copy link
Contributor

@rogermparent rogermparent commented Nov 4, 2021

This PR modifies the collect function for live plots to also collect metrics from the workspace. This is primarily to get a list of metrics even if there are no experiments. The plots webview takes this list and generates empty plots for each metric.

A large part of this PR is to refactor the existing collectFromMetricsFile function, extracting out the recursive walking logic to its own function called walkValueTree and use that to walk the workspace's metrics and add them to the accumulator without recording any other data.

demo image of webview

Fixes #991, which is part of #978

@codeclimate
Copy link

codeclimate bot commented Nov 4, 2021

Code Climate has analyzed commit 405c1d6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (85% is the threshold).

This pull request will bring the total coverage in the repository to 96.4% (0.1% change).

View more on Code Climate.

@rogermparent rogermparent marked this pull request as ready for review November 4, 2021 01:39
@rogermparent rogermparent added A: plots Area: plots webview, side panel and everything related product PR that affects product webview labels Nov 4, 2021
@rogermparent rogermparent self-assigned this Nov 4, 2021
Comment on lines +15 to +29
const walkValueTree = (
treeOrValue: ValueTree | Value,
onValue: (value: Value, path: string[]) => void,
ancestors: string[] = []
): void => {
if (typeof treeOrValue === 'object') {
Object.entries(treeOrValue as ValueTree).forEach(
([childKey, childValue]) => {
return walkValueTree(childValue, onValue, [...ancestors, childKey])
}
)
} else {
onValue(treeOrValue as Value, ancestors)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would possibly be better hoisted up as a reusable utility, not sure where though.

@mattseddon
Copy link
Member

mattseddon commented Nov 4, 2021

[Q] Why not have an actual empty state? Just some text that says something along the lines of nothing to display? This looks like an error to me

Edit: here is an example of people asking for that behaviour: https://community.plotly.com/t/replacing-an-empty-graph-with-a-message/31497/10

Copy link
Member

@mattseddon mattseddon left a comment

Choose a reason for hiding this comment

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

Code change looks fine as a first step. If you are going to merge and close #991 please raise another ticket to revisit/add a real empty state.


for (const { baseline, ...experimentsObject } of Object.values(
omit(data, 'workspace')
Copy link
Member

Choose a reason for hiding this comment

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

[I] This was the only place that this was used. Please remove the dependency.

@mattseddon
Copy link
Member

Also need to update Successfully validates an empty plots state test as [] is no longer a valid state.

@rogermparent
Copy link
Contributor Author

[Q] Why not have an actual empty state? Just some text that says something along the lines of nothing to display? This looks like an error to me

Edit: here is an example of people asking for that behaviour: https://community.plotly.com/t/replacing-an-empty-graph-with-a-message/31497/10

I figured we'd want to show the empty plots because we have the list of metrics, giving some worthwhile information even though there are no data points. I think the example is slightly misaligned analog since it's about a single plot in a plotting library while we have multiple plots in a sort of "dashboard" format.

Still, there's something to be said for using a message instead. I can put that together quickly if it's preferable and just keep this in mind if we decide otherwise.

@mattseddon
Copy link
Member

[Q] Why not have an actual empty state? Just some text that says something along the lines of nothing to display? This looks like an error to me
Edit: here is an example of people asking for that behaviour: https://community.plotly.com/t/replacing-an-empty-graph-with-a-message/31497/10

I figured we'd want to show the empty plots because we have the list of metrics, giving some worthwhile information even though there are no data points. I think the example is slightly misaligned analog since it's about a single plot in a plotting library while we have multiple plots in a sort of "dashboard" format.

Still, there's something to be said for using a message instead. I can put that together quickly if it's preferable and just keep this in mind if we decide otherwise.

We will also have the situation where the project has no checkpoints. I think we will have

  1. Static plots and no live plots because there is no data
  2. Static plots and no live plots because project doesn't have checkpoints
  3. No plots

If you think about the dashboard in those terms then 3 will have the true empty state. 1 and 2 probably should just not render the live plots section.

@mattseddon mattseddon deleted the empty-plots-when-no-experiments branch November 4, 2021 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: plots Area: plots webview, side panel and everything related product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show something in the Plots webview when there are no Experiments
3 participants