Skip to content

Commit

Permalink
Move vis and hpc packages to "Suggests:"
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Jul 16, 2018
1 parent f2efdf4 commit a999522
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 76 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Expand Up @@ -65,13 +65,10 @@ Imports:
digest,
dplyr,
formatR,
future,
future.apply,
fs,
grDevices,
igraph,
knitr,
lubridate,
magrittr,
parallel,
pkgconfig,
Expand All @@ -86,20 +83,23 @@ Imports:
testthat,
tibble,
tidyselect (>= 0.2.4),
txtq,
utils,
withr
Suggests:
abind,
callr,
clustermq,
DBI,
future,
future.apply,
ggplot2,
ggraph,
lubridate,
MASS,
methods,
networkD3,
RSQLite,
txtq,
rmarkdown,
visNetwork
VignetteBuilder: knitr
Expand Down
8 changes: 0 additions & 8 deletions NAMESPACE
Expand Up @@ -183,11 +183,6 @@ importFrom(evaluate,try_capture_stack)
importFrom(formatR,tidy_source)
importFrom(fs,dir_create)
importFrom(fs,file_create)
importFrom(future,future)
importFrom(future,plan)
importFrom(future,resolved)
importFrom(future,value)
importFrom(future.apply,future_lapply)
importFrom(grDevices,col2rgb)
importFrom(grDevices,rgb)
importFrom(igraph,V)
Expand All @@ -210,8 +205,6 @@ importFrom(igraph,topo_sort)
importFrom(igraph,vertex)
importFrom(igraph,vertex_attr)
importFrom(knitr,knit)
importFrom(lubridate,dseconds)
importFrom(lubridate,duration)
importFrom(magrittr,"%>%")
importFrom(parallel,clusterCall)
importFrom(parallel,clusterExport)
Expand Down Expand Up @@ -253,7 +246,6 @@ importFrom(tidyselect,num_range)
importFrom(tidyselect,one_of)
importFrom(tidyselect,starts_with)
importFrom(tidyselect,vars_select)
importFrom(txtq,txtq)
importFrom(utils,capture.output)
importFrom(utils,compareVersion)
importFrom(utils,head)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Expand Up @@ -19,6 +19,7 @@
- Add a `garbage_collection` argument to `make()`. If `TRUE`, `gc()` is called after every new build of a target.
- Remove redundant calls to `sanitize_plan()` in `make()`.
- Change `tracked()` to accept only a `drake_config()` object as an argument. Yes, it is technically a breaking change, but it is only a small break, and it is the correct API choice.
- Move visualization and hpc package dependencies to "Suggests:" rather than "Imports:" in the `DESCRIPTION` file.

# Version 5.2.1

Expand Down
3 changes: 2 additions & 1 deletion R/build_times.R
Expand Up @@ -128,9 +128,10 @@ to_build_duration_df <- function(times){
# we need to round to the nearest second
# for times longer than a minute.
to_build_duration <- function(x){
assert_pkgs("lubridate")
round_these <- x >= 60
x[round_these] <- round(x[round_these], digits = 0)
dseconds(x)
lubridate::dseconds(x)
}

time_columns <- c("elapsed", "user", "system")
Expand Down
1 change: 1 addition & 0 deletions R/future.R
@@ -1,4 +1,5 @@
run_future <- function(config){
assert_pkgs("future")
queue <- new_priority_queue(config = config)
workers <- initialize_workers(config)
# While any targets are queued or running...
Expand Down
1 change: 1 addition & 0 deletions R/future_lapply.R
@@ -1,4 +1,5 @@
run_future_lapply <- function(config){
assert_pkgs(c("future", "future.apply"))
prepare_distributed(config = config)
mc_init_worker_cache(config)
console_persistent_workers(config)
Expand Down
3 changes: 3 additions & 0 deletions R/mclapply.R
@@ -1,4 +1,5 @@
run_mclapply <- function(config){
assert_pkgs("txtq")
if (config$jobs < 2 && !length(config$debug)) {
return(run_loop(config = config))
}
Expand Down Expand Up @@ -52,6 +53,7 @@ mc_process <- function(id, config){
#' @param config `drake_config()` list
#' @return nothing important
mc_master <- function(config){
assert_pkgs("txtq")
on.exit(mc_conclude_workers(config))
config$queue <- new_priority_queue(config = config)
if (!identical(config$ensure_workers, FALSE)){
Expand All @@ -69,6 +71,7 @@ mc_master <- function(config){
}

mc_worker <- function(worker, config){
assert_pkgs("txtq")
ready_queue <- mc_get_ready_queue(worker, config)
done_queue <- mc_get_done_queue(worker, config)
while (TRUE){
Expand Down
4 changes: 0 additions & 4 deletions R/package.R
Expand Up @@ -44,16 +44,13 @@
#' @importFrom dplyr bind_rows do group_by mutate n select ungroup
#' @importFrom evaluate try_capture_stack
#' @importFrom formatR tidy_source
#' @importFrom future future plan resolved value
#' @importFrom future.apply future_lapply
#' @importFrom fs dir_create file_create
#' @importFrom grDevices col2rgb rgb
#' @importFrom igraph adjacent_vertices components delete_vertices
#' degree edge edges igraph_opt igraph_options induced_subgraph is_dag
#' make_empty_graph plot.igraph set_vertex_attr simplify subcomponent
#' topo_sort V vertex vertex_attr
#' @importFrom knitr knit
#' @importFrom lubridate dseconds duration
#' @importFrom magrittr %>%
#' @importFrom parallel clusterCall clusterExport makePSOCKcluster
#' mclapply parLapply stopCluster
Expand All @@ -70,7 +67,6 @@
#' @importFrom testthat context expect_false expect_true test_dir test_that
#' @importFrom tibble as_tibble tibble
#' @importFrom tidyselect vars_select
#' @importFrom txtq txtq
#' @importFrom utils capture.output compareVersion head installed.packages
#' packageVersion read.csv sessionInfo stack type.convert unzip write.table
#' @importFrom withr local_dir with_dir with_options with_output_sink
Expand Down
1 change: 1 addition & 0 deletions R/predict_runtime.R
Expand Up @@ -203,6 +203,7 @@ predict_load_balancing <- function(
default_time = 0,
warn = TRUE
){
assert_pkgs("lubridate")
if (!is.null(future_jobs) || !is.null(digits)){
warning(
"The `future_jobs` and `digits` arguments ",
Expand Down
12 changes: 2 additions & 10 deletions R/staged.R
Expand Up @@ -141,6 +141,7 @@ run_parLapply_staged <- function(config) { # nolint
}

run_future_lapply_staged <- function(config){
assert_pkgs(c("future", "future.apply"))
prepare_distributed(config = config)
schedule <- config$schedule
while (length(V(schedule)$name)){
Expand All @@ -163,16 +164,7 @@ run_future_lapply_staged <- function(config){
}

run_clustermq_staged <- function(config){
if (!requireNamespace("clustermq")){
# nocov start
drake_error(
"to use make(parallelism = \"clustermq_staged\"), ",
"you must install the clustermq package: ",
"https://github.com/mschubert/clustermq.",
config = config
)
# nocov end
}
assert_pkgs("clustermq")
schedule <- config$schedule
workers <- clustermq::workers(n_jobs = config$jobs)
on.exit(workers$finalize())
Expand Down
98 changes: 49 additions & 49 deletions codemeta.json
Expand Up @@ -115,6 +115,30 @@
},
"sameAs": "https://CRAN.R-project.org/package=DBI"
},
{
"@type": "SoftwareApplication",
"identifier": "future",
"name": "future",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=future"
},
{
"@type": "SoftwareApplication",
"identifier": "future.apply",
"name": "future.apply",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=future.apply"
},
{
"@type": "SoftwareApplication",
"identifier": "ggplot2",
Expand All @@ -139,6 +163,18 @@
},
"sameAs": "https://CRAN.R-project.org/package=ggraph"
},
{
"@type": "SoftwareApplication",
"identifier": "lubridate",
"name": "lubridate",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=lubridate"
},
{
"@type": "SoftwareApplication",
"identifier": "MASS",
Expand Down Expand Up @@ -180,6 +216,18 @@
},
"sameAs": "https://CRAN.R-project.org/package=RSQLite"
},
{
"@type": "SoftwareApplication",
"identifier": "txtq",
"name": "txtq",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=txtq"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
Expand Down Expand Up @@ -296,30 +344,6 @@
},
"sameAs": "https://CRAN.R-project.org/package=formatR"
},
{
"@type": "SoftwareApplication",
"identifier": "future",
"name": "future",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=future"
},
{
"@type": "SoftwareApplication",
"identifier": "future.apply",
"name": "future.apply",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=future.apply"
},
{
"@type": "SoftwareApplication",
"identifier": "fs",
Expand Down Expand Up @@ -361,18 +385,6 @@
},
"sameAs": "https://CRAN.R-project.org/package=knitr"
},
{
"@type": "SoftwareApplication",
"identifier": "lubridate",
"name": "lubridate",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=lubridate"
},
{
"@type": "SoftwareApplication",
"identifier": "magrittr",
Expand Down Expand Up @@ -530,18 +542,6 @@
},
"sameAs": "https://CRAN.R-project.org/package=tidyselect"
},
{
"@type": "SoftwareApplication",
"identifier": "txtq",
"name": "txtq",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=txtq"
},
{
"@type": "SoftwareApplication",
"identifier": "utils",
Expand All @@ -562,7 +562,7 @@
],
"releaseNotes": "https://github.com/ropensci/drake/blob/master/NEWS.md",
"readme": "https://github.com/ropensci/drake/blob/master/README.md",
"fileSize": "382.335KB",
"fileSize": "379.308KB",
"contIntegration": [
"https://ci.appveyor.com/project/ropensci/drake",
"https://travis-ci.org/ropensci/drake",
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-cache.R
Expand Up @@ -129,6 +129,7 @@ test_with_dir("subspaces", {
})

test_with_dir("cache functions work", {
skip_if_not_installed("lubridate")
# May have been loaded in a globalenv() testing scenario # nolint
remove_these <- intersect(ls(envir = globalenv()), c("h", "j"))
rm(list = remove_these, envir = globalenv())
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-future.R
Expand Up @@ -2,6 +2,8 @@ drake_context("future")

test_with_dir("future package functionality", {
skip_on_cran() # CRAN gets whitelist tests only (check time limits).
skip_if_not_installed("future")
skip_if_not_installed("future.apply")
future::plan(future::sequential)
scenario <- get_testing_scenario()
e <- eval(parse(text = scenario$envir))
Expand Down Expand Up @@ -64,6 +66,8 @@ test_with_dir("prepare_distributed() writes cache folder if nonexistent", {

test_with_dir("can gracefully conclude a crashed worker", {
skip_on_cran() # CRAN gets whitelist tests only (check time limits).
skip_if_not_installed("future")
skip_if_not_installed("future.apply")
for (caching in c("master", "worker")){
con <- dbug()
con$caching <- caching
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-graph.R
Expand Up @@ -80,6 +80,7 @@ test_with_dir("Supplied graph is pruned.", {

test_with_dir("we can generate different visNetwork dependency graphs", {
skip_on_cran() # CRAN gets whitelist tests only (check time limits).
skip_if_not_installed("lubridate")
load_mtcars_example()
config <- drake_config(my_plan)

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-memory-cache.R
Expand Up @@ -21,6 +21,7 @@ test_with_dir("storr_environment is usable", {

test_with_dir("arbitrary storr in-memory cache", {
skip_on_cran() # CRAN gets whitelist tests only (check time limits).
skip_if_not_installed("lubridate")
expect_false(file.exists(default_cache_path()))
parallelism <- default_parallelism()
jobs <- 1
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-mtcars-example.R
Expand Up @@ -67,6 +67,7 @@ test_with_dir("mtcars example works", {
expect_equal(sort(ls(envir = e)), coefs)

# build_times() # nolint
skip_if_not_installed("lubridate")
all_times <- build_times()
expect_true(nrow(all_times) >= nrow(config$plan))
some_times <- build_times(starts_with("coef"))
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-parallel.R
Expand Up @@ -186,6 +186,8 @@ test_with_dir("null cases for message queues", {

test_with_dir("ensure_workers can be disabled", {
skip_on_cran() # CRAN gets whitelist tests only (check time limits).
skip_if_not_installed("future")
skip_if_not_installed("future.apply")
load_mtcars_example()
future::plan(future::sequential)
config <- drake_config(my_plan)
Expand Down

0 comments on commit a999522

Please sign in to comment.