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

Errors in targets aren't returned when running r_make. Get Error in assign(dumpto, last.dump, envir = .GlobalEnv) : cannot add bindings to a locked environment #969

Closed
PedramNavid opened this issue Aug 1, 2019 · 1 comment
Assignees

Comments

@PedramNavid
Copy link

Prework

  • [x ] Read and abide by drake's code of conduct.
  • [x ] Search for duplicates among the existing issues, both open and closed.
  • [x ] Advanced users: verify that the bug still persists in the current development version (i.e. remotes::install_github("ropensci/drake")) and mention the SHA-1 hash of the Git commit you install.

Using SHA-1: a33858e

Description

After upgrading R and drake, I noticed a change in behaviour when using r_make. Previously errors in targets would show up in the console, but they no longer do. Instead, I get

fail do_something
Error in assign(dumpto, last.dump, envir = .GlobalEnv) : 
  cannot add bindings to a locked environment

Reproducible example

library(drake)

my_func <- function(x) {
  if(is.null(x)) stop("Oops")
}
my_plan <- drake_plan(
  do_something = my_func()
)

make(my_plan)
#> target do_something
#> fail do_something
#> Error: Target `do_something` failed. Call `diagnose(do_something)` for details. Error message:
#>   argument "x" is missing, with no default

but with r_make

> r_make(source='test.R')
#> target do_something
#> fail do_something
#> Error in assign(dumpto, last.dump, envir = .GlobalEnv) : 
#>  cannot add bindings to a locked environment

Session info

Session info

sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Mojave 10.14.5
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] drake_7.5.2.9000
#> 
#> loaded via a namespace (and not attached):
#>  [1] igraph_1.2.4.1   Rcpp_1.0.2       knitr_1.23       magrittr_1.5    
#>  [5] R6_2.4.0         rlang_0.4.0      stringr_1.4.0    highr_0.8       
#>  [9] storr_1.2.1      tools_3.6.1      xfun_0.8         cli_1.1.0       
#> [13] htmltools_0.3.6  base64url_1.4    yaml_2.2.0       digest_0.6.20   
#> [17] assertthat_0.2.1 tibble_2.1.3     crayon_1.3.4     txtq_0.1.4      
#> [21] evaluate_0.14    rmarkdown_1.14   stringi_1.4.3    pillar_1.4.2    
#> [25] compiler_3.6.1   filelock_1.0.2   backports_1.1.4  pkgconfig_2.0.2

Expected output

What output would the correct behavior have produced?

Correct behaviour would be to show the same error when running either make or r_make

@wlandau
Copy link
Member

wlandau commented Aug 1, 2019

Thanks for sharing. Should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants