futureverse / futureverse/future

Plan for debugging (and traceback)

Open
#253 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
1k
Forks
92
PR merge metrics
No merged PRs in 30d

Description

I know there is the `"transparent"` plan, but I'm still not very helpful tracebacks:
```r
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 = , 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?

Contributor guide

Open the contributing guide

Research direction

Start with the existing `transparent` plan and the traceback produced by the `g(10)` example. Review the behavior of `futureCall`, `futureAssign`, and `future_lapply`, then assess whether base-R execution or storing a traceback is the intended scope. The `evaluate` package plan is an additional option; done should mean an agreed approach that provides a useful traceback or clearly defines its limits.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.