# NOT RUN {
# }
# NOT RUN {
if(interactive()){
require(shiny)
# create temporary directory for conf
dir_conf <- paste0(tempdir(), "/conf", round(runif(n = 1, max = 10000)))
dir.create(dir_conf, recursive = TRUE)
# ex fun
fun_path = system.file("ex_fun/sb_fun_ex.R", package = "shinybatch")
fun_name = "sb_fun_ex"
# create and save conf
ui <- shiny::fluidPage(
fluidRow(
column(offset = 3, 6,
shiny::actionButton("conf_task", "Configure the task", width = "100%")
)
)
)
server <- function(input, output, session) {
callModule(configure_task_server, "my_id_1",
btn = reactive(input$conf_task),
dir_path = dir_conf,
conf_descr = list(title = "my_title",
description = "my_descr"),
fun_path = fun_path,
fun_name = fun_name,
fun_args = list(x = 1,
y = 0:4,
z = iris),
priority = 1)
}
shiny::shinyApp(ui = ui, server = server)
# catch results
list.files(path <- list.dirs(dir_conf, full.names = TRUE, recursive = FALSE))
path
read_conf <- yaml::read_yaml(paste0(path[1], "/", "conf.yml"))
y <- readRDS(paste0(path[1], "/", "inputs/y.RDS"));y
z <- readRDS(paste0(path[1], "/", "inputs/z.RDS"));z
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab