Questions tagged [r-promises]

For questions about the ‘promises’ R package.

The ‘promises’ package implements the concept of asynchronous promises in R.

17 questions
7
votes
1 answer

shiny app download button and future_promise: Error in enc2utf8: argument is not a character vector

I am trying to create a download handler in shiny, but using future_promise() because it is possible that writing the file could take some time. Here is a working example of what I'd like to do, but without using the async framework: A working .Rmd…
richarddmorey
  • 976
  • 6
  • 19
4
votes
1 answer

Use future and promise inside reactive R shiny

I have a question regarding R shiny and more especially about the way to improve performance of my shiny app. I'm using some SQL queries that take quite long to run as well as some plot which take time to show up. I know that it is possible to use…
CCbs
  • 105
  • 3
3
votes
0 answers

why future_promise error is "Unhandled" with onRejected

Using future_promise with catch(.) (or then(onRejected=)), the error is still marked as "Unhandled" even though I think I'm attempting to handle it. library(future) library(promises) plan(multicore, workers = 3) Sys.getpid() # [1]…
r2evans
  • 141,215
  • 6
  • 77
  • 149
3
votes
1 answer

Why do withr::with_seed and R.utils::withSeed generate different results when used in async code?

I'm trying to learn async programming using R so that I can implement an app that requires generation of random numbers with specified seeds (always with specified seeds). I've been using R.utils::withSeed for this, but I know that withr::with_seed…
richarddmorey
  • 976
  • 6
  • 19
2
votes
1 answer

How can you use selecticizeGroupInput with a future_promise?

I am using a future promise to call my data more efficiently. However, I'm finding that my filters (called through selecticizeGroupServer) do not work with the future promise. See attached for a minimal reproducible example. The filters work as…
jstuebner
  • 33
  • 4
2
votes
0 answers

Timing promises in R

I'm timing a simple function that waits for 1 second and then prints a number. Wrapping it with a promise I was expecting that the promises would run after the timing was complete - which doesn't seem to be what is happening. My understanding is…
Vlad
  • 3,058
  • 4
  • 25
  • 53
1
vote
1 answer

Parallel processes in Shiny R (future, promises)

I have problem with understanding how parallel processes in Shiny works. I created simple Shiny app with 2 processes: first is waiting 10s (Sys.sleep(20)) second generate random heatmap both are triggered by actionButtons. The idea of the…
tomsu
  • 371
  • 2
  • 16
1
vote
0 answers

Problem with functions not waiting for variable to be filled before progressing

Soo i am developing this app, and i cant seem to figure how to fix this issue that i am having, the problem is that the first function is always throwing undefined on the "console.log(params)", i assume the problem is because the "const result" is…
bestry
  • 11
  • 3
1
vote
1 answer

How do I use a local `golem` package with `future()`?

TL;DR How do I reference/use a local package function from the shiny app that I am running, when it is not in my win-library? ERROR: Warning: Error in : there is no package called 'humblFinance' PSEUDO-CODE: output$p1 <- renderPlot({ …
JJ Fantini
  • 213
  • 1
  • 11
1
vote
0 answers

Trouble using promises with shiny

Suppose I have a shiny app that has an operation that takes a few seconds and the site is busy. On a multi-core machine I would like to take advantage of these cores so that I minimize user waiting time. I was thinking the promises library could…
ixodid
  • 2,180
  • 1
  • 19
  • 46
1
vote
0 answers

How to combine future_promise with memoise in R plumber

I am making an API with R package plumber. Some endpoints in this API would benefit from memoization, so I also use the memoise package. Combining both is pretty straight-forward, as demonstrated in this blog post. I'll build up on this post's…
Vongo
  • 1,325
  • 1
  • 17
  • 27
1
vote
1 answer

How to actually invoke promises?

I was looking at the promises package, but I can't figure out how to actually get promises do anything. All the available blocking mechanisms (like promise_all) return a promise, and there seems to be no obvious way to have the promise execute in…
MrMobster
  • 1,851
  • 16
  • 25
0
votes
0 answers

React-Native Firebase/Firestore V9x call getDownloadURL while mapping through users' snapshot

export async function getAllUsers() { // function to get the url of a firestore document const myUrl = async (docId) => { const myRef = ref(storage, `/profiles/${docId}.jpg\`); return await getDownloadURL(myRef).then((url) =\>…
0
votes
0 answers

Can I ensure a promises function is complete before continuing in R?

I am using the crrri package to webscrape some dynamic sites; however, when I run it across multiple pages in a for loop, there is a delay (I'm presuming because of the promises), which means that sometimes when accessing the html_temp file, it is…
timnus
  • 197
  • 10
0
votes
0 answers

Unable to use future_async function in R shiny app

I am trying to use the future_async() function as described here. But I get an error Warning: Error in future_async: could not find function "future_async" 51: eval [loadData.R#211] 50: eval 48: source 47: server…
1
2