Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #709 +/- ##
==========================================
+ Coverage 80.60% 80.71% +0.11%
==========================================
Files 90 90
Lines 10366 10443 +77
==========================================
+ Hits 8355 8429 +74
- Misses 2011 2014 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
msdemlei
left a comment
There was a problem hiding this comment.
Thanks for taking pyVO on this presumably inevitable path. I think we can in principle merge this even before there is any proper agreement on how this should eventually look like.
However, I'd like it a lot better if there were not, for now, a default cloud provider; at least during the prototype phase, people should need to explicitly pass these in.
Also, I'd auto-detect columns based on an invented UCD (meta.ref.cloudstorage, say). If this turns out to work, we can always get it sanctioned. The alternative of using a utype ("adhoc:cloudstorage") could later interfer with obscore (though it really shouldn't). I'd not insist on that, though. If you say "no, I want bespoke column names", you'd have my blessing, too.
But most importantly: please make it crystal clear in the documentation that this is a draft API that is probably subject to change.
msdemlei
left a comment
There was a problem hiding this comment.
Sorry for having missed the review request. Not sure how it got lost.
From where I stand, I'm reasonably happy with what I see. I would prefer if someone from another place that uses "cloud" storage had a look at this and agreed this is the way to do it (I'm from Europe and hence am not afflicted); but if other maintainers are fine, too, I'll not stand in the way of merging.
In particular not if this then is accompanied with a short IVOA note that explains how this is supposed to work, how other data providers can adopt it and that shows a few pieces of code based on this.
…sts, fixed changelog entry
| >>> next(datalink.bysemantics("#this")).content_type | ||
| 'application/fits' | ||
|
|
||
| Cloud Access Information [subject to change] |
There was a problem hiding this comment.
also, what do you mean subject to change? Add a note book in the narrative rather than in the heading instead.
| As data becomes available from different cloud providers, some services are | ||
| including cloud access information in the associated Datalink in JSON format. | ||
| The ``get_cloud_params`` and ``iter_get_cloud_params`` functions for | ||
| Records and Results respectively return an ``astropy.Table`` with the |
There was a problem hiding this comment.
there is no such thing as astropy.Table.
| Records and Results respectively return an ``astropy.Table`` with the | |
| Records and Results respectively return an `~astropy.table.Table` with the |
There was a problem hiding this comment.
I don't think Records and Results are proper nouns, maybe rephrase this sentence, too? Maybe do an intersphinx link instead pointing to the class?
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| As data becomes available from different cloud providers, some services are | ||
| including cloud access information in the associated Datalink in JSON format. | ||
| The ``get_cloud_params`` and ``iter_get_cloud_params`` functions for |
There was a problem hiding this comment.
| The ``get_cloud_params`` and ``iter_get_cloud_params`` functions for | |
| The ``get_cloud_params`` and ``iter_get_cloud_params`` methods for |
| As data becomes available from different cloud providers, some services are | ||
| including cloud access information in the associated Datalink in JSON format. |
There was a problem hiding this comment.
This reads a little bit weird/too vague. Could you maybe rephrase? Also, I believe we mostly use datalink as common noun in similar contexts above in this docs.
| Records and Results respectively return an ``astropy.Table`` with the | ||
| parameters specified to access data via the cloud service provider specified. | ||
|
|
||
| More generic functions, ``parse_json_params`` and ``iter_parse_json_params``, |
There was a problem hiding this comment.
| More generic functions, ``parse_json_params`` and ``iter_parse_json_params``, | |
| More generic methods, ``parse_json_params`` and ``iter_parse_json_params``, |
There was a problem hiding this comment.
also, consider intersphinx link all the methods here instead of just static highlighting
|
|
||
| """ | ||
|
|
||
| # init results table (avoiding adding import of astropy.table.Table) |
There was a problem hiding this comment.
I feel this is unnecessary premature optimization as we likely end up with Table imported anyway, but it can stay for now.
| except UnboundLocalError: | ||
| pass |
There was a problem hiding this comment.
why do we expect this, can you add a comment for it?
| @pytest.fixture() | ||
| def datalink_cloud1(mocker): | ||
| def callback(request, context): | ||
| dl_base = parse('pyvo/dal/tests/data/datalink/datalink.xml') |
There was a problem hiding this comment.
please use get_pkg_data_contents to get the datafile like we do elsewhere in the library
| def get_cloud_params( | ||
| self, | ||
| provider: str, | ||
| colname: str = "cloud_access", |
There was a problem hiding this comment.
| colname: str = "cloud_access", | |
| *, | |
| colname: str = "cloud_access", |
| """ | ||
| for irow, dl_results in enumerate(self.iter_datalinks()): | ||
|
|
||
| products = dl_results.bysemantics("#this") |
There was a problem hiding this comment.
I feel this should reuse get_cloud_params rather than copy a large fraction of the same code
As data becomes available from different cloud providers, some services are including cloud access information in the associated Datalink in JSON format.
This PR adds functionality to the DatalinkRecordMixin and the DatalinkResultsMixin to handle basic parsing of JSON entries in a uniform way. The methods ask for a column name and a key to identify specific entries in the JSON to parse and return, and allows matching other named parameters. The parsed JSON entries are returned in an astropy.Table with added columns to indicate the row of the original Results object to which the row belongs, and the row of the DatalinkResults where applicable.
While JSON entries are non-standard at present, they are not disallowed in DatalinkResults and are currently being included without official standard or guidance. This PR does not impose a standard, but provides a set of convenience functions which facilitate the use of existing data.