always inject error as character into DB
This commit is contained in:
parent
464a473a6b
commit
af04f7938e
1 changed files with 17 additions and 7 deletions
|
|
@ -88,26 +88,29 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
|||
tryCatch(
|
||||
{
|
||||
p()
|
||||
store_build_metadata(x, y, platform, error_occurred = FALSE, force = force)
|
||||
dump <- build_single_tag(x, y, dir_out_bin, local_clone_dir, platform = platform, debug = debug)
|
||||
store_build_metadata(x, y, platform, error_occurred = FALSE, force = force)
|
||||
|
||||
con <- DBI::dbConnect(RPostgres::Postgres(),
|
||||
dbname = "build_metadata", host = "postgres-arm-binaries-r.devxy.io",
|
||||
port = 15432, user = "arm_binaries", password = Sys.getenv("PGPASS")
|
||||
)
|
||||
# here we check if build_duration is empty and take this as an indicator that the build failed. I.e. we set error_occurred = TRUE
|
||||
val <- dbGetQuery(con, sprintf("SELECT build_duration FROM single_builds WHERE package_name = '%s' and tag = '%s'", x, y))
|
||||
if (is.na(val)) {
|
||||
dbExecute(con, sprintf("UPDATE single_builds SET error_occurred = TRUE WHERE package_name = '%s' and tag = '%s'", x, y))
|
||||
}
|
||||
# val <- dbGetQuery(con, sprintf("SELECT build_duration FROM single_builds WHERE package_name = '%s' and tag = '%s'", x, y))
|
||||
# if (is.na(val)) {
|
||||
# dbExecute(con, sprintf("UPDATE single_builds SET error_occurred = TRUE WHERE package_name = '%s' and tag = '%s'", x, y))
|
||||
# }
|
||||
dbDisconnect(con)
|
||||
},
|
||||
error = function(e) {
|
||||
message(sprintf("Error in processing package %s with tag %s: %s", x, y, e))
|
||||
# print(e)
|
||||
# str(e)
|
||||
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, x, y)
|
||||
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
||||
# NB: this does not always work, which is why we are using the lack of build_duration as a secondary factor in store_metadata()
|
||||
store_build_metadata(x, y, platform, error_occurred = TRUE, force = TRUE, error = e)
|
||||
# error <- paste("Call:", deparse(conditionCall(e)), "\nMessage:", conditionMessage(e), sep = " ")
|
||||
store_build_metadata(x, y, platform, error_occurred = TRUE, force = TRUE, error = e$stderr)
|
||||
}
|
||||
)
|
||||
}, package_name, tag, future.seed = TRUE)
|
||||
|
|
|
|||
Loading…
Reference in a new issue