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

Nested with_progress() #56

Open
HenrikBengtsson opened this issue Jun 15, 2019 · 1 comment
Open

Nested with_progress() #56

HenrikBengtsson opened this issue Jun 15, 2019 · 1 comment

Comments

@HenrikBengtsson
Copy link
Collaborator

HenrikBengtsson commented Jun 15, 2019

Add support for nested with_progress() calls where it's only the outer layer (or?) that ends up presenting progress.

@HenrikBengtsson
Copy link
Collaborator Author

Clarification: The below example produces two rounds of progress bars. It would be neat if nested with_progress() could be detected and automatically "merged" such that all progress updates from an inner with_progress() are relayed up to the parent with_progress() environment. This way we could end up getting a single progress bar with 2 * 5 = 10 steps, instead of two with 5 steps each.

library(progressr)
handlers("progress")

xs <- list(a = 1:5, b = 1:5)

ys <- list()

with_progress({
  p <- progressor(along = xs, scale = 5.0)
  for (kk in seq_along(xs)) {
    x <- xs[[kk]]
    with_progress({
      ys[[kk]] <- slow_sum(x)
    })
  }
})

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

No branches or pull requests

1 participant