Skip to content

ESO downloads: no 'verbose' option #1357

Closed

Description

@keflavich

Some of the data retrieval options in the ESO module lack a verbose flag and are excessively verbose in at least one reported case (see astropy mailing list). We need to make sure that all output can be silenced.

Activity

  1. kakirastern commented on Mar 31, 2019

    @kakirastern
    Contributor

    Will add this when I add some additional keywords to the ESO module as outlined in #1233...

  2. kakirastern commented on Apr 5, 2019

    @kakirastern
    Contributor

    @keflavich Are these log messages from Requests?

  3. keflavich commented on Apr 5, 2019

    @keflavich
    ContributorAuthor

    I don't think so. requests doesn't generate any output that I'm aware of

  4. bsipocz commented on Apr 5, 2019

    @bsipocz
    Member

    Actually those "Downloading URL..." lines are coming from the progress bar in query.py, so a way to easier silence it (and/or docs how to do it) is what we need.

    Otherwise it's worth the time either to invest in setting up an IDE, or build up command line tools that help in searching in the codebase rather than guessing where certain lines are coming from.

  5. kakirastern commented on Apr 16, 2019

    @kakirastern
    Contributor

    Copying from original emails for reference by contributors...

    Inquiry from user:

    I am using astroquery v. 0.3.9 running with python 3.6.

    When using eso.retieve_data I get a flood of identical (and hence
    meaningless) download messages of the form:

    ...
    Downloading URL
    http://dataportal.eso.org/dataPortal/requests/user_name/401459/SAF/KMOS.2017-02-24T00:52:51.138/KMOS.2017-02-24T00:52
    ...
    Downloading URL
    http://dataportal.eso.org/dataPortal/requests/user_name/401459/SAF/KMOS.2017-02-24T00:52:51.138/KMOS.2017-02-24T00:52
    Downloading URL
    http://dataportal.eso.org/dataPortal/requests/user_name/401459/SAF/KMOS.2017-02-24T00:52:51.138/KMOS.2017-02-24T00:52
    Downloading URL
    http://dataportal.eso.org/dataPortal/requests/user_name/401459/SAF/KMOS.2017-02-24T00:52:51.138/KMOS.2017-02-24T00:52
    ...
    repeated several 100?s of times.
    Is there any way to turn this output off, or at least reduce its quantity?

    Response from repo maintainer:

    This looks like an error where the progressbar_or_spinner class is producing a newline each time instead of overwriting the existing line; I suspect this has to do with your terminal settings but I'm not exactly sure how to fix it. We generally have a verbose boolean option that can be set to False, but it looks like we omitted it in this case; I consider that a bug so we'll note it and try to fix it.

    -- Dated circa February 13, 2019
    (Edited for clarity and brevity.)

  6. Knusper commented on Feb 3, 2020

    @Knusper

    This error still exists.

  7. bsipocz commented on Feb 3, 2020

    @bsipocz
    Member

    @Knusper - If an issue is open, it's likely it's still relevant. PRs are welcome.

  8. Knusper commented on Feb 3, 2020

    @Knusper
  9. nandita11 commented on Oct 18, 2020

    @nandita11
    Contributor

    Can I take this up @bsipocz ?

  10. bsipocz commented on Oct 18, 2020

    @bsipocz
    Member

    @nandita11 - yes, absolutely. However, I would advise to wait until the maintainers discuss whether the verbose kwarg or switching to logging is the more preferable.

    @keflavich @ceb8 - what do you think, should we still at verbose kwargs, or rather use the logger? @andamian good arguments was pushing my thinking towards the logger only setup rather than verbose printing

  11. Knusper commented on Oct 18, 2020

    @Knusper

    Sorry, I think there is a misunderstanding here. This issue is not about turning verbose off and on (this was fixed). This is about an issue with the spinner spamming the output on some systems.

  12. ceb8 commented on Oct 19, 2020

    @ceb8
    Member

    @Knusper That was my bad, I didn't read it closely enough.

    @nandita11 Given the above clarification this isn't actually a novice ticket.

  13. Knusper commented on Oct 20, 2020

    @Knusper

    I think the bug title also should be changed.

    Title: Downloads from ESO archive spam shell. Description: see #1357 (comment)

    The relevant code that spams the output is around here:

    with ProgressBarOrSpinner(

    There appears also be a related issue opened by @bsipocz in the astropy bugtracker... So I really have no idea why this happens, in principle ProgressBarOrSpinner should not spam the output like this... Unfortunately I don't have the time to debug this further.

  14. Knusper commented on Oct 20, 2020

    @Knusper

    Ah, and by the way - I was wrong about the verbose switch being fixed. So this bug here is actually two bugs - if verbose is turned on (cannot be turned off at the moment), it should not be excessively and meaninglessly verbose...

  15. Knusper commented on Apr 14, 2021

    @Knusper

    OK - after hunting I am really sure the excessive spamming of the output comes from astropy #1357 (comment)

    The requested verbose flag here should be easy to implement. I will try to file a PR soon.

  16. pllim commented on Apr 14, 2021

    @pllim
    Member

    I don't think astroquery should be using astropy progress bar. It is a long-standing bug and I don't see it getting fixed anytime soon. Better to replace it with something else more modern. Also see astropy/astropy#4738

  17. Knusper commented on Apr 30, 2021

    @Knusper

    For now I have monkey patched astroquery for my project to avoid the excessive verbosity, while still getting feedback on what is happening:

    modified   astroquery/query.py
    @@ -411,8 +411,8 @@ class BaseQuery:
                 progress_stream = io.StringIO()
     
             with ProgressBarOrSpinner(
    -                length, ('Downloading URL {0} to {1} ...'
    -                         .format(url, local_filepath)),
    +                length,
    +                f"Downloading {url} ...",
                     file=progress_stream) as pb:
                 with open(local_filepath, open_mode) as f:
                     for block in response.iter_content(blocksize):
    

    I guess the idea for a permanent fix would be to use tqdm?

  18. keflavich commented on Apr 30, 2021

    @keflavich
    ContributorAuthor

    Yes, tqdm would be fine.

    Your monkeypatch just removes the filename reporting, though - is the issue not with the progressbar?

  19. Knusper commented on Apr 30, 2021

    @Knusper
  20. keflavich commented on Apr 30, 2021

    @keflavich
    ContributorAuthor

    Ah, yes, that makes sense, and is a fair workaround. But indeed, the best solution is to avoid the spamming in the progressbar

  21. bsipocz commented on Dec 11, 2023

    @bsipocz
    Member

    Addressed by #2681

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions