ropensci / drake

An R-focused pipeline toolkit for reproducibility and high-performance computing
https://docs.ropensci.org/drake
GNU General Public License v3.0
1.34k stars 129 forks source link

drake_cache() fails silently on non-existant path #1352

Closed potash closed 3 years ago

potash commented 3 years ago

Prework

Description

Creating a drake_cache with a non-existant path returns NULL which if passed in turn to make() uses the current working directory.

Reproducible example

> library(drake)
> drake_cache("directory-does-not-exist")
NULL

Expected result

I think it would be reasonable to either raise an error or (try to) create the non-existent path.

Session info

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] drake_7.12.7

loaded via a namespace (and not attached):
 [1] txtq_0.2.3        prettyunits_1.1.1 fansi_0.4.1       crayon_1.3.4     
 [5] assertthat_0.2.1  digest_0.6.27     R6_2.5.0          backports_1.2.0  
 [9] storr_1.2.5       magrittr_2.0.1    progress_1.2.2    cli_2.2.0        
[13] rlang_0.4.9       filelock_1.0.2    vctrs_0.3.5       tools_4.0.3      
[17] glue_1.4.2        purrr_0.3.4       igraph_1.2.6      hms_0.5.3        
[21] parallel_4.0.3    compiler_4.0.3    pkgconfig_2.0.3   base64url_1.4    
[25] tidyselect_1.1.0 
wlandau commented 3 years ago

Unfortunately, the drake_cache() function is too deeply embedded in other package functions to safely throw an error or even a warning. And the current behavior is consistent with drake's original intention to be super flexible about where the cache is located. For a pipeline toolkit that is deliberately more strict and paternalistic about the cache location, consider switching to targets, the long-term successor to drake.