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

UWS error messages now sit on errorsummary. #432

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

msdemlei
Copy link
Contributor

@msdemlei msdemlei commented Mar 6, 2023

Previously, they were parsed into job.message, which was probably unintended, as there were message attributes on errorsummary that just were never filled because errorsummary would not parse its children itself.

The alternative would be to preserve the previous behaviour, where message sits on the job element; but that's against the UWS schema, and if we did that, we'd have to take away the extra attributes on errorsummary (and revert the change to raise_if_error in the TAPJob).

If we do it like this, that would fix Bug #431.

Previously, they were parsed into job.message, which was probably unintended,
as there were message attributes on errorsummary that just were never
filled because errorsummary would not parse its children itself.

The alternative would be to preserve the previous behaviour, where message
sits on the job element; but that's against the UWS schema, and if we
did that, we'd have to take away the extra attributes on errorsummary
(and revert the change to raise_if_error in the TAPJob).

If we do it like this, that would fix Bug astropy#431.
@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Merging #432 (3cac035) into main (f10aff5) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #432      +/-   ##
==========================================
+ Coverage   79.81%   79.84%   +0.03%     
==========================================
  Files          52       52              
  Lines        5989     5988       -1     
==========================================
+ Hits         4780     4781       +1     
+ Misses       1209     1207       -2     
Impacted Files Coverage Δ
pyvo/dal/tap.py 73.11% <100.00%> (+0.20%) ⬆️
pyvo/io/uws/tests/test_job.py 100.00% <100.00%> (ø)
pyvo/io/uws/tree.py 91.37% <100.00%> (+0.56%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bsipocz bsipocz added the bug label Mar 6, 2023
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

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

Looks good, and I would like to add this to 1.4.1 if @agy-why confirms it fixes the bug.

Comment on lines 181 to +186
if 'test_erroneus_submit.non_existent' in request.text:
job.phase = 'ERROR'
job.message = 'test_erroneus_submit.non_existent not found'
job._errorsummary = ErrorSummary()
job.errorsummary.message = Message()
job.errorsummary.message.content =\
'test_erroneus_submit.non_existent not found'
Copy link
Member

Choose a reason for hiding this comment

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

are these used anywhere in the tests? E.g. if I take the test changes from this PR and run them against the main branch, this doesn't trigger a failure (changes in pyvo/io/uws/tests/test_job.py do).

So this is somewhat unrelated and a more generic comment: I think building up complex mock classes but then don't fully use them in the tests are a bit misleading.

@msdemlei
Copy link
Contributor Author

msdemlei commented Mar 7, 2023 via email

@agy-why
Copy link

agy-why commented Mar 7, 2023

@bsipocz I can confirm it solves my issue. And the default message from raise_if_error is a very helpful feature.

@bsipocz
Copy link
Member

bsipocz commented Mar 7, 2023

That's odd -- are you sure? You see, this is scaffolding so
AsyncTAPJob.raise_if_error finds the error message; current main
expects it in self._job.message, this PR fixes it to be where we parse it
to now. I don't have time at the moment to investigate further, but
I have a hard time imagining how the code in main would find the
error message with this scaffolding.

Yeap, pulling only the changes from the test files to main, only one of them produces a failure, suggesting the change parts of the mock is not touched by any asserts.

=============================================== short test summary info ================================================
XFAIL pyvo/dal/tests/test_sia2_remote.py::TestSIACadc::test_datalink_batch - https://github.com/astropy/pyvo/issues/361
XFAIL pyvo/io/vosi/tests/test_tables.py::TestTables::test_wrong_flag
FAILED pyvo/io/uws/tests/test_job.py::TestJob::test_error_job - AssertionError: assert None == 'We have problem'
================================= 1 failed, 310 passed, 2 xfailed in 96.64s (0:01:36) ==================================

Absolutely agreed. But then TAP is a complex beast, and if we want
some test coverage without remote services (and the fragility those
bring with them), I don't think we can do a lot better that what's
currently in test_tap

Yes, that's understandable. I wonder maybe with some borderline trickery we could include these mock classes into the coverage run, which may help to smoke out the parts that are in the mock but not touched by the tests. Either case, solving or improving the situation points beyond this PR, so I go ahead and merge it given the confirmation above.

@bsipocz bsipocz added this to the v1.4.1 milestone Mar 7, 2023
@bsipocz bsipocz merged commit c6bdb0c into astropy:main Mar 7, 2023
@bsipocz
Copy link
Member

bsipocz commented Mar 7, 2023

Thanks @msdemlei for the fix!

bsipocz added a commit that referenced this pull request Mar 7, 2023
UWS error messages now sit on errorsummary.
@msdemlei
Copy link
Contributor Author

msdemlei commented Mar 8, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants