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

eHST queries and data using TAP and minor fixes in ESA modules #2597

Merged
merged 14 commits into from
Nov 26, 2022

Conversation

jespinosaar
Copy link
Contributor

Hi all,

This pull requests is covering the following issues:

  • After migrating eHST Science Archive to a new interface, our backend is mainly based on TAP. We have modified the data download to use the data distribution embedded in our TAP.
  • eHST documentation has been updated.
  • Added a new method in TapUtils to specify a client ID, useful for statistics.
  • Issue Rename query_xyz_tap and query() methods to query_tap #2363: method query_hst_tap has been updated to query_tap and deprecation warning is in place.
  • Issue ESA JWST remote test failues #2590: remote tests failing in eJWST have been fixed.
  • Remote tests failing in ISO documentation have also been fixed.

Thanks a lot!

cc @esdc-esac-esa-int

@codecov
Copy link

codecov bot commented Nov 23, 2022

Codecov Report

Merging #2597 (d5221e5) into main (ef8be74) will increase coverage by 0.00%.
The diff coverage is 79.79%.

@@           Coverage Diff           @@
##             main    #2597   +/-   ##
=======================================
  Coverage   64.20%   64.21%           
=======================================
  Files         130      130           
  Lines       16850    16885   +35     
=======================================
+ Hits        10819    10842   +23     
- Misses       6031     6043   +12     
Impacted Files Coverage Δ
astroquery/esa/hubble/core.py 83.63% <78.26%> (-2.84%) ⬇️
astroquery/esa/jwst/core.py 75.43% <100.00%> (ø)
astroquery/utils/tap/core.py 44.55% <100.00%> (+0.21%) ⬆️

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

@jespinosaar
Copy link
Contributor Author

Everything seems to be working, please let me know if you have further comments. Thanks!

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.

Over this looks to be almost ready to go, all remote tests pass, etc.

I've left some minor comments, and some that may point to a follow-up PR.

"""

@author: Javier Duran
Copy link
Member

Choose a reason for hiding this comment

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

This reminds me that we need to sort out a team page listing ESA as a significant contributor. It's not forgotten, we just haven't got to it yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Many thanks! just ping me if you need a list of users or something else.

Comment on lines 898 to 899
assert "This target name cannot be determined with this resolver: ALL" in err.value.args[0] or "Failed "
"to parse" in err.value.args[0]
Copy link
Member

Choose a reason for hiding this comment

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

You need parens around the linebreak otherwise you only assert on the string "Failed " (which is always True) rather than on "Failed to parse" in err.value.args[0].

Do the same for all the other similar lines below.

Suggested change
assert "This target name cannot be determined with this resolver: ALL" in err.value.args[0] or "Failed "
"to parse" in err.value.args[0]
assert "This target name cannot be determined with this resolver: ALL" in err.value.args[0] or ("Failed "
"to parse" in err.value.args[0])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@@ -78,39 +70,43 @@ def download_product(self, observation_id, *, calibration_level=None,
flag to display information about the process
product_type : string
type of product retrieval, optional
PRODUCT, SCIENCE_PRODUCT or POSTCARD
Copy link
Member

Choose a reason for hiding this comment

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

I wonder whether we need some extra docs, or deprecation that notifies anyone using these product types that things have changed?

Copy link
Member

Choose a reason for hiding this comment

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

Also, could you update the download_product usage in the docs to not use e.g. SCIENCE_PRODUCT?
(I see that the example still works, but I suppose it would be nice to clean up nevertheless)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the examples with the new parameters and added some deprecation messages in the code and the documentation.


def get_postcard(self, observation_id, calibration_level="RAW",
def get_postcard(self, observation_id, *, calibration_level="RAW",
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for doing this.

changing kwargs to be keyword only needs to be mentioned in a new changelog entry, look for copy-paste examples.

Copy link
Member

Choose a reason for hiding this comment

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

Also, I wonder, while you're at it, could you do this for all the methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

dump_to_file=output_file is not None)
table = job.get_results()
return table
warnings.warn(
Copy link
Member

Choose a reason for hiding this comment

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

Doing it with the deprecated decorator from astropy.utils may be a tiny bit simpler, but at this point you don't need to change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have also included the decorator, but I left the warning.

Copy link
Member

Choose a reason for hiding this comment

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

@deprecated ensures that a deprecation warning is emitted, so the warnings raised by the decorated function itself are duplicates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, commented below.

@@ -717,6 +746,22 @@ def get_tables(self, only_names=True, verbose=False):
else:
return tables

def get_status_messages(self):
Copy link
Member

Choose a reason for hiding this comment

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

you may want to mention this in the changelog or in the docs of all modules having it (get_status_messages is mentioned in the docs for the JWST module, but not for the rest)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is mentioned now.

dump_to_file=output_file is not None)
table = job.get_results()
return table

def query_hst_tap(self, query, async_job=False, output_file=None,
Copy link
Member

Choose a reason for hiding this comment

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

This deprecation needs to be mentioned in the changelog, preferably as a separate entry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deprecation included in the changelog. I have also ordered the different entries in the appropriate categories.

CHANGES.rst Outdated
@@ -32,7 +32,7 @@ esa.hubble
- Refactored query_criteria to use ehst.archive table therefore making the query
a lot faster. [#2524]

- Update TAP url to avoid 301 HTTPError. [#2567]
- Update to TAP url to query data and download files, aligned with the new eHST Science Archive. [#2567][#2597]
Copy link
Member

Choose a reason for hiding this comment

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

more changelog entries are needed for this PR to cover the various changes, see the comments below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changelog entries added. Please let me know if you think more are required.

@@ -194,7 +195,7 @@ def test_cone_search_coords(self):
assert "Coordinates must be either a string or " \
"astropy.coordinates" in err.value.args[0]

def test_query_hst_tap(self):
Copy link
Member

Choose a reason for hiding this comment

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

could you keep one query_hst_tap test, too to test whether the deprecation warning is issued?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added again and being executed.

@@ -86,19 +84,19 @@ def get_dummy_tap_handler(self):
return dummyTapHandler

def test_download_product_errors(self):
ehst = ESAHubbleClass(self.get_dummy_tap_handler())
ehst = ESAHubbleClass(tap_handler=self.get_dummy_tap_handler(), show_messages=False)
Copy link
Member

Choose a reason for hiding this comment

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

Can we have one show_messages=True test, too (with mocking some status messages)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test included.

@bsipocz bsipocz linked an issue Nov 23, 2022 that may be closed by this pull request
@jespinosaar
Copy link
Contributor Author

Thanks for your comments @bsipocz ! working on them.

@jespinosaar
Copy link
Contributor Author

I think I have answered all your comments @bsipocz , please let me know if further changes are required.

@jespinosaar
Copy link
Contributor Author

Don't know why the docs is taking so long...

Comment on lines 590 to 592
@deprecated(since="0.4.7", message=("Use of query_hst_tap method is no longer supported. "
"Please use query_tap method instead, with the same arguments."),
alternative="query_tap")
Copy link
Member

Choose a reason for hiding this comment

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

message does not have to be specified. The following works:

Suggested change
@deprecated(since="0.4.7", message=("Use of query_hst_tap method is no longer supported. "
"Please use query_tap method instead, with the same arguments."),
alternative="query_tap")
@deprecated(since="0.4.7", alternative="query_tap")

The resulting warning is

WARNING: AstropyDeprecationWarning: The query_hst_tap function is deprecated and may be removed in a future version.
        Use query_tap instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I have removed the AstropyDeprecationWarning

@staticmethod
def __set_client_id(client_id):
if client_id:
global TAP_CLIENT_ID
Copy link
Member

Choose a reason for hiding this comment

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

According to Python naming conventions TAP_CLIENT_ID is supposed to be (and so far has been) a module level constant. Now it should be changed to be an instance attribute instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified TAP_CLIENT_ID to be an instance attribute.

@jespinosaar
Copy link
Contributor Author

Ok, new comments have been implemented, thanks @bsipocz and @eerovaher !

@bsipocz
Copy link
Member

bsipocz commented Nov 26, 2022

@jespinosaar - Thanks for the PR and the very quick review cycle!

I did a minor rebase as there were two merge/duplicated commits. Github quicklook however now wrongly shows these as my commits, you may want to add your ext.esa.int email address to your github profile so they will be properly picked up by the web interface for you (git log showing them correctly, it's just the web interface issue).

@bsipocz bsipocz merged commit f59362b into astropy:main Nov 26, 2022
@bsipocz bsipocz mentioned this pull request Nov 27, 2022
62 tasks
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.

ESA JWST remote test failues
3 participants