Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Apache Feather for API object transfer instead of RDS #328

Open
wants to merge 15 commits into
base: v2.3.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: etn
Title: Access Data from the European Tracking Network
Version: 2.3.0
Version: 2.3.1.9000
Authors@R: c(
person("Peter", "Desmet", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-8442-8025")),
Expand All @@ -19,8 +19,9 @@ License: MIT + file LICENSE
URL: https://github.com/inbo/etn, https://inbo.github.io/etn
BugReports: https://github.com/inbo/etn/issues
Depends:
R (>= 3.4.0)
R (>= 4.0)
Imports:
arrow,
askpass,
assertthat,
DBI,
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# etn (development version)
* API functions now use the `arrow` package to transfer data.frames, which should allow for greater amounts of detections to be transferred without crashing (#323, #327). This will also reduce memory usage for large objects, an should generally result in a speedup.
* etn now requires an R version of at least 4, this is a consequence of the usage of the `arrow` package.

# etn 2.3.0

* **The etn package can now be used on your computer!** It connects to the ETN database with an API provided by the [etnservice](https://github.com/inbo/etnservice) package. All functions make use of this API by default, which may result in **slower response times**. To use the previous method of directly connecting to the database (only possible when working on the [LifeWatch RStudio Server](https://rstudio.lifewatch.be/)), set `api = false` in all functions (#280).
Expand Down
14 changes: 6 additions & 8 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,17 @@ get_val <- function(temp_key, api_domain = "https://opencpu.lifewatch.be") {
verb = "GET",
url = glue::glue(
"{api_domain}",
"tmp/{temp_key}/R/.val/rds",
# I'm passing an argument to arrow::write_feather() via OpenCPU, this
# feature is currenlty only documented in the NEWS file. Not in the
# official documentation of OPENCPU
'tmp/{temp_key}/R/.val/feather?compression="lz4"',
.sep = "/"
),
times = 5
) %>%
httr::content(as = "raw") %>%
rawConnection()
httr::content(as = "raw")
# read connection
api_response <- response_connection %>%
gzcon() %>%
readRDS()
# close connection
close(response_connection)
api_response <- arrow::read_feather(response_connection)
# Return OpenCPU return object
return(api_response)
}
Expand Down