-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
Gaia astroquery 1.1 #2376
Gaia astroquery 1.1 #2376
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2376 +/- ##
=======================================
Coverage 62.92% 62.92%
=======================================
Files 133 133
Lines 17269 17289 +20
=======================================
+ Hits 10866 10879 +13
- Misses 6403 6410 +7
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
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 are some commit duplications and merge commits, please rebase and maybe squash them down a bit, too.
astroquery/gaia/core.py
Outdated
@@ -911,5 +915,20 @@ def launch_job_async(self, query, name=None, output_file=None, | |||
upload_table_name=upload_table_name, | |||
autorun=autorun) | |||
|
|||
def get_status_messages(self): | |||
"""Retrieve the messages to inform users about | |||
the status of JWST 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.
the status of JWST TAP | |
the status of Gaia 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.
Updated. Thank you
astroquery/gaia/core.py
Outdated
@@ -74,6 +74,10 @@ def __init__(self, tap_plus_conn_handler=None, | |||
else: | |||
self.__gaiadata = datalink_handler | |||
|
|||
# Enable notifications | |||
if show_messages: |
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 add a test with show_messages=True
case that parses a dummy response with a message.
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.
Test added with show_message=True
astroquery/gaia/core.py
Outdated
@@ -51,7 +51,7 @@ def __init__(self, tap_plus_conn_handler=None, | |||
gaia_data_server='https://gea.esac.esa.int/', | |||
tap_server_context="tap-server", | |||
data_server_context="data-server", | |||
verbose=False): | |||
verbose=False, show_messages=True): |
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.
Somewhat tangential to this PR, but it would be great if all these __init__
parameters had a short docstring. And you could also consider making them keyword only arguments.
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 for your comment. I have brought your question to the team for internal discussion. We will came back to you soon.
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 recommend you replace show_messages
with something more descriptive so that it would be more obvious how it differs from verbose
.
CHANGES.rst
Outdated
casda | ||
^^^^^ | ||
|
||
- Add the ability to produce 2D and 3D cutouts from ASKAP images and cubes. [#2366] |
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 should not be removed
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.
Restored! Thanks
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.
The statement about not removing change log entries applies to all of them, not just this one entry individually.
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.
@eerovaher - This is a rebase issue, I can fix it when the PR otherwise ready to be merged rather than nitpick on the need of multiple round of rebases.
astroquery/gaia/__init__.py
Outdated
@@ -39,6 +39,8 @@ class Conf(_config.ConfigNamespace): | |||
'MCMC_GSPPHOT', | |||
'MCMC_MSC'] | |||
|
|||
GAIA_MESSAGES = _config.ConfigItem("notification?action=GetNotifications", "Gaia Messages") |
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.
What are the other possibilities for this configitem?
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.
Sorry. Not sure if I have understood your question. This is the way we use to add a modifier to the request.
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.
If this configuration item can only take one value then it is not configurable and should not be managed by the configuration system. So if you have implemented this as a configuration item then there must be more values it can take, but they are not documented anywhere.
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 has to be deleted now
string_message = line.decode("utf-8") | ||
print(string_message[string_message.index('=') + 1:]) | ||
except OSError as e: | ||
print("Status messages could not be retrieved") |
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.
Why the try/except, why not raise this as an exception instead? Is it expected to be unstable?
Also, no need for catching the exception (as e
) if you don't use it later.
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.
updated. Thank you!
astroquery/gaia/core.py
Outdated
string_message = line.decode("utf-8") | ||
print(string_message[string_message.index('=') + 1:]) |
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.
Equivalent, but shorter and clearer code:
string_message = line.decode("utf-8") | |
print(string_message[string_message.index('=') + 1:]) | |
print(line.decode("utf-8").split('=', 1)[1]) |
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 for your inputs. Updated!
3ff27d2
to
b66f849
Compare
A rebase went wrong here. Make sure you rebase on |
239bf98
to
1a321e1
Compare
Hello @mhsarmiento! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2022-06-13 15:46:49 UTC |
OK, so I correct this to: A rebase went wrong here. Make sure you rebase on the freshly fetched astropy/main instead of the main of your fork or esdc's fork. |
1a321e1
to
64d17fc
Compare
except ValueError as e: | ||
print(e) | ||
pass | ||
except OSError: |
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.
It is best to use the most specific error type possible. In this case it looks like ConnectionError
or perhaps even one of its subclasses would be more appropriate.
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 have opened a internal ticket to review your proposal
@@ -14,6 +14,7 @@ | |||
|
|||
|
|||
""" | |||
import unittest |
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.
The use of unittest
was just removed by 6ec71ce, it should not be reintroduced without a very good reason.
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.
removed
This pull request makes unannounced and unrelated changes to the XMM-Newton sub-package. It would be better to open a separate pull request for those. |
Ideally these should indeed be separate PRs, but at this point I don't think we should separate them and manage two parallel PRs. The changelog will need a fixing anyway, but that can be done as a last step. As for the review, I'll try to get back to it this week or the next. |
2ae9491
to
b491bf4
Compare
b491bf4
to
e10c47f
Compare
I have rebased again and removed the unnecessary commits, @mhsarmiento you can now proceed with the required changes. |
done! thanks a lot for your reviewing the rebase and the xmm changes @jespinosaar |
Thanks @bsipocz and @eerovaher for your support to the Gaia module in Astroquery. Your comments are very helpful and will be also applied to other ESA projects in Astrouquery. Those projects already pushed the same code to Astroquery to show the TAP notifications to the users (for example at esa/jwst module). |
I did some investigating to see what went wrong with the previous rebases and concluded that it was rebased on My assumption is because of the confusing nature of calling the personal fork and these origin/upstream. I think that this git default naming is unfortunate and not is not fit for purpose for any workflow that deals with multiple accounts and is therefore a cause of great pain. So to fix the workflow my suggestion is to rename all the remotes you work with to reflect the user/organization name on github. That way it's always clear which versions you are using as e.g. the base of a rebase. The workflow for a rebase, in that case, would be:
Hope it helps. (of course, the other approach is what you did, is to stash all commits done to one, but that also removes all granularity in the PR that may be useful later when one tries to trace the origin of a bug (which can be a bit problematic for very large PRs)) |
no worries, this takes time and practice for everyone, I feel the workflow got much easier already (at least on the reviewer end), so thank you! |
astroquery/gaia/core.py
Outdated
the status of Gaia TAP | ||
""" | ||
try: | ||
print("parsing notification messages") |
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 many users don't like default verbosity. OTOH from the archive's side, I understand why these messages are desirable.
So maybe a middle ground here to add another sentence to say how to turn it off?
Also, add a short paragraph about it in the narrative docs, users should know how to turn this off.
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 call to our TAP will tell the user if the TAP is under maintenance or it is not working, so they know if what they will do will be working in advance. But it is ok, we can add in the documentation how to turn it off. @mhsarmiento, could you please add this in the documentation of the python file and the .rst file?
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 many users don't like default verbosity. OTOH from the archive's side, I understand why these messages are desirable. So maybe a middle ground here to add another sentence to say how to turn it off?
Also, add a short paragraph about it in the narrative docs, users should know how to turn this off.
Hi @bsipocz , yes, the same code to show messages from the tap sever (before implementing the changes proposed in this PR) , can be found at esa/jwst/core.py line 681. In fact, the code implemented in Gaia was based on that. This is the reason because I was saying that your comments are really useful. We can use your comments to correct also this method under esa/jwst/core.py but in another PR
I don't think we have a precedent yet, in other modules (maybe @keflavich you can recall something). Do we know of any other servers where this would be useful? But I would suggest using something that can be reused generally for the other, non-tap modules, too. I don't really have a strong preference, beyond the potential reusability of the name for other modules. What about |
It is ok from our side. |
681aebb
to
e37fd67
Compare
astroquery/gaia/core.py
Outdated
except ValueError as e: | ||
print(e) | ||
pass | ||
except IndexError as e: | ||
print("Archive down for maintenance") | ||
pass |
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.
pass
is a null operation which is meant for situations where the Python syntax requires an indented code block, but no code should be executed. There is no need to use pass
here because the print()
calls form the indented code blocks that Python expects. Furthermore, in the case of an IndexError
, e
would be an unused variable.
except ValueError as e: | |
print(e) | |
pass | |
except IndexError as e: | |
print("Archive down for maintenance") | |
pass | |
except ValueError as e: | |
print(e) | |
except IndexError: | |
print("Archive down for maintenance") |
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.
Implemented. Thanks for the tip
…/gaia/core.py, method 'def get_status_messages'
Thanks @bsipocz!. GAIA_MESSAGES has been removed as conf item and hardwired at 'core.py'. If in the future there is a situation in which the user can interact with that we will put it back as conf item but for now there isn't any plan for that. |
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.
One more comment, otherwise I think this is good to go. (The archive is now down, so I see test failures with the docs, but that is unrelated to this PR, so address any actual issues that may come up separately when DR3 is out.)
astroquery/gaia/__init__.py
Outdated
@@ -39,6 +39,8 @@ class Conf(_config.ConfigNamespace): | |||
'MCMC_GSPPHOT', | |||
'MCMC_MSC'] | |||
|
|||
GAIA_MESSAGES = _config.ConfigItem("notification?action=GetNotifications", "Gaia Messages") |
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 has to be deleted now
I'm cleaning up the duplicate merges etc, and will do the init cleanups and merge this. |
…ations service to notify users of service availability problems
…etrieval_Type = "ALL" VS. Retrieval_type = "Epoch Photometry"
…/gaia/core.py, method 'def get_status_messages'
Renamed "show_messages" by "show_server_messages" Corrected test case as it was not contemplating the user case in which Gaia archive is down for maintenance.
d90083f
to
3990021
Compare
Thanks! I think that I forgot to commit this file. sorry for that. Yes, today at 12h CEST DR3 will be out! Very exciting times! :-) |
Thank you @mhsarmiento! |
Many thanks @bsipocz and @mhsarmiento ! |
@mhsarmiento @jespinosaar - should we change the default from DR2 to DR3 or it's too early? |
Hi! Yes, it should be changed from DR2 to DR3 as we have done the same the UI of GACS. Thanks for spotting this out |
Dear Astroquery Team,
This pull request contains a new feature in the Gaia module and an update in the default value of one of the parameters of the method 'load_data'
Thank you in advance,
all the best,
Maria