Spaces:
Running
Running
parallelised download function
Browse files- Dockerfile +1 -1
- app/app.R +7 -5
Dockerfile
CHANGED
@@ -9,7 +9,7 @@ RUN R -q -e "install.packages(c('shinyWidgets', 'shinycssloaders'))"
|
|
9 |
|
10 |
# other R packages
|
11 |
RUN R -q -e "install.packages(c('DT', 'plotly', 'scico', 'ggthemes'))"
|
12 |
-
RUN R -q -e "install.packages(c('data.table', 'dtplyr', 'Rnumerai'))"
|
13 |
|
14 |
# copy the app to the image
|
15 |
WORKDIR /shinyapp
|
|
|
9 |
|
10 |
# other R packages
|
11 |
RUN R -q -e "install.packages(c('DT', 'plotly', 'scico', 'ggthemes'))"
|
12 |
+
RUN R -q -e "install.packages(c('data.table', 'dtplyr', 'parallel', 'Rnumerai'))"
|
13 |
|
14 |
# copy the app to the image
|
15 |
WORKDIR /shinyapp
|
app/app.R
CHANGED
@@ -9,6 +9,7 @@ library(scico)
|
|
9 |
library(ggthemes)
|
10 |
library(data.table)
|
11 |
library(dtplyr)
|
|
|
12 |
library(Rnumerai)
|
13 |
|
14 |
|
@@ -53,7 +54,7 @@ reformat_data <- function(d_raw) {
|
|
53 |
"fncV3", "fncV3Percentile", "payout", "roundPayoutFactor",
|
54 |
"roundNumber", "roundResolved", "selectedStakeValue",
|
55 |
"tc", "tcPercentile")
|
56 |
-
d_munged <-
|
57 |
|
58 |
# Reformat percentile
|
59 |
d_munged[, corrPercentile := round(corrPercentile * 100, 6)]
|
@@ -316,7 +317,7 @@ ui <- shinydashboardPlus::dashboardPage(
|
|
316 |
markdown(
|
317 |
"
|
318 |
- #### **0.1.0** — First prototype with an interactive table output
|
319 |
-
- #### **0.1.1** — Added a functional `Payout Summary`
|
320 |
- #### **0.1.2** — `Payout Summary` layout updates
|
321 |
"),
|
322 |
br(),
|
@@ -378,9 +379,10 @@ server <- function(input, output) {
|
|
378 |
input$button_download,
|
379 |
{
|
380 |
|
381 |
-
#
|
382 |
-
d_raw <-
|
383 |
-
|
|
|
384 |
|
385 |
# Data munging
|
386 |
d_munged <- reformat_data(d_raw)
|
|
|
9 |
library(ggthemes)
|
10 |
library(data.table)
|
11 |
library(dtplyr)
|
12 |
+
library(parallel)
|
13 |
library(Rnumerai)
|
14 |
|
15 |
|
|
|
54 |
"fncV3", "fncV3Percentile", "payout", "roundPayoutFactor",
|
55 |
"roundNumber", "roundResolved", "selectedStakeValue",
|
56 |
"tc", "tcPercentile")
|
57 |
+
d_munged <- d_raw[, col_keep, with = FALSE]
|
58 |
|
59 |
# Reformat percentile
|
60 |
d_munged[, corrPercentile := round(corrPercentile * 100, 6)]
|
|
|
317 |
markdown(
|
318 |
"
|
319 |
- #### **0.1.0** — First prototype with an interactive table output
|
320 |
+
- #### **0.1.1** — Added a functional `Payout Summary` page
|
321 |
- #### **0.1.2** — `Payout Summary` layout updates
|
322 |
"),
|
323 |
br(),
|
|
|
379 |
input$button_download,
|
380 |
{
|
381 |
|
382 |
+
# Parallelised download
|
383 |
+
d_raw <- rbindlist(mclapply(X = input$model,
|
384 |
+
FUN = download_raw_data,
|
385 |
+
mc.cores = detectCores()))
|
386 |
|
387 |
# Data munging
|
388 |
d_munged <- reformat_data(d_raw)
|