module_configure_task: Module shiny to configure a task.

Description Usage Arguments Value See Also Examples

Description

Module shiny to configure a task.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
configure_task_server(
  input,
  output,
  session,
  btn,
  dir_path,
  fun_path,
  fun_name,
  conf_descr = NULL,
  fun_args = NULL,
  priority = 0L,
  compress = TRUE,
  labels = list(success = "Task configured !", error =
    "Error when configuring the task")
)

Arguments

input

shiny input

output

shiny input

session

shiny input

btn

reactive. Link to a actionButton for call configure_task function

dir_path

character. Tasks location (parent directory).

fun_path

character. Path to the script of the function.

fun_name

character. Name of the function in fun_path script.

conf_descr

named list (NULL). Optional description fields.

fun_args

named list (NULL). Args of the function, must all be named.

priority

numeric (0L). Number used to define which task should be launched first.

compress

logical or character (TRUE). Either a logical specifying whether or not to use "gzip" compression, or one of "gzip", "bzip2" or "xz" to indicate the type of compression to be used.

labels

list. Modal dialog title.

Value

Nothing.

See Also

tasks_overview_server

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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

}

shinybatch documentation built on June 30, 2021, 9:06 a.m.