Thanks to visit codestin.com
Credit goes to github.com

Skip to content

future.globals does not seem to work when variables are "created" in the named list #10

@DavisVaughan

Description

@DavisVaughan

Kind of an obscure issue but definitely an issue:

library(future.apply)

plan(sequential)
future_lapply(
  X = 1, 
  FUN = function(x) {y}, 
  future.globals = list(y = 4)
)
#> Error in ...future.FUN(...future.X_jj, ...): object 'y' not found

z <- 1
future_lapply(
  X = 1, 
  FUN = function(x) {y}, 
  future.globals = list(y = z)
)
#> Error in ...future.FUN(...future.X_jj, ...): object 'y' not found

Created on 2018-05-09 by the reprex package (v0.2.0).

Interestingly, the y value is recognized as a global, and makes it into the environment that the expression is evaluated in. You can see this by debugging and making your way to this line of run.UniprocessFuture(). Not sure why it can't be seen inside the lapply() after that

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions