tryCatch error in pkgbuild::build
This commit is contained in:
parent
830390dc31
commit
b4ff36dfa8
2 changed files with 30 additions and 12 deletions
|
|
@ -49,13 +49,20 @@ steps:
|
||||||
- R -q -e 'options(crayon.enabled = TRUE, Ncpus = 6, future.globals.onReference = "error", repos = structure(c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"))); pkgs = tools::CRAN_package_db()[[1]][${BLOCK}]; library(rBinaries); future::plan("multisession", workers = 6, rscript_startup = quote(options(crayon.enabled = TRUE))); foo = lapply(pkgs, function(x) build_binary_package(x, build_for_minor=FALSE, debug = TRUE, force = TRUE))'
|
- R -q -e 'options(crayon.enabled = TRUE, Ncpus = 6, future.globals.onReference = "error", repos = structure(c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"))); pkgs = tools::CRAN_package_db()[[1]][${BLOCK}]; library(rBinaries); future::plan("multisession", workers = 6, rscript_startup = quote(options(crayon.enabled = TRUE))); foo = lapply(pkgs, function(x) build_binary_package(x, build_for_minor=FALSE, debug = TRUE, force = TRUE))'
|
||||||
backend_options:
|
backend_options:
|
||||||
kubernetes:
|
kubernetes:
|
||||||
|
# resources:
|
||||||
|
# requests:
|
||||||
|
# memory: 25Gi
|
||||||
|
# cpu: 12000m
|
||||||
|
# limits:
|
||||||
|
# memory: 28Gi
|
||||||
|
# cpu: 16000m
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
memory: 25Gi
|
memory: 4Gi
|
||||||
cpu: 12000m
|
cpu: 2000m
|
||||||
limits:
|
limits:
|
||||||
memory: 28Gi
|
memory: 4Gi
|
||||||
cpu: 16000m
|
cpu: 2000m
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/arch: 'arm64'
|
kubernetes.io/arch: 'arm64'
|
||||||
- name: Upload PACKAGES files
|
- name: Upload PACKAGES files
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
||||||
},
|
},
|
||||||
# NB: here we need to use conditionMessage() to extract the actual error - as opposed to using $stderr for errors within the tryCatch used in the future* calls
|
# NB: here we need to use conditionMessage() to extract the actual error - as opposed to using $stderr for errors within the tryCatch used in the future* calls
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
message(sprintf("Error in installing dependencies for package %s with tag %s: %s", package_name[1], tag[1], e))
|
cli::cli_alert_warning("Error in installing dependencies for package {.pkg {package_name{1]}} with tag {.field {tag[1]}}: {e}")
|
||||||
store_build_metadata(package_name[1], tag[1], platform, error_occurred = TRUE, force = TRUE, error = conditionMessage(e))
|
store_build_metadata(package_name[1], tag[1], platform, error_occurred = TRUE, force = TRUE, error = conditionMessage(e))
|
||||||
return(TRUE)
|
return(TRUE)
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +101,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
||||||
dbDisconnect(con)
|
dbDisconnect(con)
|
||||||
},
|
},
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
message(sprintf("Error in processing package %s with tag %s: %s", x, y, e))
|
cli::cli_alert_warning("Error in starting build command for package {.pkg {package_name}} with tag {.field {tag}}: {e}")
|
||||||
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, x, y)
|
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, x, y)
|
||||||
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
||||||
# only stderr contains the important information why the build failed
|
# only stderr contains the important information why the build failed
|
||||||
|
|
@ -159,15 +159,26 @@ build_single_tag <- function(
|
||||||
cli::cli_alert("{.fun build_single_tag}: (2/3) Building package {.pkg {package_name}} with tag {.field {tag}}.")
|
cli::cli_alert("{.fun build_single_tag}: (2/3) Building package {.pkg {package_name}} with tag {.field {tag}}.")
|
||||||
|
|
||||||
t1 <- Sys.time()
|
t1 <- Sys.time()
|
||||||
dump <- pkgbuild::build(
|
tryCatch(
|
||||||
path = sprintf("%s", local_clone_dir_single),
|
{
|
||||||
binary = TRUE, vignettes = FALSE,
|
dump <- pkgbuild::build(
|
||||||
dest_path = dir_out_bin, quiet = TRUE
|
path = sprintf("%s", local_clone_dir_single),
|
||||||
|
binary = TRUE, vignettes = FALSE,
|
||||||
|
dest_path = dir_out_bin, quiet = TRUE
|
||||||
|
)
|
||||||
|
},
|
||||||
|
error = function(e) {
|
||||||
|
cli::cli_alert_warning("Error in starting build command for package {.pkg {package_name}} with tag {.field {tag}}: {e}")
|
||||||
|
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, package_name, tag)
|
||||||
|
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
||||||
|
store_build_metadata(package_name, tag, platform, error_occurred = TRUE, force = TRUE, error = "Error trying to initiate pkgbuild - likely a non-valid R package structure")
|
||||||
|
return(invisible(TRUE))
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!file.exists(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) {
|
if (!file.exists(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
cli::cli_alert_info('{.fun build_single_tag}: Moving package from {.path {sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag))}} to {.path {sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)}}')
|
cli::cli_alert_info('{.fun build_single_tag}: Moving package from {.path {sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag)}} to {.path {sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)}}')
|
||||||
}
|
}
|
||||||
# double-check that file exists (some packages like https://github.com/cran/BACCO/tree/1.0-14 don't include R/ and hence don't procude a valid binary)
|
# double-check that file exists (some packages like https://github.com/cran/BACCO/tree/1.0-14 don't include R/ and hence don't procude a valid binary)
|
||||||
if (fs::file_exists(sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag))) {
|
if (fs::file_exists(sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag))) {
|
||||||
|
|
@ -177,7 +188,7 @@ build_single_tag <- function(
|
||||||
sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)
|
sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
cli::cli_alert_info('{.fun build_single_tag}: File for package {.pkg {package_name}} {.field {tag}} at {.path {sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag))}} does not exist - skipping.')
|
cli::cli_alert_info('{.fun build_single_tag}: File for package {.pkg {package_name}} {.field {tag}} at {.path {sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag)}} does not exist - skipping.')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cli::cli_alert_warning('{.fun build_single_tag}: Binary {sprintf("%s_%s.tar.gz", package_name, tag)} already exists. Skipping copy.')
|
cli::cli_alert_warning('{.fun build_single_tag}: Binary {sprintf("%s_%s.tar.gz", package_name, tag)} already exists. Skipping copy.')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue