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

First stab at req_perform_sequential() #361

Merged
merged 12 commits into from
Oct 30, 2023
Merged

First stab at req_perform_sequential() #361

merged 12 commits into from
Oct 30, 2023

Conversation

hadley
Copy link
Member

@hadley hadley commented Oct 26, 2023

Fixes #303. Fixes #310

@mgirlich this is just a quick proof of concept. If you think it looks good, I'll finish off the docs and tests. I did try allowing a NULL req in req_perform_iteratively(), but it ended up feeling very artificial since the next_req() callback would then ignore both its arguments.

If we have req_perform_parallel(), req_perform_sequential(), then I think the matching name would be req_perform_iterative(), not iteratively.

@hadley hadley requested a review from mgirlich October 26, 2023 20:53
R/sequential.R Outdated Show resolved Hide resolved
@mgirlich
Copy link
Collaborator

Looks good to me. We need to think about error handling. It should probably be the same as in req_perform_parallel() though I'm not sure we want to stick with the name cancel_on_error and the boolean logic there.

@hadley
Copy link
Member Author

hadley commented Oct 27, 2023

Yeah, I'll have a go at #310. I think an enum is the way forward. I've written up https://design.tidyverse.org/boolean-strategies.html to hopefully help me avoid this problem again in the future.

#'
#' @inheritParams req_perform_parallel
#' @inheritParams req_perform_iteratively
#' @param on_error What should happen if one of the requests throws an
Copy link
Member Author

Choose a reason for hiding this comment

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

@mgirlich let me know what you think of this error handling, and if it looks good, I'll port to req_perform_parallel().

Copy link
Member Author

Choose a reason for hiding this comment

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

And req_perform_iterative(), although that won't have the "continue" option.

R/sequential.R Outdated Show resolved Hide resolved
R/sequential.R Outdated Show resolved Hide resolved
R/sequential.R Outdated Show resolved Hide resolved
R/sequential.R Outdated Show resolved Hide resolved
@hadley hadley merged commit 204ac76 into main Oct 30, 2023
12 checks passed
@hadley hadley deleted the sequential branch October 30, 2023 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add error argument to req_perform_iteratively() Add helper to perform a request in chunks
2 participants