Skip to content

IDEA: Signal amount=0 when receiving updates from nested progressors #107

Open
@HenrikBengtsson

Description

@HenrikBengtsson

When there are nested progressors, only the first one is listened to. Any progress conditions signaled by nested progressors are ignored. Here's an example of nested progressors:

library(progressr)
handlers(handler_progress(format=":spin :message [:bar] :percent"))

foo <- function(n) {
  p <- progressor(n)
  lapply(seq_len(n), FUN = function(ii) {
    p(sprintf("foo(%d)", ii))
    Sys.sleep(0.5)
  })
}

bar <- function(n) {
  p <- progressor(n)
  lapply(seq_len(n), FUN = function(ii) {
    foo(n = 5)
    p(sprintf("bar(%d)", ii))
  })
}

Calling

y <- bar(10)

will only report on bar() updates.

However, we could make use of those conditions by doing an amount=0 update, i.e. to communicate "still alive", which may for instance update a "spinner".

The code that drops/ignore nested progressors is in:

https://github.com/HenrikBengtsson/progressr/blob/a2cb9af430784fd46f89022d467755fff2b73d76/R/make_progression_handler.R#L318-L323

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions