-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: return errors in json format #9146
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #9146 +/- ##
==========================================
- Coverage 92.85% 92.62% -0.23%
==========================================
Files 458 458
Lines 37051 37103 +52
Branches 5344 5349 +5
==========================================
- Hits 34404 34367 -37
- Misses 2119 2188 +69
- Partials 528 548 +20
... and 22 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@mattseddon PTAL if this gives you what you need to show errors in VS Code. |
@skshetry please add the description (if you feel it's ready for Matt, me, and other folks to participate - asking only because Dave pinged us), examples, docs, etc. It's hard to review it this way from the product perspective. |
@shcheklein, I added a description above. Let me know if you need anything more. 🙂 |
For context/background: These are the areas in the UI that we are planning to show errors
Based on the above I think that in the extension we'll probably hold the list of errors in the following format:
From the above structure, we'll be able to easily group/consolidate errors to fit them into each of the three places. The structure is also fairly extensible so we should avoid getting trapped further down the line. We will very likely end up displaying concatenated If you could provide a top-level error key that would work the best as it would involve the least amount of parsing on the extension side but as I'll be creating a list of dicts I'd propose at least changing the schema to:
If this doesn't work for other clients of Hope that helps. LMK what you think. |
With this format, how will you figure out which image and what revision failed? Or, are you going to consider lack of data as failed image plot? |
Sorry, I wasn't clear. That would only work if it is under the plot key e.g
A top-level error key would need to contain all of the information for each error. I.e
That would give enough to work out which images are missing or am I missing something? |
That should work. Note that there may not always be |
@mattseddon, should we move the plots' data to "plots" or something? Note that json is only used by vscode (and is hidden for CLI users). So the format is more or less up to you. |
cf99a31
to
e8aa14c
Compare
I have changed the format for errors to be a top-level key, and the format is: {
name: string // i.e title, e.g dvc.yaml::Accuracy
revision: string
source?: string
type: string
msg: string
}[] so instead of I'll suggest moving plots data inside touch errors
dvc plots show --json errors
{
"errors": [],
} |
Yep, we can use |
@mattseddon, please take a look at this PR. Should be ready then. It introduces top-level |
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.
Change/API LGTM. The next steps for me are to:
- Accomodate the breaking change of the new
data
key. - Build out the errors functionality to make sure nothing is missing from the API (unlikely).
As long as 1 is ready for when this is merged/released then everything should be fine. Up to you on whether or not you want to merge/potentially iterate or wait for me to work through steps 1 & 2 beforehand 🙏🏻.
Just give me a heads-up if this is going to get released.
One question that I have:
Will it still be possible to make plots diff
fail with an error or will it always return something? Asking for iterative/vscode-dvc#3222 + #9025
Since this is a breaking change for VSCode, I am fine with waiting.
#9025 might get fixed with this PR (cc @dberenbaum). dvc should handle expected failures well, but loudly fail in other cases. |
Tried this out and noted an issue I found in #9188. However, it does look like it should close #9025 since that specific error is now handled by this PR. |
@dberenbaum, FYI we changed the format of JSON output from our last discussion to the one @mattseddon suggested in #9146 (comment). |
@skshetry will the |
Same with 'data’ key when there are no plots. |
I am trying to add this branch into the virtual env for ERROR: Cannot install -r requirements.txt (line 4), dvc 0.68.2.dev4532+gff11f9d7 (from git+https://github.com/skshetry/dvc.git@plots-errors-json) and dvclive==2.3.1 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested dvc 0.68.2.dev4532+gff11f9d7 (from git+https://github.com/skshetry/dvc.git@plots-errors-json)
dvclive 2.3.1 depends on dvc>2.45.1
The user requested dvc 0.68.2.dev4532+gff11f9d7 (from git+https://github.com/skshetry/dvc.git@plots-errors-json)
dvclive 2.3.1 depends on dvc>2.45.1
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts Requirements for the demo project are:
edit: I can just pip install the branch for now |
Can you try something like this:
|
ff11f9d
to
a248351
Compare
dps, rev_props = converter.flat_datapoints(rev) | ||
try: | ||
dps, rev_props = converter.flat_datapoints(rev) | ||
except Exception as e: # noqa: BLE001, pylint: disable=broad-except |
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.
Does this need to be broad?
flat_datapoints
should only raise DvcException
, right?
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 am trying to match what we do on error_handler
. I see flat_datapoints()
reraising DvcException
on some instances.
The question is, is there a potential to raise other errors like OSError
, etc? And looking at the image.flat_datapoints()
, it might raise other exceptions. So I don't want this to fail in any case.
e11a26b
to
9303098
Compare
@skshetry can you confirm that for images Please and thank you. |
yes, they will always have same value. The |
@skshetry thanks for being patient. This change provides what is needed for the extension 🙏🏻. |
9303098
to
864b68d
Compare
I did find one issue with this. If the Examples
Can you provide an error for the failed revision stating that it's Do you want me to raise a follow-up issue/reopen one or is this enough? Sorry for not finding this sooner. |
@mattseddon, that's expected. DVC tries to find definitions in older commits and tries to use that. At the moment, we are only returning errors tied to specific plots. I should have noted this down somewhere, sorry. I worry that returning these errors may be noisy or false-positive. What do you think? |
👍🏻
The problem that I have is that when placed into the larger context this behaviour looks strange. When there is an error in the workspace:
I think if there is a failure while loading a Here is a demo of what the extension looks like with a Screen.Recording.2023-03-28.at.4.08.13.pm.movSame thing with a definition error: Screen.Recording.2023-03-28.at.4.11.35.pm.movDoes that make any sense to you? |
That's exactly the discussion in #9025. |
@mattseddon, what would you prefer here? For the behaviour change, you'd have to wait for the discussions to get resolved and prioritized. For now, I think we can return all the errors from all revisions (or only from the workspace/lhs side). |
I think providing all errors would be best but can you give me some example output for a simple project under the scenarios in #9146 (comment)? |
I think it'll look similar to above (without {
"rev": "rev"
"type": "YAMLSyntaxError",
"msg": "unable to read: 'dvc.yaml', YAML file structure is corrupted"
} |
Ok, I should be able to make that work. Please LMK when there is a draft available for me to try. |
This PR changes the schema to:
The existing data is kept inside
"data"
and the new"errors"
key is introduced where errors are a list of errors.Closes #9025.
Closes #7692.