-
Notifications
You must be signed in to change notification settings - Fork 3
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
Read/write in parallel #91
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
358f021
WIP: read/write in parallel
keller-mark fd4f462
Fix merge
keller-mark 7478064
Merge
keller-mark 4b3db37
importFrom for %dopar%; update docs
keller-mark b978a5c
Add simpler code path for non-parallel http requests
keller-mark ac03900
Use pbapply. Add vignette
keller-mark 269ee0d
More tests
keller-mark 5cf75ab
Fix vignette
keller-mark 0373d9b
Installation in vignette
keller-mark abed553
Pkgdown
keller-mark 6e21e06
Try a different value
keller-mark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,7 @@ Suggests: | |
rmarkdown, | ||
crul, | ||
Rarr, | ||
vcr (>= 0.6.0) | ||
vcr (>= 0.6.0), | ||
foreach, | ||
doParallel, | ||
bench |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#' @keywords internal | ||
.onLoad <- function(libname = NULL, pkgname = NULL) { | ||
init_options() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Adapted from https://github.com/IRkernel/IRkernel/blob/master/R/options.r | ||
|
||
#' pizzarr_option_defaults | ||
#' @export | ||
pizzarr_option_defaults <- list( | ||
pizzarr.http_store_cache_time_seconds = 3600, | ||
pizzarr.parallel_read_enabled = FALSE, | ||
pizzarr.parallel_write_enabled = FALSE | ||
) | ||
|
||
#' @keywords internal | ||
from_env <- list( | ||
PIZZARR_HTTP_STORE_CACHE_TIME_SECONDS = as.integer, | ||
PIZZARR_PARALLEL_READ_ENABLED = as.logical, | ||
PIZZARR_PARALLEL_WRITE_ENABLED = as.logical | ||
) | ||
|
||
# converts e.g. jupyter.log_level to JUPYTER_LOG_LEVEL | ||
#' @keywords internal | ||
opt_to_env <- function(nms) { | ||
gsub('.', '_', toupper(nms), fixed = TRUE) | ||
} | ||
|
||
# called in .onLoad | ||
#' @keywords internal | ||
init_options <- function() { | ||
for (opt_name in names(pizzarr_option_defaults)) { | ||
# skip option if it is already set, e.g. in the Rprofile | ||
if (is.null(getOption(opt_name))) { | ||
# prepare `options` call from the default | ||
call_arg <- pizzarr_option_defaults[opt_name] # single [] preserve names | ||
|
||
# if an env var is set, get value from it. | ||
env_name <- opt_to_env(opt_name) | ||
convert <- from_env[[env_name]] | ||
env_val <- Sys.getenv(env_name, unset = NA) | ||
if (!is.null(convert) && !is.na(env_val)) { | ||
call_arg[[opt_name]] <- convert(env_val) | ||
} | ||
|
||
do.call(options, call_arg) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there maybe an argument to switch to a more traditional http client here? Seems like there's a lot of complexity coming together.
Maybe another option is to have one simple pathway for metadata gets and another non-caching parallelized get utility for iterating over chunks?