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

Add datalink original row #559

Merged
merged 3 commits into from
Jul 2, 2024
Merged

Conversation

msdemlei
Copy link
Contributor

This is an attempt to fix bug #542. It's not particularly pretty, but I don't think becoming much cleverer here is worth it.

I'm marking this as a draft while I'm still working out whether we should pass around a few extra original_row-s.

@bsipocz bsipocz added this to the v1.6 milestone Jun 20, 2024
@msdemlei msdemlei changed the title [DRAFT] Add datalink original row Add datalink original row Jun 27, 2024
@msdemlei msdemlei requested a review from bsipocz June 27, 2024 12:57
obscore or SIAP service, where the media type is
application/x-votable;content=datalink –, one can build a
DatalinkResults using
:py:meth:`~pyvo.adhoc.DatalinkResults.from_result_url`:
Copy link
Member

Choose a reason for hiding this comment

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

This is not the correct namespace, thus the sphinx error.

Suggested change
:py:meth:`~pyvo.adhoc.DatalinkResults.from_result_url`:
:py:meth:`~pyvo.dal.adhoc.DatalinkResults.from_result_url`:

.. doctest-remote-data::
>>> rows = vo.dal.TAPService("http://dc.g-vo.org/tap"
... ).run_sync("select top 5 * from califadr3.cubes order by califaid")
>>> for dl in rows.iter_datalinks():
Copy link
Member

Choose a reason for hiding this comment

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

This example runs into the DALFormattingError, that is very similar to #361, thus it fails the test.

(Technically it's a warning, so we can deal with it if necessary, but it would be nicer to fix it instead, if possible)

@msdemlei
Copy link
Contributor Author

Sorry for another force-push, and one that reverses the history on top. On the other hand, this has now a passing and reasonably fast docs/dal/index.rst. So... if the CI passes, could you have another look, @bsipocz?

@msdemlei
Copy link
Contributor Author

msdemlei commented Jun 28, 2024 via email

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.

Minor comments only, except that original_row=None doesn't feel right in clone_byid as a default, shouldn't that be a copy as well from the object?

pyvo/dal/adhoc.py Show resolved Hide resolved
docs/dal/index.rst Show resolved Hide resolved
Comment on lines 656 to 657
res = super(DatalinkResults, cls).from_result_url(
result_url, session=session)
Copy link
Member

Choose a reason for hiding this comment

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

can be written in one line, maybe more readable that way

Suggested change
res = super(DatalinkResults, cls).from_result_url(
result_url, session=session)
res = super().from_result_url(result_url, session=session)

@@ -597,7 +619,7 @@ def clone_byid(self, id):
for x in copy_tb.resources:
if x.ID and x.ID not in referenced_serviced:
copy_tb.resources.remove(x)
return DatalinkResults(copy_tb)
return DatalinkResults(copy_tb, original_row=original_row)
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't original row be a copy as well, from whatever is already set in the class, in self.original_row?

@msdemlei
Copy link
Contributor Author

msdemlei commented Jul 2, 2024 via email

Using this opportunity to speed up the doctest by using smaller/faster
services.  It's now running in 10 seconds on my box in my neck of the net,
which sounds a lot more reasonable than what was there before.
It also does some minor improvements to the documentation of how to use
datalink.  But that part could really use a lot more love...
@bsipocz
Copy link
Member

bsipocz commented Jul 2, 2024

my bad about the __init__, I clearly misread the github diff rendering and assumed L436 belonged to the baseclass. The rest are fine, thanks!

@bsipocz bsipocz merged commit 6483e59 into astropy:main Jul 2, 2024
9 of 10 checks passed
@bsipocz
Copy link
Member

bsipocz commented Jul 2, 2024

Thanks @msdemlei!


.. remove skip once https://github.com/astropy/pyvo/issues/361 is fixed
.. doctest-skip::
Datalink lets operators associate multiple artefacts with a dataset.
Copy link
Contributor

Choose a reason for hiding this comment

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

artefacts->artifacts

Copy link
Member

Choose a reason for hiding this comment

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

I add this typo fix to #574

@bsipocz bsipocz added this to the v1.5.3 milestone Oct 14, 2024
bsipocz added a commit that referenced this pull request Oct 15, 2024
bsipocz added a commit that referenced this pull request Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants