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 diff: handle custom templates missing from new revisions #9188

Closed
dberenbaum opened this issue Mar 15, 2023 · 2 comments
Closed

plots diff: handle custom templates missing from new revisions #9188

dberenbaum opened this issue Mar 15, 2023 · 2 comments
Labels
A: plots Related to the plots bug Did we break something? p3-nice-to-have It should be done this or next sprint

Comments

@dberenbaum
Copy link
Collaborator

Bug Report

Description

dvc plots diff will fail if there is a custom template used in an old revision but missing in the workspace.

Reproduce

  1. Clone https://github.com/iterative/vscode-dvc-demo.
  2. Run $ dvc plots diff -v 9460ec.

Output:

2023-03-15 09:19:04,191 DEBUG: v2.48.1.dev3+gff11f9d7b, CPython 3.10.2 on macOS-13.2.1-arm64-arm-64bit
2023-03-15 09:19:04,191 DEBUG: command: /Users/dave/miniforge3/envs/dvc/bin/dvc plots diff -v 9460ec
2023-03-15 09:19:04,919 ERROR: unexpected error - Template 'jitter.json' not found.
Traceback (most recent call last):
  File "/Users/dave/Code/dvc/dvc/cli/__init__.py", line 210, in main
    ret = cmd.do_run()
  File "/Users/dave/Code/dvc/dvc/cli/command.py", line 26, in do_run
    return self.run()
  File "/Users/dave/Code/dvc/dvc/commands/plots.py", line 126, in run
    renderers = match_defs_renderers(
  File "/Users/dave/Code/dvc/dvc/render/match.py", line 105, in match_defs_renderers
    renderers.append(renderer_cls(plot_datapoints, renderer_id, **final_props))
  File "/Users/dave/Code/dvc-render/src/dvc_render/vega.py", line 40, in __init__
    self.template = get_template(
  File "/Users/dave/Code/dvc-render/src/dvc_render/vega_templates.py", line 616, in get_template
    raise TemplateNotFoundError(template)
dvc_render.vega_templates.TemplateNotFoundError: Template 'jitter.json' not found.

2023-03-15 09:19:04,940 DEBUG: Removing '/Users/dave/Code/.J3EFmnX47iCQFmkchxjJTF.tmp'
2023-03-15 09:19:04,940 DEBUG: Removing '/Users/dave/Code/.J3EFmnX47iCQFmkchxjJTF.tmp'
2023-03-15 09:19:04,940 DEBUG: Removing '/Users/dave/Code/.J3EFmnX47iCQFmkchxjJTF.tmp'
2023-03-15 09:19:04,940 DEBUG: Removing '/Users/dave/Code/vscode-dvc-demo/.dvc/cache/.6uCnSJiUrFHfmRkNmVj2HC.tmp'
2023-03-15 09:19:04,941 DEBUG: Version info for developers:
DVC version: 2.48.1.dev3+gff11f9d7b
-----------------------------------
Platform: Python 3.10.2 on macOS-13.2.1-arm64-arm-64bit
Subprojects:
        dvc_data = 0.43.0
        dvc_objects = 0.21.1
        dvc_render = 0.2.1.dev10+g1cdf98f
        dvc_task = 0.2.0
        scmrepo = 0.1.15
Supports:
        azure (adlfs = 2022.9.1, knack = 0.9.0, azure-identity = 1.7.1),
        gdrive (pydrive2 = 1.15.0),
        gs (gcsfs = 2022.11.0),
        hdfs (fsspec = 2022.11.0+0.gacad158.dirty, pyarrow = 7.0.0),
        http (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
        https (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
        oss (ossfs = 2021.8.0),
        s3 (s3fs = 2022.11.0+6.g804057f.dirty, boto3 = 1.24.59),
        ssh (sshfs = 2023.1.0),
        webdav (webdav4 = 0.9.4),
        webdavs (webdav4 = 0.9.4),
        webhdfs (fsspec = 2022.11.0+0.gacad158.dirty)
Cache types: reflink, hardlink, symlink
Cache directory: apfs on /dev/disk3s1s1
Caches: local
Remotes: https, s3
Workspace directory: apfs on /dev/disk3s1s1
Repo: dvc, git
Repo.site_cache_dir: /Library/Caches/dvc/repo/43e72f9536dffe729386091316011d74

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
2023-03-15 09:19:04,944 DEBUG: Analytics is disabled.

Expected

  1. Ignore any plots for which the custom template is needed and render the remaining plots.
  2. Even better would be to use the custom template from the old revisions where needed.
@dberenbaum dberenbaum added bug Did we break something? p3-nice-to-have It should be done this or next sprint A: plots Related to the plots labels Mar 15, 2023
@skshetry
Copy link
Member

Since the templates are always read from the workspace, I would say that dvc should always fail loudly, and ask users to fix things.

@dberenbaum
Copy link
Collaborator Author

So if I have an old custom template and I want to diff against that old revision, I should be required to keep that template in my workspace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: plots Related to the plots bug Did we break something? p3-nice-to-have It should be done this or next sprint
Projects
None yet
Development

No branches or pull requests

2 participants