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

plots: add plot markers to DVC files #3807

Merged
merged 17 commits into from
May 20, 2020
Merged

plots: add plot markers to DVC files #3807

merged 17 commits into from
May 20, 2020

Conversation

efiop
Copy link
Contributor

@efiop efiop commented May 17, 2020

iterative/dvc.org#1255

  • ❌ I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

dvc/repo/plots/show.py Outdated Show resolved Hide resolved
dvc/stage/params.py Outdated Show resolved Hide resolved
Comment on lines +94 to +109
(
PARAM_OUTS,
_get_outs(
[out for out in stage.outs if not (out.metric or out.plot)]
),
),
(
stage.PARAM_METRICS,
_get_outs([out for out in stage.outs if out.metric]),
),
(
stage.PARAM_PLOTS,
_get_outs([out for out in stage.outs if out.plot]),
),
Copy link
Member

Choose a reason for hiding this comment

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

Let's do this in a single loop in _get_outs(). What do you say?

@efiop efiop force-pushed the 3409 branch 4 times, most recently from 0a2b430 to 4feffd0 Compare May 18, 2020 02:18
"--plots-no-cache",
action="append",
default=[],
help="Declare output plot file (do not put into DVC cache).",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just copying help from the options above. Clearly this is not great.

dvc/serialize.py Show resolved Hide resolved
@@ -27,10 +27,14 @@ def _remove_whitespace(value):
return value.replace(" ", "").replace("\n", "")


def _run_with_metric(tmp_dir, metric_filename, commit=None, tag=None):
tmp_dir.dvc.run(metrics_no_cache=[metric_filename], single_stage=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will need to revisit this helper at some point. It was (and is) a bit hackish.

@Suor
Copy link
Contributor

Suor commented May 18, 2020

Do we plan to add default metric in a plot there? Current "strategy" of selecting a last key doesn't look well.

@efiop
Copy link
Contributor Author

efiop commented May 18, 2020

@Suor Could you elaborate?

@Suor
Copy link
Contributor

Suor commented May 18, 2020

@efiop plot data file contains several plots, i.e. values of several metrics over something. Here it's plots.csv with several columns for example. When plot diff shows the plot it selects, which column to use by selecting last column. This is not a good heuristic most of the time.

I think we should have a way to set default metric to build plot from, probably within a dvc file.

@pared
Copy link
Contributor

pared commented May 18, 2020

@Suor
We discussed with @efiop that for starters, we should let the user point in stage whether the given metric is plot or not. You are right that the particular parameters should be included, but we should probably do that as next "stage" of this issue.

@Suor
Copy link
Contributor

Suor commented May 18, 2020

Adding to the above, there is a -s, --select option to do that on command line. That one accepts either field name or jsonpath.

@Suor
Copy link
Contributor

Suor commented May 18, 2020

@pared knowing default metric to select from plot data would be very valuable to the corresponding viewer feature. Now there is no interface to change anything, so default matters, it will matter even when some interface will be added. Will also improve cli experience.

@pared
Copy link
Contributor

pared commented May 18, 2020

@Suor to not extend this PR scope, maybe we should create p0 for that?

@pared pared self-requested a review May 18, 2020 14:39
@Suor
Copy link
Contributor

Suor commented May 18, 2020

@pared I have no preference on where it should go. Let @efiop decide whether he wants to bundle or separate it.

@Suor
Copy link
Contributor

Suor commented May 18, 2020

Another issue I see is that default metric (y axis) is thing across commits, but the dvc is stored within commit. So where do we get that? From master, some of the commits involved?

dvc/command/plots.py Outdated Show resolved Hide resolved
@efiop efiop force-pushed the 3409 branch 5 times, most recently from 4f4dbb5 to d51b288 Compare May 19, 2020 00:31
Comment on lines +41 to +42
if out.plot and isinstance(out.plot, dict):
res.update(out.plot)
Copy link
Member

Choose a reason for hiding this comment

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

Can you please point me where this is being set as dict? I couldn't find it. πŸ˜•

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@skshetry It is actually not set anywhere programmatically (we might introduce dvc plots modify later, but for now it should be set by-hand).

@skshetry skshetry mentioned this pull request May 19, 2020
@efiop efiop force-pushed the 3409 branch 2 times, most recently from 77be08a to cd43bcc Compare May 19, 2020 21:57
efiop added 5 commits May 20, 2020 02:11
Just to sync this with the rest of the codebase. We should consider
renaming it to "workspace" everywhere, but for now I opt to not touch
it to not break something that depends on it.
Better corresponds to other commands like `import`.
@efiop efiop changed the title [WIP] plots: add plot markers to DVC files plots: add plot markers to DVC files May 19, 2020
@efiop efiop changed the title plots: add plot markers to DVC files [WIP] plots: add plot markers to DVC files May 19, 2020
@efiop efiop changed the title [WIP] plots: add plot markers to DVC files plots: add plot markers to DVC files May 20, 2020
@efiop
Copy link
Contributor Author

efiop commented May 20, 2020

@Suor Great questions! For now going only with templates, but we'll definitely introduce additional options for it (like labels and stuff) later.

@efiop
Copy link
Contributor Author

efiop commented May 20, 2020

Ok, merging for now. Will have a followup PR.

@efiop efiop merged commit 09136f2 into iterative:master May 20, 2020
@efiop efiop deleted the 3409 branch May 20, 2020 01:49
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.

4 participants