-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
ENH: Make regtap service aware #386
Conversation
There are several RegTAP services in the VO. PyVO by default uses the | ||
one at the TAP access URL http://reg.g-vo.org/tap. You can use | ||
alternative ones, for instance, because they are nearer to you or | ||
because the default endpoint is down. | ||
|
||
You can pre-select the URL by setting the ``IVOA_REGISTRY`` environment | ||
variable to the TAP access URL of the service you would like to use. In | ||
a bash-like shell, you would say:: | ||
|
||
export IVOA_REGISTRY="http://vao.stsci.edu/RegTAP/TapService.aspx" |
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 know that you don't yet want review, so I leave only one comment:
we should be able to do this with a more programatic way, from inside the python interpreter.
Whether to use the astropy config system, or also provide ways to override the defaults in a session, or be able to do both is a detail, but I very strongly think it should be doable without shell variables.
On Wed, Dec 21, 2022 at 04:31:50PM -0800, Brigitta Sipőcz wrote:
we should be able to do this with a more programatic way, from
inside the python interpreter.
You can (see registry.tests.test_regtap.test_endpoint_switching; it's
regtap.choose_RegTAP_service). But the env var method is IMHO still
important in the medium run -- I am hoping to set up RegTAP endpoints
in less well-connected regions, and then people there can
pre-configure their desired endpoints, which does make a noticable
difference (I have first-hand experience on this from South America
and China).
By the way, I'm also trying to talk Mark Taylor into interpreting
that environment variable.
|
e8bb39b
to
2caee9d
Compare
I milestoned this for 1.5, with the mindset that this is rather an enhancement rather than a bugfix. |
I think this is the only thing that holds up 1.5, if we want to maybe do a release soonish? I recall using this branch when testing the SIA2 registry stuff, so overall not sure how much more is missing for this to be ready to be merged. Maybe it's only a rebase from Markus and a review from Tom? |
(I'm mostly pushing for the release as it would be nice to get that SIA2 registry search compatibility out of the door) |
On Mon, May 08, 2023 at 07:10:06AM -0700, Brigitta Sipőcz wrote:
I think this is the only thing that holds up 1.5, if we want to
maybe do a release soonish? I recall using this branch when testing
the SIA2 registry stuff, so overall not sure how much more is
missing for this to be ready to be merged. Maybe it's only a rebase
from Markus and a review from Tom?
I'd love to see this in RSN -- it's real progress towards fulfilling
the promise of interoperating publishing registries. I've hence done
the rebase (oh boy, never rebase over a whitespace-everywhere commit)
and I hope I've not messed things up too much. Tom, a review would
be most appreciated. While we're all here, I'd actually be happy to
do that in presence.
I expect the test suite will throw two errors: One is about a QTable
(I'll investigate tomorrow -- alternatively, advice appreciated), the
other is a failing query on the StScI service. I *think* that's just
a matter of rolling out a fix on their side. Tom?
|
Could you push this back to the branch here? |
2caee9d
to
dec257d
Compare
I made some CI improvements, so will go ahead and rebase again and flip the switch to move this out from the draft PR status. |
dec257d
to
9e01762
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #386 +/- ##
==========================================
+ Coverage 80.11% 80.27% +0.16%
==========================================
Files 52 52
Lines 6085 6150 +65
==========================================
+ Hits 4875 4937 +62
- Misses 1210 1213 +3 ☔ View full report in Codecov by Sentry. |
@msdemlei - @tomdonaldson - this is all yours for review. |
On Wed, May 10, 2023 at 01:13:24AM -0700, Brigitta Sipőcz wrote:
@msdemlei - I wonder why CI doesn't see those failures you mention before, are they covered by tests or it's about use cases you haven't covered in the test suite yet?
So much the better if the CI doesn't see them. Note that I'm running
bleeding-edge pyvo against astropy and all the pytest packages as in
Debian stable, so it's totally possible we're just seeing legacy
behaviour blowing up.
[Side rant: Given today's standards of software engineering, I'm
actually rather impressed I can develop pyvo in that configuration.
You see, I can't for astropy, which needs a bleeding-edge venv (which
I'm unhappy about given the perils of pulling executable code from
only very lightly curated repos). Thanks to everyone for keeping
pyvo Debian stable-friedly!]
|
I would certainly raise this issue upstream. IMO it should all work in a stable environment and when it doesn't it certainly should be looked at as a bug rather than a feature. Getting the latest and greatest cool tools shouldn't be a requirement to do dev work. |
Um... I just noticed this still lingers in the doldrums where I'd say it's a big improvement over what we have in terms of letting people switch registries. So... @tomdonaldson – could you spare an eye? Or perhaps @theresadower? |
So, I've rebased and force-pushed here. Locally, I get three test failures at the moment:
So... yeah, it would be nice to get the test_endpoint_switching test |
I'm afraid this might have been rebased on an outdated branch. I started to look into a rebase on |
9e01762
to
e9a0e82
Compare
I went ahead and pushed the rebased version back to this branch as I managed to clear up the test failures that were due to the conflicts. I still see the endpoint switching issue @msdemlei mentioned above as well as an unrelated looking So, bottom line, would be nice to fix that one related test and make this work and merge and then finally release v1.5. |
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.
A lot of nitpicky comments with suggestions that would either help with fixing the links in the docsbuild (they could be part of #416, but I feel it's better to get things fixed when they pop-up), or suggestions for the failing doctest.
As none of these are critical (except fixing the failing doctest), that take them or leave them, they should not block merging this PR.
Also, could you please add a changelog entry?
>>> print("\n".join(sorted(r.get_interface("tap").access_url | ||
... for r in res))) |
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.
nitpick: we can have longer lines
>>> print("\n".join(sorted(r.get_interface("tap").access_url | |
... for r in res))) | |
>>> print("\n".join(sorted(r.get_interface("tap").access_url for r in res))) |
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.
Mhhh... I actually prefer broken lines and the loop expression on an extra line...
pyvo/dal/tap.py
Outdated
|
||
Returns | ||
------- | ||
A `pyvo.io.vosi.TableAccess` instance. |
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'm afraid a lot of these will cause docs build failures once we turn on nitpicky-mode, e.g. the API is not documented at this namespace but one layer down at https://pyvo.readthedocs.io/en/latest/api/pyvo.io.vosi.tapregext.TableAccess.html
So, while we don't have this nitpicky mode enabled, this practice this means that there are no functional links to the API docs in this docstring: https://pyvo--386.org.readthedocs.build/en/386/api/pyvo.dal.TAPService.html#pyvo.dal.TAPService.get_tap_cap
This is not merge blocker, just a heads up that we need to use the API path to the actual namespace we put things in.
Some of these I commented for in this PR, but I very likely didn't catch all of them
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.
Ah, can I be lazy and just ask: What's the right way that will be nitpicky-safe?
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.
Wrapping up #416 and putting it into CI. I was doing a little bit of work on that PR, but the main issue is that we need to make some decisions about what's in the public API (and thus documented) and what's not. Currently I went ahead and ignored a couple of classes that we said is not for public consumption, yet we try to link to them as e.g. they are used as base classes.
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.
(btw, wrapping up #416 is a bit of a hustle as there is an underlying sphinx-osx issue that in theory has a workaround but I never managed to make it work here, so I have to rely on CI for the iterations)
pyvo/dal/tap.py
Outdated
@@ -128,6 +128,20 @@ def __init__(self, baseurl, session=None): | |||
if hasattr(self._session, 'update_from_capabilities'): | |||
self._session.update_from_capabilities(self.capabilities) | |||
|
|||
def get_tap_cap(self): |
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.
can we spell out cap
here?
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.
Absolutely, yes.
pyvo/io/vosi/tapregext.py
Outdated
|
||
def get_feature(self, ivoid, form): | ||
""" | ||
returns the `LanguageFeature` with ivoid and form if present. |
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.
returns the `LanguageFeature` with ivoid and form if present. | |
returns the `~pyvo.io.vosi.tapregext.LanguageFeature` with ivoid and form if present. |
pyvo/dal/tap.py
Outdated
|
||
Returns | ||
------- | ||
A `pyvo.io.vosi.TableAccess` instance. |
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.
A `pyvo.io.vosi.TableAccess` instance. | |
A `~pyvo.io.vosi.tapregext.TableAccess` instance. |
|
||
Parameters | ||
---------- | ||
service : `dal.tap.TAPService` |
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.
service : `dal.tap.TAPService` | |
service : `~pyvo.dal.tap.TAPService` |
pyvo/registry/rtcons.py
Outdated
to write that constraint, or because it is missing a table or column. | ||
|
||
To recover, choose another RegTAP service. Search constraining | ||
``datamodel="regtap"``, and then use `pyvo.registry.switch_RegTAP_service` |
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.
switch_RegTAP_service
doesn't seem to exist anywhere in the API. Is it meant to be choose_RegTAP_service
here?
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.
Yes... this is what happens when you change your naming preferences in between edits. Fixed.
pyvo/registry/regtap.py
Outdated
Returns | ||
------- | ||
|
||
~`pyvo.registry.regtap.Interface` |
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.
~`pyvo.registry.regtap.Interface` | |
`~pyvo.registry.regtap.Interface` |
pyvo/registry/regtap.py
Outdated
tables, etc. | ||
|
||
To switch to a different RegTAP service, use | ||
:py:func:`change_RegTAP_service`. |
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.
there doesn't seem to be a change_RegTAP_service
. Is it meant to be choose_RegTAP_service
here?
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.
Please hand me a brown bag. Fixed in the next commit as well.
docs/registry/index.rst
Outdated
... for r in res))) | ||
http://dc.zah.uni-heidelberg.de/tap | ||
http://gavo.aip.de/tap | ||
http://voparis-rr.obspm.fr:80/tap |
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.
This causes one of the test failures
http://voparis-rr.obspm.fr:80/tap | |
http://voparis-rr.obspm.fr/tap |
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.
Thanks...
Good point, and exactly the reason we don't run astroquery remote tests on PRs, but on commits. Which means extra care has to be made prior to merging (in practice I run the given module locally), but ultimately we may figure out a way that does it more automaticly (e.g. only trigger remote tests of the given module, but even that would be too much for astroquery where we have diverse contributions). Here, I'll try to remember to look into whether the PR status can be a trigger for github actions (e.g. we don't run the full test suite for draft PRs), or we may just want to use a label to trigger more resourceful remote tests? TLDR, I'll need to think about how to make it more robust without adding a large burden for the remote services. |
Yes, I enthusiastically agree! |
gentle ping that once this one gets wrapped up we can do the long-awaited 1.5 release 😄 |
On Wed, Dec 13, 2023 at 08:52:28AM -0800, Brigitta Sipőcz wrote:
gentle ping that once this one gets wrapped up we can do the
long-awaited 1.5 release 😄
Oh, I'm sorry. If forgot to push my latest changes. And I hadn't
put in my changelog entry, either, as I just noticed. I'll pay more
attention to the CI this time, promised.
Thanks for your patience!
|
That's regtap.choose_RegTAP_service. While I'm at it (not really related): cleanup of get_interface's docstring
More specifically, it will use UNION only if available, falling back to the much-harder-to-plan OR otherwise. This commit also fixes a bug in the UNION-based condition where multiple words were joined (in effect) with an OR rather than and AND as documented. To make this more convenient, this adds a get_tap_cap method to TAPServices; this returns the (first) tr:TableAccess capability on the service. The IVOA are not really saying what multiple such capabilities would mean, so for now I'd say we're good on just returning the first one (and it's in line with what we've been doing so far with maxrec and hardlimit; upload_methods would now change behaviour if there were upload methods distributed over multiple TableAccess-es; but the previous behaviour would have been bad anyway). We are also adding convenience methods for accessing the tap capability to the TAPService, for accessing the ADQL language in there, and for pulling out language features and UDFs. We probably want to document these somewhere visible, as advanced users (cross-server) can do smart things with them. But then perhaps that's too esoteric for now. It is an interesting question whether at least get_adql (or something more aptly named) should sit on TAPService itself...
...when the current TAP server doesn't support MOC or doesn't have stc_spatial.
Regrettably, this currently fails on both alternative endpoints because of validity problems. I'll try to work it out with the operators.
(and a pdb tracing call removed)
This helps certain SQLServer-based implementations while not impacting compliant ones; consider this defensive programming.
This enables checking for table presence doing table_name in tableset.
This was missing the declaration of the res_subject table that it needs (and that's not neccessary in the union branch because the table is in a subquery there.
Ok, and I've rebased to current main. @tomdonaldson, can you perhaps add your placet? |
29958e0
to
1bbc88f
Compare
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.
Thanks @msdemlei ! This all look good to me now. The _extra_tables
mechanism seems like a nice way to address the need for the extra join.
- registry.search now introspects the TAP service's capabilities and | ||
only offers extended functionality or optimisations if the required | ||
features are present [#386] |
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.
As this is user facing, I would think the information that now it's possible to use other registries is important to list, or to list as well.
That being said, I would go ahead and merge this as is so I can go ahead and do more tests and cleanups, but please do advise a rephrasing and I'll fix up the changelog before the release.
Thank you so much @msdemlei! |
On Fri, Dec 15, 2023 at 11:37:31AM -0800, Brigitta Sipőcz wrote:
@bsipocz commented on this pull request.
> +- registry.search now introspects the TAP service's capabilities and
+ only offers extended functionality or optimisations if the required
+ features are present [#386]
That being said, I would go ahead and merge this as is so I can go
ahead and do more tests and cleanups, but please do advise a
rephrasing and I'll fix up the changelog before the release.
Is it legal to have two Changelog items for one PR? If so, I'd make
an extra item and say something like:
You can now change the registry endpoint that registry.search uses
at runtime using the choose_RegTAP_service function. [#386]
I think that's enough for a Changelog; whoever wants to do that kind
of thing will find in the docstring of the function both info on
global selection using IVOA_REGISTRY and how you can find alternative
endpoints.
|
Of course it is, thanks for the extra text! |
This PR contains a set of changes addressing the fixable but not yet
fixed issues raised by Tom in
https://wiki.ivoa.net/internal/IVOA/InterOpOct2022Reg/PyVOandNAVORegTAP.pdf
PyVO now properly checks whether the server can do something not in
RegTAP 1.0 before trying it. This concerns the optimisation of the
Freetext constraint as well as the STC constraints.
To make this reasonably easy to write, this retrofits some methods to
non-registry code: