Commit 0360b1ef authored by mmassaviol's avatar mmassaviol
Browse files

Add max_cores detection

parent c43bb5de
......@@ -495,6 +495,7 @@ generate_pages_server <- function() {
res <- res + '}\n'
file.replace(output_dir+"/server/opt_global.R")
# Event RULEGRAPH
if ("RULEGRAPH" %in% names(APP)){
res <- res + '#\' Event when use RULEGRAPH button\n'
......@@ -667,6 +668,9 @@ generate_menu <- function() {
file.replace(path_file)
res <- ""
res <- res + 'library(parallel)\n'
res <- res + 'max_cores = detectCores()\n\n'
res <- res + 'MenuGauche = sidebarMenu(id="sidebarmenu",\n\n'
......@@ -685,17 +689,14 @@ generate_menu <- function() {
}
if("download" %in% names(APP)){
res <- res + '\ttags$br(),\n\n'
res <- res + '\tdownloadButton("'+ APP$download$shiny_button$name +'", "'+ APP$download$shiny_button$label +'", class="'+ APP$download$shiny_button$class +'", style="color:black;margin: 6px 5px 6px 15px;"),\n\n'
res <- res + '\ttags$br(),\n\n'
}
res <- res + '\ttags$br(),\n\n'
res <- res + '\tnumericInput("cores", label = "Threads available", min = 1, max = 24, step = 1, width = "auto", value = 16),\n'
res <- res + '\tnumericInput("cores", label = "Threads available", min = 1, max = max_cores, step = 1, width = "auto", value = max_cores),\n'
# select where to run again from
choices = "list('No'='none'"
......@@ -1038,6 +1039,7 @@ generate_app <- function() {
res <- res + '\t\t}\n'
res <- res + '\t})\n'
# Stop pipeline (say snakemake to stop but it finishes current jobs)
res <- res + 'observeEvent(input$StopPipeline,{\n'
res <- res + '\t\tsystem("pkill -f snakemake")\n'
res <- res + '\t\tif (file.exists(paste0(input$results_dir,"/logs/workflow.running"))){\n'
......@@ -1045,10 +1047,7 @@ generate_app <- function() {
res <- res + '\t\t}\n'
res <- res + '\t})\n'
res <- res + 'observeEvent(input$close_session,{\n'
res <- res + '\t\tsession$close();\n'
res <- res + '\t})\n'
# Unlock snakemake dir when it crashed
res <- res + 'observeEvent(input$unlock,{\n'
res <- res + '\t\tsystem2("python3",paste0("-u -m snakemake -s /workflow/Snakefile --configfile ", paste0(input$results_dir,"/params.yml") ,\t" --forcerun all -d ", input$results_dir ,\t" --cores ", input$cores, " all --unlock"),wait = TRUE, stdout = paste0(input$results_dir,"/logs/runlog.txt"), stderr = paste0(input$results_dir,"/logs/runlog.txt"));\n'
res <- res + '\t\tif (file.exists(paste0(input$results_dir,"/logs/workflow.running"))){\n'
......@@ -1058,6 +1057,7 @@ generate_app <- function() {
res <- res + '\t\ttoggle_inputs(input_list,T,F)\n'
res <- res + '\t})\n'
# Download params
res <- res + 'output$DownloadParams <- downloadHandler(\n'
res <- res + '\tfilename = function() {\n'
res <- res + '\t\tpaste0("params", Sys.Date(), ".yaml", sep="")\n'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment