From 63d2183a89cd5c499dd261300d5352bde3b01cd9 Mon Sep 17 00:00:00 2001 From: pat-s Date: Wed, 24 Jul 2024 18:59:24 +0200 Subject: [PATCH] parallel again --- .woodpecker/build.yaml | 4 ++-- R/build_binaries.R | 6 ++---- R/upload.R | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml index c510919..2276b22 100644 --- a/.woodpecker/build.yaml +++ b/.woodpecker/build.yaml @@ -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: diff --git a/R/build_binaries.R b/R/build_binaries.R index 9cb90fc..1e6ec11 100644 --- a/R/build_binaries.R +++ b/R/build_binaries.R @@ -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)) diff --git a/R/upload.R b/R/upload.R index 86859cd..d7928d7 100644 --- a/R/upload.R +++ b/R/upload.R @@ -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.") } }