-
Notifications
You must be signed in to change notification settings - Fork 17
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
having issue running shiny and promises #10
Comments
That used to be true, but we have gone out of our way to disallow that. We don't process new input messages (or invalidateLater timer events) for a session unless/until all previous input messages have been fully processed. If we didn't do this it would be difficult to reason about reactive code because you would have inputs changing state in the middle of async operations. The goal of the async functionality is less about reducing latency for a single session, and more about preventing multiple sessions from blocking each other. |
DT isn't ready for promises yet, I have to make some changes there. Most htmlwidget packages will not need modifications to work for their render functions to work with promises, but DT does a lot of custom stuff. |
There's now an |
Thanks, I will try it
…On Thu, Feb 15, 2018 at 7:49 PM, Joe Cheng ***@***.***> wrote:
There's now an async branch for DT, FYI.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJ-FwSmjakc0VBsiqI6lwqQ0Uqv03Pz7ks5tVNCIgaJpZM4Q2d76>
.
|
Currently the async branch does not seem to function. The datatable output is blank. |
It works for me on Window, not on Ubuntu (blank) as @boxiangliu |
…put on Ubuntu (ok on Windows) rstudio/promises#10
I'm having the same issue when I try to use DT with promises, as @felloumi : 'Error in datatable: 'data' must be 2-dimensional (e.g. data frame or matrix)'. |
Try to use the github version of htmlwidgets |
Thank you, @dmenne. I just installed the dev version of htmlwidgets, but it didn't work. So, I tried to install the dev version of DT as well, and it seems it worked. At least the async datatable output show up. |
Sorry, my error. I should have said "of DT". Glad it worked. |
Hi Joe,
I looked at your slides at https://www.dropbox.com/s/2gf6tfk1t345lyf/async-talk-slides.pdf?dl=0 and run the following similar code:
library(promises)
library(shiny) # async version
library(future)
plan(multiprocess) # use another R process/running in the background
#availableCores() # 8
longRunningFunction <- function(value) {
Sys.sleep(10)
return(value)
}
ui <- fluidPage(
Application title
titlePanel("Testing shiny@async, future and promises"),
actionButton("train", "slowest function"),
verbatimTextOutput("summary"),
actionButton("option", "Display 20"),
verbatimTextOutput("result")
)
server <- function(input, output,session) {
model <- eventReactive(input$train, {
})
output$summary <- renderPrint({
})
model2 <- eventReactive(input$option, {
})
output$result <- renderPrint({
})
}
Run the application
shinyApp(ui = ui, server = server)
I expected that when I click on the first button (slowest function) and then immediately click on the second button to display 20 however it happened after I got the message from the first button. I thought that the first function will be run on the background. I am not sure if some thing is wrong with my code. I appreciate any clarification on this.
Thanks,
FE
The text was updated successfully, but these errors were encountered: