You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be neat if props can be modified along the way, e.g. if one of the steps end up finding a shortcut (because of input data) and only needing, say, 50% of its processing "time".
Support for controlling step sizes will be useful when for instance processing a set of elements in chunks, where step sizes are proportional to the chunk size. For example, for y <- future_lapply(x, FUN), the elements in x will be processed in nbrOfWorkers() chunks.
This is one of those things that requires long-term deep focus to get correct, especially since it's a matter of philosophy (e.g. "what does it really mean to do partial or weighted progress and what needs does it cover and what are we missing?") and design ("should it be absolute or relative step sizes, weights, or what?"). As soon as that is decided on/settled, then I think it'll be fairly quick to implement it. As soon as it's implemented, I think there's no going back and changing, so it's critical to get the design correct from the beginning.
I'm not sure when I'll have time to deep into this one, but feel free to comment here how you would use it and expand on your needs and use cases. Then more people who do this, the easier it'll be to focus on what the design should be.
Thanks for the quick update. I understand that this is not straightforward. My (current) use case is that the different tasks conducted in the lapply-call are not equally time consuming, first and foremost as involve different number of subtasks. See a constructed example below:
l <- list(1:3,2:9,5:7,2,3:4,5:6)
l
handlers(global = TRUE)
func <- function(x,p){
Sys.sleep(length(x)/2)
p(message="Computation ongoing")
x^2
}
future::plan(sequential)
progress_func <- function(l){
p <- progressr::progressor(along = l)
future.apply::future_lapply(l,func,p = p)
}
progress_func(l)
I would like the percentage to move by length(l[[i]])/length(unlist(l)) in iteration i, not 1/length(l). From what I understand, this is currently not possible, or is there are a way around this?
Rewriting the lapply-function is not an option here since in the real application slightly different tasks are conducted for the elements in l.
I obviously have a limited understanding of how progressr actually works as I didn't figure out this myself.
I've browsed the vignette and help functions for pointers and examples of the flexibility of the p <- progressor() and p(), but couldn't really find anything but the basic p(along = x) in the vignette. I am looking in the wrong place, or is this missing? I think a document showing developer use cases would be helpful for many (potential) users.
Activity
[-]make_progressor(steps, props)[/-][+]progressor(steps, props)[/+]HenrikBengtsson commentedon Apr 26, 2019
Allow for named steps and step sizes.
HenrikBengtsson commentedon May 9, 2019
Support for controlling step sizes will be useful when for instance processing a set of elements in chunks, where step sizes are proportional to the chunk size. For example, for
y <- future_lapply(x, FUN), the elements inxwill be processed innbrOfWorkers()chunks.Add support for progressor(step_sizes) [#13]
martinju commentedon Jul 7, 2022
Hi! I would very much like to see this feature. Any timeline for when this might be added?
HenrikBengtsson commentedon Jul 7, 2022
Sorry, no progress (pun intended) on this one.
This is one of those things that requires long-term deep focus to get correct, especially since it's a matter of philosophy (e.g. "what does it really mean to do partial or weighted progress and what needs does it cover and what are we missing?") and design ("should it be absolute or relative step sizes, weights, or what?"). As soon as that is decided on/settled, then I think it'll be fairly quick to implement it. As soon as it's implemented, I think there's no going back and changing, so it's critical to get the design correct from the beginning.
I'm not sure when I'll have time to deep into this one, but feel free to comment here how you would use it and expand on your needs and use cases. Then more people who do this, the easier it'll be to focus on what the design should be.
martinju commentedon Jul 11, 2022
Thanks for the quick update. I understand that this is not straightforward. My (current) use case is that the different tasks conducted in the lapply-call are not equally time consuming, first and foremost as involve different number of subtasks. See a constructed example below:
I would like the percentage to move by
length(l[[i]])/length(unlist(l))in iterationi, not1/length(l). From what I understand, this is currently not possible, or is there are a way around this?Rewriting the lapply-function is not an option here since in the real application slightly different tasks are conducted for the elements in l.
HenrikBengtsson commentedon Jul 17, 2022
You can do:
martinju commentedon Aug 2, 2022
Thanks, this works like a charm!
I obviously have a limited understanding of how
progressractually works as I didn't figure out this myself.I've browsed the vignette and help functions for pointers and examples of the flexibility of the
p <- progressor()andp(), but couldn't really find anything but the basicp(along = x)in the vignette. I am looking in the wrong place, or is this missing? I think a document showing developer use cases would be helpful for many (potential) users.As suggested