question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`dvc.api.params_show`: More helpful error handling

See original GitHub issue

Bug Report

Description

Doesn’t show useful errors.

Reproduce

  1. git clone git@github.com:iterative/pipeline-conifguration.git
  2. cd pipeline-conifguration
  3. Start Python shell:
>>> import dvc.api
>>> dvc.api.params_show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dave/Code/dvc/dvc/api/params.py", line 267, in params_show
    return _postprocess(params)
  File "/Users/dave/Code/dvc/dvc/api/params.py", line 256, in _postprocess
    return processed[first(processed)]
KeyError: None

Expected

I’m guessing it fails because there’s no dvc.yaml or params.yaml in the project root where the shell is started, but the error message doesn’t help me understand this or how to fix it.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
daavoocommented, Jun 27, 2022

I think an error in this case? I doubt there’s much reason to call params_show if you expect an empty dict.

I was thinking about returning an empty dict instead of raising an exception because dvc {X} show commands don’t fail when there is nothing to return.

What would happen if there was a params.yaml but no dvc.yaml found?

The contents of params.yaml will be returned.

What about the inverse?

The KeyError point will be reached.

0reactions
dberenbaumcommented, Jun 27, 2022

A warning might be reasonable also, so at least it’s not silently returning the empty dict?

Read more comments on GitHub >

github_iconTop Results From Across the Web

dvc.api.params_show()
Without arguments, this function will retrieve all parameters from all tracked param files (used in any dvc.yaml file). This applies to the current...
Read more >
How do launch experiments in DVC? - Stack Overflow
I solved my problem. It is necessary, that all files (executable scripts, 'dvc.yaml', 'params.yaml') be tracked by git. In this case dvc exp ......
Read more >
The ultimate guide to building maintainable Machine Learning ...
Today I'll show you how to build reproducible Machine Learning pipelines ... DVC uses a params.yam file as the default parameters file, ...
Read more >
Command Line Interface · spaCy API Documentation
--help , -h, Show help message and available arguments. bool (flag) ... be resolved automatically, spaCy will show you a validation error with...
Read more >
dvc - PyPI
Compare any data, code, parameters, model, or performance plots. ... It currently features experiment tracking and data management, and more features (data ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found