Skip to content

Commit

Permalink
Fix(param): Continue to parse err file for jobs having non-zero exits.
Browse files Browse the repository at this point in the history
…Close #24
  • Loading branch information
hongyuanjia committed Dec 12, 2018
1 parent 215693a commit 0707d67
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions R/param.R
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ i_param_retrieve_data <- function (self, private) {
# }}}

# i_param_job_from_which {{{
i_param_job_from_which <- function (self, private, which) {
i_param_job_from_which <- function (self, private, which, keep_unsucess = FALSE) {
status <- i_param_status(self, private)

if (!isTRUE(status$run_before))
Expand Down Expand Up @@ -442,7 +442,9 @@ i_param_job_from_which <- function (self, private, which) {
)
}

if (not_empty(job[exit_status != 0L])) {
# setting `keep_unsucess` to FALSE makes it possible to continue to parse
# some output files such like .err files. (#24)
if (isTRUE(!keep_unsucess) && not_empty(job[exit_status != 0L])) {
unsuccessful <- job[exit_status != 0L]
msg <- unsuccessful[, sim_status("UNSUCCESSFUL", index, idf, epw)]
stop("Some of jobs completed unsuccessfully:\n", paste0(msg, collpase = "\n"),
Expand Down Expand Up @@ -621,7 +623,7 @@ i_param_output_dir <- function (self, private, which) {
# }}}

# i_param_locate_output {{{
i_param_locate_output <- function (self, private, which, suffix = ".err", strict = TRUE) {
i_param_locate_output <- function (self, private, which, suffix = ".err", strict = TRUE, keep_unsucess = FALSE) {
job <- i_param_job_from_which(self, private, which)

out <- paste0(tools::file_path_sans_ext(job$idf), suffix)
Expand All @@ -641,7 +643,8 @@ i_param_output_errors <- function (self, private, which, info = FALSE) {

err <- lapply(path_err, parse_err_file)

names(err) <- i_param_case_from_which(self, private, which, name = TRUE)
# continue to parse err file for jobs having non-zero exits (#24)
names(err) <- i_param_case_from_which(self, private, which, name = TRUE, keep_unsucess = TRUE)

if (!info) {
err <- lapply(err, function (x) {
Expand Down

0 comments on commit 0707d67

Please sign in to comment.