Skip to content

Commit

Permalink
Merge pull request #44 from florisvdh/suggests
Browse files Browse the repository at this point in the history
Alternative fix to #42
  • Loading branch information
eblondel authored Sep 3, 2020
2 parents 40e5ed0 + d9a72d6 commit c80d800
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
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.

0 comments on commit c80d800

Please sign in to comment.