-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run_in_master
cannot find correct variable when running in future.apply
#1
Labels
dependence
Issue because of dependence flaws. Might fix in the future
Comments
|
A failed example
library(future)
library(futurenow)
library(shiny)
## uncomment to enable debugging
# options('future.debug' = TRUE)
# futurenow::debug_futurenow('.debug.log', reset = TRUE, master_only = FALSE)
ui <- fluidPage(
actionButton("ok", "Run")
)
server <- function(input, output, session) {
observeEvent(input$ok, {
p <- Progress$new(session = session, min = 0, max = 10)
plan(futurenow)
on.exit({
p$close()
plan(sequential)
}, add = TRUE)
future.apply::future_lapply(1:10, function(i){
# Run something async
# Run in master session
run_in_master({
p$inc(amount = 1, message = 'Running item',
detail = sprintf('Processing %d', i))
}, local_vars = 'i')
# Run something async again
})
})
}
shinyApp(ui, server)
|
Created a wrapper for Lines 1 to 23 in 3e7678a
|
dipterix
added
the
dependence
Issue because of dependence flaws. Might fix in the future
label
Nov 28, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run_in_master
cannot find correct variables when running infuture.apply
.The
envir
passed tofuture
byfuture_lapply
is its own function environment. Becauserun_in_master
relies on this environment to search for variable, the variables are almost surely wrong unless variables are assigned toglobalenv
.This is a flaw in
future.apply
package. There's nothing wrong becauseenvir
was expected to find globals, not the "executing environment". However, ifglobals
are given tofuture
, isenvir
important anymore?Waiting for reply - futureverse/future.apply#70
The text was updated successfully, but these errors were encountered: