- Install:
devtools::install_github("harryprince/addinpromises")
- Add shortcut
Currently, setup shortcut as CMD
+ shift
+ B
.
- Insert code
Based on R pakcage promises
, you can easily convert a sync R code block to async. Here is the example:
dependecies:
library(future)
library(promises)
The original sync code:
spark_df %>%
head(1000) %>%
collect() %>% # mostly time-consuming process
View()
After asynchronized:
future(spark_df) %...>%
head(1000) %...>%
collect() %...>% # Now you are free
View()
After you claim your pipeline asynchronised, now you can do another meaningful job instead of waiting spark collecting data or another time-consuming computing.