Skip to content

Plan for debugging (and traceback) #253

@mllg

Description

@mllg

I know there is the "transparent" plan, but I'm still not very helpful tracebacks:

library(future)
plan("transparent")
f = function(x) if (x > 5) stop("whoops") else x
g = function(x) f(x)
result %<-% g(10)
> Error in f(x) : whoops
> traceback()
17: stop(condition)
16: resignalCondition(future)
15: signalEarly(x, ...)
14: resolved.Future(future)
13: NextMethod()
12: resolved.UniprocessFuture(future)
11: resolved(future)
10: signalEarly(future, collect = FALSE)
9: run.UniprocessFuture(future)
8: run(future)
7: sequential(expr, envir = envir, substitute = FALSE, lazy = lazy,
       seed = seed, globals = globals, local = local, earlySignal = earlySig
nal,
       label = label, ...)
6: evaluator(expr, envir = envir, substitute = FALSE, lazy = lazy,
       seed = seed, globals = globals, packages = packages, ...)
5: (function (expr, envir = parent.frame(), substitute = TRUE, globals = TRU
E,
       packages = NULL, lazy = FALSE, seed = NULL, evaluator = plan("next"),

       ...)
   {
       if (substitute)
           expr <- substitute(expr)
       if (!is.function(evaluator)) {
           stop("Argument 'evaluator' must be a function: ", typeof(evaluato
r))
       }
       future <- evaluator(expr, envir = envir, substitute = FALSE,
           lazy = lazy, seed = seed, globals = globals, packages = packages,

           ...)
       if (!inherits(future, "Future")) {
           stop("Argument 'evaluator' specifies a function that does not ret
urn a Future object: ",
               paste(sQuote(class(future)), collapse = ", "))
       }
       future
   })(g(10), envir = <environment>, lazy = FALSE, seed = NULL, globals = TRU
E)
4: do.call(future::future, args = future.args, envir = assign.env)
3: futureAssign(name, expr, envir = envir, assign.env = assign.env,
       substitute = FALSE)
2: futureAssignInternal(target, expr, envir = envir, substitute = FALSE)
1: result %<-% g(10)

-> I just get the top level call, nothing about f().

  1. Would it be possible to create a plan which just calls base R functions? E.g., futureCall calls do.call, futureAssign calls assign, future_lapply calls lapply ...?
  2. Alternatively, would it be possible to store and query the traceback?
  3. Maybe there could also be a plan for the evaluate package?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions