From ead19e983d77c63101101169e60e614a45f3caf5 Mon Sep 17 00:00:00 2001 From: Rob Ashton Date: Wed, 20 Mar 2024 14:08:02 +0000 Subject: [PATCH 1/5] Use workaround to avoid duckdb raising unnecessary warning --- R/outputs.R | 2 +- R/run-model.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/outputs.R b/R/outputs.R index ce55d871..3e2ebdec 100644 --- a/R/outputs.R +++ b/R/outputs.R @@ -1355,7 +1355,7 @@ read_hintr_output <- function(path) { } read_duckdb <- function(path) { - con <- DBI::dbConnect(duckdb::duckdb(), dbdir = path, read_only = TRUE) + con <- DBI::dbConnect(duckdb::duckdb(dbdir = path, read_only = TRUE)) on.exit(DBI::dbDisconnect(con, shutdown = TRUE)) DBI::dbGetQuery(con, sprintf("SELECT * from %s", DUCKDB_OUTPUT_TABLE_NAME)) } diff --git a/R/run-model.R b/R/run-model.R index f785f37b..7c3e66b2 100644 --- a/R/run-model.R +++ b/R/run-model.R @@ -149,7 +149,7 @@ hintr_save <- function(obj, file) { stop(paste("Trying to save invalid object as duckdb database.", "Only data frames can be saved as database.")) } - con <- DBI::dbConnect(duckdb::duckdb(), dbdir = file) + con <- DBI::dbConnect(duckdb::duckdb(dbdir = file)) DBI::dbWriteTable(con, DUCKDB_OUTPUT_TABLE_NAME, obj) DBI::dbDisconnect(con, shutdown = TRUE) } else { From f15a7e2f6f848b674c161f0fc9d9ac1b873dc747 Mon Sep 17 00:00:00 2001 From: Rob Ashton Date: Wed, 20 Mar 2024 14:08:02 +0000 Subject: [PATCH 2/5] Use workaround to avoid duckdb raising unnecessary warning --- R/outputs.R | 2 +- R/run-model.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/outputs.R b/R/outputs.R index ce55d871..3e2ebdec 100644 --- a/R/outputs.R +++ b/R/outputs.R @@ -1355,7 +1355,7 @@ read_hintr_output <- function(path) { } read_duckdb <- function(path) { - con <- DBI::dbConnect(duckdb::duckdb(), dbdir = path, read_only = TRUE) + con <- DBI::dbConnect(duckdb::duckdb(dbdir = path, read_only = TRUE)) on.exit(DBI::dbDisconnect(con, shutdown = TRUE)) DBI::dbGetQuery(con, sprintf("SELECT * from %s", DUCKDB_OUTPUT_TABLE_NAME)) } diff --git a/R/run-model.R b/R/run-model.R index f785f37b..9939156f 100644 --- a/R/run-model.R +++ b/R/run-model.R @@ -149,9 +149,9 @@ hintr_save <- function(obj, file) { stop(paste("Trying to save invalid object as duckdb database.", "Only data frames can be saved as database.")) } - con <- DBI::dbConnect(duckdb::duckdb(), dbdir = file) + con <- DBI::dbConnect(duckdb::duckdb(dbdir = file)) + on.exit(DBI::dbDisconnect(con, shutdown = TRUE)) DBI::dbWriteTable(con, DUCKDB_OUTPUT_TABLE_NAME, obj) - DBI::dbDisconnect(con, shutdown = TRUE) } else { stop(sprintf("Cannot save as type '%s', must be 'qs' or 'duckdb'.", type)) } From 1fc3274749530468479dc5377b9d9eeaa1691b8e Mon Sep 17 00:00:00 2001 From: Rob Ashton Date: Wed, 20 Mar 2024 14:13:16 +0000 Subject: [PATCH 3/5] Bump version number and add news item --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 529b963c..4ba6affb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: naomi Title: Naomi Model for Subnational HIV Estimates -Version: 2.9.24 +Version: 2.9.25 Authors@R: person(given = "Jeff", family = "Eaton", diff --git a/NEWS.md b/NEWS.md index 1bb41dcb..3b7d3f69 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# naomi 2.9.25 + +* Suppress warning raised from duckdb shutdown + # naomi 2.9.24 * Migrate to github actions From f31af8ada009afabe4b20efb7c1950ff2c328750 Mon Sep 17 00:00:00 2001 From: Rob Ashton Date: Wed, 20 Mar 2024 15:04:17 +0000 Subject: [PATCH 4/5] Remove unused package from docker install --- docker/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 99299213..13feb016 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,10 +10,8 @@ ENV NAOMI_GIT_BRANCH $GIT_BRANCH ENV NAOMI_VERSION $NAOMI_VERSION RUN install_packages --repo=https://mrc-ide.r-universe.dev \ - mockr \ rvest \ - pkgbuild \ - testthat.buildkite + pkgbuild ## Model run will try to parallelise over as many threads as are available ## potentially slowing the application, manually limit threads to 1 From 2405b14f78d220ca6f885600ae620d6aa7a4262a Mon Sep 17 00:00:00 2001 From: Rob Ashton Date: Wed, 20 Mar 2024 17:22:07 +0000 Subject: [PATCH 5/5] Update repo status badges --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a5610c7..19f6364c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ## Naomi -![R CMD check](https://github.com/mrc-ide/naomi/actions/workflows/R-CMD-check.yml/badge.svg) +[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) +[![R-CMD-check](https://github.com/mrc-ide/naomi/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mrc-ide/naomi/actions/workflows/R-CMD-check.yaml) [![Codecov test coverage](https://codecov.io/gh/mrc-ide/naomi/branch/master/graph/badge.svg)](https://codecov.io/gh/mrc-ide/naomi?branch=master) Naomi model for subnational HIV estimates