-
Notifications
You must be signed in to change notification settings - Fork 116
BF: Report info from annex JSON error message in CommandError #5809
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
Conversation
Codecov Report
@@ Coverage Diff @@
## maint #5809 +/- ##
==========================================
- Coverage 90.14% 84.12% -6.02%
==========================================
Files 300 297 -3
Lines 42353 42356 +3
==========================================
- Hits 38180 35634 -2546
- Misses 4173 6722 +2549
Continue to review full report at Codecov.
|
When a `CommandError` bubbles up to the main entrypoint it is rendered differently than anywhere else (calls `to_str()` with `include_output=False`. This is done to be able to write the `stdout|err` output of a failed command to the proper channels. However, this also caused all information extraction from JSON records to be disabled. This change, makes sure that JSON records are processed even in this case. It also RFs the exception rendering code to make it less repr()-like. From: ``` CommandError: 'git -c diff.ignoreSubmodules=none annex copy --batch -z --to expdir --fast --json --json-error-messages --json-progress -c annex.dotfiles=true' failed with exitcode 1 under /tmp/testds git-annex: copy: 2 failed ``` To: ``` CommandError: 'git -c diff.ignoreSubmodules=none annex copy --batch -z --to expdir --fast --json --json-error-messages --json-progress -c annex.dotfiles=true' failed with exitcode 1 under /tmp/testds [info keys: stdout_json] > to expdir... remote is configured with exporttree=yes; use `git-annex export` to store content on it This could have failed because --fast is enabled. [2 times] git-annex: copy: 2 failed ``` Fixes datalad#5807
|
The new test in a single travis run is failing (does not see the desired exception output). ATM I have no idea why this would only happen in this run, and nowhere else. I restarted it, but that is mostly a desperate move. Edit: Yeah, deterministic failure. So it seems that the git-annex version 7.20190819 that is specifically tested there, does not provide this kind of error. So I guess I should add a version check to the test. |
Thanks for nailing it down! great that we have that run with that old annex. Note that in and in master so if you could check that it passes on |
|
OK, all green. Good to go! |
…to get msg out By no means I did thorough investigation but - test currently fails on cron (and locally) if I do have 8.20200309 installed - last change to that line/logic is from later -- so I decided to go with that one $> git blame Remote/Helper/ExportImport.hs | grep 'use .git-annex export' 9a2c8757f3 Remote/Helper/ExportImport.hs (Joey Hess 2020-12-18 14:52:57 -0400 153) then giveup "remote is configured with exporttree=yes; use `git-annex export` to store content on it" $> git describe --contains 9a2c8757f3 8.20201129~30^2~22 someone else is welcome to bisect closer if that is not the version refs: - prior discussion datalad#5809 (comment) - Closes datalad#5879
…to get msg out By no means I did thorough investigation but - test currently fails on cron (and locally) if I do have 8.20200309 installed - last change to that line/logic is from later -- so I decided to go with that one $> git blame Remote/Helper/ExportImport.hs | grep 'use .git-annex export' 9a2c8757f3 Remote/Helper/ExportImport.hs (Joey Hess 2020-12-18 14:52:57 -0400 153) then giveup "remote is configured with exporttree=yes; use `git-annex export` to store content on it" $> git describe --contains 9a2c8757f3 8.20201129~30^2~22 someone else is welcome to bisect closer if that is not the version refs: - prior discussion datalad#5809 (comment) - Closes datalad#5879
When a
CommandErrorbubbles up to the main entrypoint it is rendereddifferently than anywhere else (calls
to_str()withinclude_output=False. This is done to be able to write thestdout|erroutput of a failed command to the proper channels. However,this also caused all information extraction from JSON records to be
disabled.
This change, makes sure that JSON records are processed even in this
case. It also RFs the exception rendering code to make it less
repr()-like.
From:
To:
Fixes #5807