Description Usage Arguments Value See Also Examples
Module to visualize all the created tasks.
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 | tasks_overview_server(
input,
output,
session,
dir_path,
allowed_run_info_cols = c("date_creation", "date_start", "date_end", "priority",
"status"),
allow_descr = TRUE,
allowed_function_cols = c("path", "name"),
allow_args = TRUE,
allowed_status = c("waiting", "running", "finished", "error"),
allow_log_btn = TRUE,
allow_rm_task = TRUE,
update_mode = c("reactive", "button"),
intervalMillis = 1000,
table_fun = function(x) x,
return_value = c("selected_task", "tasks_table"),
...
)
tasks_overview_UI(
id,
labels = list(btn = "Display/update the tasks", empty_global =
"Empty table of global features.", empty_individual =
"Empty table of individual features.", error_dir_access =
"Cannot access given directory.", logs = "Show logs", remove_task =
"Remove this task ?")
)
|
input |
shiny input |
output |
shiny input |
session |
shiny input |
dir_path |
|
allowed_run_info_cols |
|
allow_descr |
|
allowed_function_cols |
|
allow_args |
|
allowed_status |
|
allow_log_btn |
|
allow_rm_task |
|
update_mode |
|
intervalMillis |
|
table_fun |
|
return_value |
|
... |
. Additional args to be given to the table_fun function. |
id |
|
labels |
|
if return_value = "selected_task"
, the status of the selected line (one run) of the summary
table and the path to the directory in which its output is stored. if return_value = "tasks_table"
,
all tasks information table
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 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 2 confs
conf_1 <- configure_task(dir_path = dir_conf,
conf_descr = list(title = "my_title_1",
description = "my_descr_1"),
fun_path = fun_path,
fun_name = fun_name,,
fun_args = list(x = 1,
y = 0:4,
z = iris),
priority = 1)
conf_2 <- configure_task(dir_path = dir_conf,
conf_descr = list(title = "my_title_2",
description = "my_descr_2"),
fun_path = fun_path,
fun_name = fun_name,
fun_args = list(x = 1,
y = 0:4,
z = iris),
priority = 2)
run_task(paste0(conf_2$dir, "conf.yml"))
# with package ui
ui <- shiny::fluidPage(
tasks_overview_UI("my_id_1"),
hr(),
verbatimTextOutput("info")
)
server <- function(input, output, session) {
selected_task <- callModule(tasks_overview_server, "my_id_1",
dir_path = dir_conf,
allowed_status = c("waiting", "running", "finished", "error"),
allowed_run_info_cols = NULL,
allowed_function_cols = "",
allow_descr = TRUE,
allow_args = TRUE,
table_fun = function(x, y) x[, new_col := y],
y = "created using arg. 'table_fun'")
output$info <- renderPrint({
selected_task()
})
}
shiny::shinyApp(ui = ui, server = server)
# using custom ui
ui <- shiny::fluidPage(
verbatimTextOutput("info")
# and so define what you want !
)
server <- function(input, output, session) {
all_tasks_info <- callModule(tasks_overview_server, "my_id_1",
dir_path = dir_conf,
return_value = "tasks_table"
)
output$info <- renderPrint({
all_tasks_info()
})
}
shiny::shinyApp(ui = ui, server = server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.