Commit 879fac2b authored by mmassaviol's avatar mmassaviol
Browse files

Add log of rulegraph in the interface on error

parent 9b5be606
......@@ -608,6 +608,9 @@ generate_pages_server <- function() {
if ("RULEGRAPH" %in% names(APP)){
res <- res + '#\' Event when use RULEGRAPH button\n'
res <- res + 'observeEvent({c(input$sidebarmenu,input$refresh_rg)}, {\n\n'
res <- res + '\tif (!dir.exists(paste0(input$results_dir,"/logs"))){\n'
res <- res + '\t\tdir.create(paste0(input$results_dir,"/logs"))\n'
res <- res + '\t}\n'
res <- res + '\tif(input$sidebarmenu=="RULEGRAPH"){\n'
res <- res + '\t\tinput_list <- reactiveValuesToList(input)\n'
res <- res + '\t\ttoggle_inputs(input_list,F,F)\n'
......@@ -619,15 +622,15 @@ generate_pages_server <- function() {
res <- res + '\t\tsystem(paste0("rm ",input$results_dir,"/rulegraph*"))\n\n'
res <- res + '\t\toutUI = tryCatch({\n'
res <- res + '\t\t\tsystem(paste0("snakemake -s /workflow/Snakefile --configfile ",input$results_dir,"/params.yml -d ",input$results_dir," all --rulegraph 1> ",input$results_dir,"/rulegraph",i,".dot"),intern=T)\n'
res <- res + '\t\t\tsystem(paste0("snakemake -s /workflow/Snakefile --configfile ",input$results_dir,"/params.yml -d ",input$results_dir," all --rulegraph 1> ",input$results_dir,"/rulegraph",i,".dot 2> ",input$results_dir,"/logs/rulegraph.txt"),intern=T)\n'
res <- res + '\t\t\tsystem(paste0("cat ",input$results_dir,"/rulegraph",i,".dot | dot -Tsvg -Gratio=0.75 > ",input$results_dir,"/rulegraph",i,".svg"),intern=T)\n'
res <- res + '\t\t\ttagList(img(src = paste0("results/rulegraph",i,".svg") ,alt = "Rulegraph of Snakemake jobs",style="max-width: 100%;height: auto;display: block;margin: auto"))},\n'
res <- res + '\t\terror = function(e){\n'
res <- res + '\t\t\tsystem(paste0("touch ",input$results_dir,"/logs/workflow_end.error"),wait = T)\n'
res <- res + '\t\t\treturn(tags$p(paste0("error : ",e$message)))},\n'
res <- res + '\t\t\treturn(tags$p(HTML(paste(readLines(paste0(input$results_dir,"/logs/rulegraph.txt"),warn=F), collapse = "<br/>"))))},\n'
res <- res + '\t\twarning = function(w){\n'
res <- res + '\t\t\tsystem(paste0("touch ",input$results_dir,"/logs/workflow_end.error"),wait = T)\n'
res <- res + '\t\t\treturn(tags$p(paste0("error : ",w$message)))})\n'
res <- res + '\t\t\treturn(tags$p(HTML(paste(readLines(paste0(input$results_dir,"/logs/rulegraph.txt"),warn=F), collapse = "<br/>"))))})\n'
res <- res + '\t\taddResourcePath("results", input$results_dir)\n'
res <- res + '\t\toutput$RULEGRAPH_svg = renderUI(outUI)\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