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

Alternative fix to #42 #44

Merged
merged 2 commits into from
Sep 3, 2020
Merged
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
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Authors@R: c(
person("Floris", "Vanderhaeghe", role = c("ctb"), comment = c(ORCID = "0000-0002-6378-6229")))
Maintainer: Emmanuel Blondel <[email protected]>
Depends: R (>= 3.3.0), methods
Imports: R6, httr, jsonlite, xml2, keyring, tools, parallel
Suggests: testthat
Imports: R6, httr, jsonlite, xml2, keyring, tools
Suggests: testthat, parallel
Description: Provides an Interface to 'Zenodo' (<https://zenodo.org>) REST API,
including management of depositions, attribution of DOIs by 'Zenodo' and
upload of files.
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ import(keyring)
import(methods)
import(xml2)
importFrom(R6,R6Class)
importFrom(parallel,mclapply)
importFrom(tools,file_path_as_absolute)
importFrom(tools,md5sum)
7 changes: 6 additions & 1 deletion R/ZenodoRecord.R
Original file line number Diff line number Diff line change
Expand Up @@ -1196,10 +1196,15 @@ ZenodoRecord <- R6Class("ZenodoRecord",
}
if(!is.null(parallel_handler)){
if(!is.null(cl)){
if (!requireNamespace("parallel", quietly = TRUE)) {
errMsg <- "Package \"parallel\" needed for cluster-based parallel handler. Please install it."
self$ERROR(errMsg)
stop(errMsg)
}
if (!quiet) self$INFO("Using cluster-based parallel handler (cluster 'cl' argument specified)")
if (!quiet) self$INFO(files_summary)
invisible(parallel_handler(cl, self$files, download_file, ...))
try(stopCluster(cl))
try(parallel::stopCluster(cl))
}else{
if (!quiet) self$INFO("Using non cluster-based (no cluster 'cl' argument specified)")
if (!quiet) self$INFO(files_summary)
Expand Down
1 change: 0 additions & 1 deletion R/zen4R.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#' @import keyring
#' @importFrom tools file_path_as_absolute
#' @importFrom tools md5sum
#' @importFrom parallel mclapply
#'
#' @title Interface to 'Zenodo' REST API
#' @description Provides an Interface to 'Zenodo' (<https://zenodo.org>) REST API,
Expand Down
1 change: 1 addition & 0 deletions R/zen4R_downloader.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#' #simple download (sequential)
#' download_zenodo("10.5281/zenodo.2547036")
#'
#' library(parallel)
#' #download files as parallel using a cluster approach (for both Unix/Win systems)
#' download_zenodo("10.5281/zenodo.2547036",
#' parallel = TRUE, parallel_handler = parLapply, cl = makeCluster(2))
Expand Down
1 change: 1 addition & 0 deletions man/download_zenodo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.