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

configuring progress messages #459

Open
mkoohafkan opened this issue Mar 13, 2024 · 3 comments
Open

configuring progress messages #459

mkoohafkan opened this issue Mar 13, 2024 · 3 comments
Labels
documentation feature a feature request or enhancement

Comments

@mkoohafkan
Copy link

mkoohafkan commented Mar 13, 2024

it appears that there are three ways to enable/disable progress messages:

  1. req_progress() allows you to enable progress messages and specify a direction, but does not allow you to disable them.
  2. req_options(noprogress = TRUE) looks like it can disable progress messages, but it is unclear as req_options() documentation states that these are curl options, not httr2 options.
  3. req_perform_*() functions (e.g., req_perform_paralle()) have a boolean progress argument.

It is unclear how these options interact. It appears that req_progress() is just a wrapper around req_options(noprogress = FALSE), but the documentation specifies that req_options() is for configuring curl options rather than httr2 options. It also appears that the progress argument to the multi-request functions req_perform_*() is a separate progress bar for the request batch, and unrelated to the progress bar for individual requests (so you could end up with nested progress bars, or disable the progress for the request batch but not the individual requests, or vice versa).

I have two suggestions:

  1. Add support req_progress(type = "none") so that request progress can be enabled/disabled from a single entry point, rather than requiring req_options() to disable and req_progress() to enable.
  2. Clarify the documentation on the progress argument to multiple request functions to differentiate it from req_progress().
@hadley
Copy link
Member

hadley commented Mar 13, 2024

Why do you want to disable the progress bar? (Rather than just failing to enable it?)

I'm a bit leery of adding a way to turn it off because I think that would imply the need for a bunch of other tools to suppress the actions that other req_ functions have taken.

@mkoohafkan
Copy link
Author

If the default is always for no progress messages then (1) is not needed. I was getting intermittent test errors because messages were occasionally being thrown, but on further inspection this may have been the parallel/iterative progress message rather than the request progress message. Note that req_perform_*() functions have progress = TRUE by default.

@hadley
Copy link
Member

hadley commented Mar 14, 2024

Hmmmm, we should probably suppress those by default in tests, since it's a bit easier for do it centrally in httr2 rather than in every package that wraps it.

I'll also clarify the difference in the progress bars to the docs: req_progress() adds a progress bar for the download of an individual request; the progress argument to req_perform_parallel() and friends gives the progress across all requests. I should also note that you can't use them together.

@hadley hadley added documentation feature a feature request or enhancement labels Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants