From f18fd01229e43ae392af65401577b9d60be40547 Mon Sep 17 00:00:00 2001 From: phlebailly6 <137523387+phlebailly6@users.noreply.github.com> Date: Sat, 31 Jan 2026 10:15:19 -0300 Subject: [PATCH 1/4] Fix space needed warning --- .github/workflows/check-load-prodes.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/check-load-prodes.yaml b/.github/workflows/check-load-prodes.yaml index 7f918557..aad6655c 100644 --- a/.github/workflows/check-load-prodes.yaml +++ b/.github/workflows/check-load-prodes.yaml @@ -17,6 +17,13 @@ jobs: with: r-version: 'release' use-public-rspm: true + + - name: Free disk space + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc + sudo apt-get clean + df -h + - name: System dependencies (sf/units) run: | From 4cb82e323555e8b34499f38902a6b84cb9aa35b7 Mon Sep 17 00:00:00 2001 From: phlebailly6 <137523387+phlebailly6@users.noreply.github.com> Date: Sat, 31 Jan 2026 10:38:03 -0300 Subject: [PATCH 2/4] Fix missing dataframe info This update makes the workflow return the dataframe characteristics even if the result is a "WARNING" --- actions/scripts/check_all_loads.R | 61 ++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/actions/scripts/check_all_loads.R b/actions/scripts/check_all_loads.R index a1d90034..5695ac0a 100644 --- a/actions/scripts/check_all_loads.R +++ b/actions/scripts/check_all_loads.R @@ -11,6 +11,12 @@ if (!requireNamespace("datazoom.amazonia", quietly = TRUE)) { } library(datazoom.amazonia) +# Avoid iterative authentication in CI (googledrive) +if (requireNamespace("googledrive", quietly = TRUE)) { + options(gargle_oauth_cache = FALSE) + googledrive::drive_deauth() +} + # Config TIME_PERIOD <- 2020 LANGUAGE <- "pt" @@ -195,49 +201,60 @@ for (fn_name in get_fns) { if ("language" %in% arg_names) args$language <- LANGUAGE out <- NULL + warn_msgs <- character(0) res <- tryCatch( - { - out <- call_with_geo(fn, args, geo_level = GEO_LEVEL) - - if (!is.null(out) && (is.data.frame(out) || inherits(out, "tbl_df"))) { + withCallingHandlers( + { + out <- call_with_geo(fn, args, geo_level = GEO_LEVEL) "OK" - } else { - "WEIRD" + }, + warning = function(w) { + warn_msgs <<- c(warn_msgs, conditionMessage(w)) + invokeRestart("muffleWarning") } - }, - warning = function(w) paste("WARN:", conditionMessage(w)), - error = function(e) paste("ERROR:", conditionMessage(e)) + ), + error = function(e) paste("ERROR:", conditionMessage(e)) ) - status <- if (identical(res, "OK")) { - "OK" - } else if (identical(res, "WEIRD")) { - "WEIRD" - } else if (startsWith(res, "WARN:")) { + # decide status + status <- if (startsWith(res, "ERROR:")) { + "FAIL" + } else if (length(warn_msgs) > 0) { "WARN" } else { - "FAIL" + "OK" } - # dimensões (só faz sentido se out for data.frame/tibble) + # dims n_rows <- NA_integer_ n_cols <- NA_integer_ if (!is.null(out) && (is.data.frame(out) || inherits(out, "tbl_df"))) { n_rows <- nrow(out) n_cols <- ncol(out) + } else if (status != "FAIL") { + status <- "WEIRD" } - # se rodou "OK" (ou até "WARN") mas retornou vazio, marque como EMPTY - # (ajuste a regra se quiser: ex. considerar vazio só quando n_rows == 0) + # empty if (status %in% c("OK", "WARN") && !is.na(n_rows) && n_rows == 0) { status <- "EMPTY" - if (!startsWith(res, "WARN:")) { - res <- "EMPTY: data.frame retornado com 0 linhas" - } } - msg <- if (status %in% c("WARN", "FAIL", "WEIRD", "EMPTY")) res else "" + # mensagem + msg <- "" + if (status == "FAIL") { + msg <- res + } else if (status %in% c("WARN","WEIRD","EMPTY")) { + msg <- paste(c(warn_msgs, if (status=="EMPTY") "EMPTY: data.frame retornado com 0 linhas" else NULL), collapse = " | ") + } + + # opcional: classificar falta de disco como FAIL (mesmo vindo como warning) + if (grepl("Estimated disk space needed", msg, fixed = TRUE)) { + status <- "FAIL" + msg <- paste("DISK:", msg) + } + results <- rbind(results, data.frame( function_name = fn_name, From eb54845554563ea021e560e2e2ddcacb555252fe Mon Sep 17 00:00:00 2001 From: phlebailly6 <137523387+phlebailly6@users.noreply.github.com> Date: Sat, 31 Jan 2026 10:38:27 -0300 Subject: [PATCH 3/4] Update check_all_loads.R --- actions/scripts/check_all_loads.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/actions/scripts/check_all_loads.R b/actions/scripts/check_all_loads.R index 5695ac0a..14e91e10 100644 --- a/actions/scripts/check_all_loads.R +++ b/actions/scripts/check_all_loads.R @@ -249,11 +249,11 @@ for (fn_name in get_fns) { msg <- paste(c(warn_msgs, if (status=="EMPTY") "EMPTY: data.frame retornado com 0 linhas" else NULL), collapse = " | ") } - # opcional: classificar falta de disco como FAIL (mesmo vindo como warning) - if (grepl("Estimated disk space needed", msg, fixed = TRUE)) { - status <- "FAIL" - msg <- paste("DISK:", msg) - } + # Classificar falta de disco como FAIL (mesmo vindo como warning) + # if (grepl("Estimated disk space needed", msg, fixed = TRUE)) { + # status <- "FAIL" + # msg <- paste("DISK:", msg) + # } results <- rbind(results, data.frame( From 33d2fa893982c2c1a5f506e5d9adce96176e0e5a Mon Sep 17 00:00:00 2001 From: phlebailly6 <137523387+phlebailly6@users.noreply.github.com> Date: Sun, 5 Apr 2026 14:22:04 -0300 Subject: [PATCH 4/4] Fix load_ips and error masking Fix TIME_PERIOD argument error in load_ips The TIME_PERIOD argument in load_ips should be one of 2014, 2018, 2021, or 2023, but it was incorrectly set to 2020. This commit updates the call to use 2023. Also fix an issue in the call_with_geo helper that masked errors in some functions (e.g., load_pevs). Previously, call_with_geo() overwrote underlying errors with a GEO_LEVEL error, which was misleading and not the actual cause. --- actions/scripts/check_all_loads.R | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/actions/scripts/check_all_loads.R b/actions/scripts/check_all_loads.R index 14e91e10..909f2829 100644 --- a/actions/scripts/check_all_loads.R +++ b/actions/scripts/check_all_loads.R @@ -23,6 +23,10 @@ LANGUAGE <- "pt" RAW_DATA <- FALSE GEO_LEVEL <- "state" +time_period_by_fn <- list( + load_ips = 2023 +) + datasets_by_fn <- list( @@ -133,18 +137,9 @@ call_with_geo <- function(fn, args, geo_level = "state") { } # tenta com geo_level = "state" - res <- tryCatch( - do.call(fn, c(args, list(geo_level = geo_level))), - error = function(e) e - ) - - # se funcionou, retorna - if (!inherits(res, "error")) { - return(res) - } + res <- do.call(fn, c(args, list(geo_level = geo_level))) - # fallback: tenta sem geo_level - do.call(fn, args) + return(res) } @@ -196,7 +191,11 @@ for (fn_name in get_fns) { args <- list() if ("dataset" %in% arg_names) args$dataset <- ds - if ("time_period" %in% arg_names) args$time_period <- TIME_PERIOD + if ("time_period" %in% arg_names) { + args$time_period <- if (!is.null(time_period_by_fn[[fn_name]])) { + time_period_by_fn[[fn_name]] + } else {TIME_PERIOD} + } if ("raw_data" %in% arg_names) args$raw_data <- RAW_DATA if ("language" %in% arg_names) args$language <- LANGUAGE