Skip to content
Snippets Groups Projects
Commit b10618e1 authored by Christoph Schürz's avatar Christoph Schürz
Browse files

Fix error case for model run

parent af568466
No related branches found
No related tags found
No related merge requests found
Package: SWATdoctR Package: SWATdoctR
Type: Package Type: Package
Title: Finding the right diagnoses and treatments for SWAT+ models Title: Finding the right diagnoses and treatments for SWAT+ models
Version: 0.1.5 Version: 0.1.6
Author: c(person("Svajunas", "Plunge", Author: c(person("Svajunas", "Plunge",
email = "svajunas_plunge@sggw.edu.pl", email = "svajunas_plunge@sggw.edu.pl",
role = c("aut")), role = c("aut")),
......
...@@ -61,11 +61,11 @@ run_swat_verification <- function(project_path, outputs = c('wb', 'mgt', 'plt'), ...@@ -61,11 +61,11 @@ run_swat_verification <- function(project_path, outputs = c('wb', 'mgt', 'plt'),
msg <- run(run_os(swat_exe, os), wd = run_path, msg <- run(run_os(swat_exe, os), wd = run_path,
error_on_status = FALSE) error_on_status = FALSE)
if(msg$timeout) { if(nchar(msg$stderr) > 0) {
out_msg <- str_split(msg$stdout, '\r\n|\r|\n', simplify = TRUE) %>% out_msg <- str_split(msg$stdout, '\r\n|\r|\n', simplify = TRUE) %>%
.[max(1, length(.) - 10):length(.)] .[max(1, length(.) - 10):length(.)]
err_msg <- c(paste0('Simulation timed out after ', time_out, ' sec'), err_msg <- str_split(msg$stderr, '\r\n|\r|\n', simplify = TRUE)
'Simulation run:', out_msg) err_msg <- c('Last output:', out_msg, 'Error:', err_msg)
model_output <- err_msg model_output <- err_msg
} else if(nchar(msg$stderr) == 0) { } else if(nchar(msg$stderr) == 0) {
model_output <- list() model_output <- list()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment