parallel again

This commit is contained in:
Patrick Schratz 2024-07-24 18:59:24 +02:00
commit 63d2183a89
Signed by: pat-s
GPG key ID: 3C6318841EF78925
3 changed files with 7 additions and 9 deletions

View file

@ -23,8 +23,8 @@ steps:
commands:
# download latest package version (avoid having to rebuild image every time)
- git clone https://pat-s:$$git_ro_token@git.devxy.io/devxy/arm64-r-binaries.git && cd arm64-r-binaries
- R -q -e 'install.packages(".", repos = NULL, quiet = TRUE)'
- R -q -e 'options(crayon.enabled = TRUE, Ncpus = 2); pkgs = tools::CRAN_package_db()[[1]][1:2]; library(rBinaries); future::plan("sequential", workers = 2); lapply(pkgs, function(x) build_binary_package(x, build_for_minor=FALSE, debug = FALSE, force = TRUE))'
- R -q -e 'install.packages(".", repos = NULL, quiet = TRUE); packageVersion("rBinaries")'
- R -q -e 'options(crayon.enabled = TRUE, Ncpus = 2); pkgs = tools::CRAN_package_db()[[1]][1:2]; library(rBinaries); future::plan("multicore", workers = 2); lapply(pkgs, function(x) build_binary_package(x, build_for_minor=FALSE, debug = FALSE, force = TRUE))'
backend_options:
kubernetes:
resources:

View file

@ -89,7 +89,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
{
p()
store_build_metadata(x, y, platform, FALSE)
build_single_tag(x, y, dir_out_bin, local_clone_dir, platform = platform)
dump <- build_single_tag(x, y, dir_out_bin, local_clone_dir, platform = platform)
},
error = function(e) {
message(sprintf("Error in processing package %s with tag %s: %s", x, y, e))
@ -101,8 +101,6 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
}, package_name, tag, future.seed = TRUE)
})
# round(Sys.time() - t1, 2)}} {units(difftime(Sys.time(), t1))}
total_build_time <- round(Sys.time() - t1, 2)
cli::cli_alert_info("Execution time for {.pkg {package_name[[1]]}} ({length(tag)} tags): {.strong {total_build_time} {units(difftime(Sys.time(), t1))}}.")
@ -113,7 +111,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
tryCatch(
{
p()
upload_single_binary_to_s3(package_name = x, tag = y, force = force, build_for_minor = build_for_minor, debug = debug)
dump <- upload_single_binary_to_s3(package_name = x, tag = y, force = force, build_for_minor = build_for_minor, debug = debug)
},
error = function(e) {
message(sprintf("Error in uploading package %s with tag %s: %s", x, y, e))

View file

@ -34,19 +34,19 @@ upload_single_binary_to_s3 <- function(
exists <- s3fs::s3_file_exists(sprintf("%s/%s", remote_bin_path, tarball_name))
if ((!exists && !force) || (!exists && force)) {
cli::cli_alert_info("{.fun build_single_tag}: 5. Uploading {.pkg {package_name}} {.field {tag}} to S3.")
cli::cli_alert_info("{.fun upload_single_binary_to_s3}: 5. Uploading {.pkg {package_name}} {.field {tag}} to S3.")
s3fs::s3_file_upload(
sprintf("%s/%s", local_bin_path, tarball_name),
sprintf("%s/%s", remote_bin_path, tarball_name)
)
} else if (exists && force) {
cli::cli_alert_info("{.fun upload_to_s3}: Force uploading package {.pkg {package_name}} {.path {tag}} because force = TRUE was set.")
cli::cli_alert_info("{.fun upload_single_binary_to_s3}: Force uploading package {.pkg {package_name}} {.path {tag}} because force = TRUE was set.")
s3fs::s3_file_upload(
sprintf("%s", local_bin_path, tarball_name),
sprintf("%s", remote_bin_path, tarball_name),
overwrite = TRUE
)
} else if (exists && !force) {
cli::cli_alert_info("{.fun upload_to_s3}: Package {.pkg {package_name}} {.path {tag}} already exists in S3. Skipping upload.")
cli::cli_alert_info("{.fun upload_single_binary_to_s3}: Package {.pkg {package_name}} {.path {tag}} already exists in S3. Skipping upload.")
}
}