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

Inconsistent targets when after rerunning a plan, after changing dynamically crossed variables #1204

Closed
3 tasks done
psadil opened this issue Mar 5, 2020 · 2 comments
Closed
3 tasks done
Assignees

Comments

@psadil
Copy link

psadil commented Mar 5, 2020

Prework

Description

When a plan that uses the dynamic cross transformation is rerun -- and on the second run there are fewer variables to cross -- the resulting targets are incorrect

Reproducible example

Lightly modified from the drake book's dynamic cross example

library(drake)
plan <- drake_plan(
  numbers = c(1,2),
  letters = c("a", "b"),
  combo = target(
    paste0(numbers, letters), 
    dynamic = cross(numbers, letters))
)
make(plan)
#> ▶ target numbers
#> ▶ target letters
#> ▶ dynamic combo
#> > subtarget combo_5268eea9
#> > subtarget combo_43dd82ac
#> > subtarget combo_07e5554d
#> > subtarget combo_7fa427e0
#> ■ finalize combo
readd(combo)
#> [1] "1a" "1b" "2a" "2b"

# modify plan, removing middle number
plan <- drake_plan(
  numbers = c(1),
  letters = c("a", "b"),
  combo = target(
    paste0(numbers, letters), 
    dynamic = cross(numbers, letters))
)
make(plan)
#> ▶ target numbers
#> ■ finalize combo
readd(combo)
#> [1] "1a" "2a"

Created on 2020-03-05 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Ubuntu 18.04.4 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2020-03-05                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version     date       lib source                         
#>  assertthat    0.2.1       2019-03-21 [1] CRAN (R 3.6.0)                 
#>  backports     1.1.5       2019-10-02 [1] CRAN (R 3.6.1)                 
#>  base64url     1.4         2018-05-14 [1] CRAN (R 3.6.0)                 
#>  callr         3.4.2       2020-02-12 [1] CRAN (R 3.6.1)                 
#>  cli           2.0.2       2020-02-28 [1] CRAN (R 3.6.1)                 
#>  crayon        1.3.4       2017-09-16 [1] CRAN (R 3.6.0)                 
#>  desc          1.2.0       2018-05-01 [1] CRAN (R 3.6.0)                 
#>  devtools      2.2.2       2020-02-17 [1] CRAN (R 3.6.1)                 
#>  digest        0.6.25      2020-02-23 [1] CRAN (R 3.6.1)                 
#>  drake       * 7.11.0.9000 2020-03-05 [1] Github (ropensci/drake@a628f6c)
#>  ellipsis      0.3.0       2019-09-20 [1] CRAN (R 3.6.1)                 
#>  evaluate      0.14        2019-05-28 [1] CRAN (R 3.6.0)                 
#>  fansi         0.4.1       2020-01-08 [1] CRAN (R 3.6.1)                 
#>  filelock      1.0.2       2018-10-05 [1] CRAN (R 3.6.1)                 
#>  fs            1.3.2       2020-03-05 [1] CRAN (R 3.6.1)                 
#>  glue          1.3.1       2019-03-12 [1] CRAN (R 3.6.0)                 
#>  highr         0.8         2019-03-20 [1] CRAN (R 3.6.0)                 
#>  hms           0.5.3       2020-01-08 [1] CRAN (R 3.6.1)                 
#>  htmltools     0.4.0       2019-10-04 [1] CRAN (R 3.6.1)                 
#>  igraph        1.2.4.2     2019-11-27 [1] CRAN (R 3.6.1)                 
#>  knitr         1.28        2020-02-06 [1] CRAN (R 3.6.1)                 
#>  magrittr      1.5         2014-11-22 [1] CRAN (R 3.6.0)                 
#>  memoise       1.1.0       2017-04-21 [1] CRAN (R 3.6.0)                 
#>  pillar        1.4.3       2019-12-20 [1] CRAN (R 3.6.1)                 
#>  pkgbuild      1.0.6       2019-10-09 [1] standard (@1.0.6)              
#>  pkgconfig     2.0.3       2019-09-22 [1] standard (@2.0.3)              
#>  pkgload       1.0.2       2018-10-29 [1] CRAN (R 3.6.0)                 
#>  prettyunits   1.1.1       2020-01-24 [1] CRAN (R 3.6.1)                 
#>  processx      3.4.2       2020-02-09 [1] CRAN (R 3.6.1)                 
#>  progress      1.2.2       2019-05-16 [1] CRAN (R 3.6.0)                 
#>  ps            1.3.2       2020-02-13 [1] CRAN (R 3.6.1)                 
#>  R6            2.4.1       2019-11-12 [1] CRAN (R 3.6.1)                 
#>  Rcpp          1.0.3       2019-11-08 [1] standard (@1.0.3)              
#>  remotes       2.1.1       2020-02-15 [1] CRAN (R 3.6.1)                 
#>  rlang         0.4.5       2020-03-01 [1] CRAN (R 3.6.1)                 
#>  rmarkdown     2.1         2020-01-20 [1] CRAN (R 3.6.1)                 
#>  rprojroot     1.3-2       2018-01-03 [1] CRAN (R 3.6.0)                 
#>  sessioninfo   1.1.1       2018-11-05 [1] CRAN (R 3.6.0)                 
#>  storr         1.2.1       2018-10-18 [1] CRAN (R 3.6.0)                 
#>  stringi       1.4.6       2020-02-17 [1] CRAN (R 3.6.1)                 
#>  stringr       1.4.0       2019-02-10 [1] CRAN (R 3.6.0)                 
#>  testthat      2.3.2       2020-03-02 [1] CRAN (R 3.6.1)                 
#>  tibble        2.1.3       2019-06-06 [1] CRAN (R 3.6.0)                 
#>  txtq          0.2.0       2019-10-15 [1] CRAN (R 3.6.1)                 
#>  usethis       1.5.1       2019-07-04 [1] CRAN (R 3.6.0)                 
#>  vctrs         0.2.3       2020-02-20 [1] CRAN (R 3.6.1)                 
#>  withr         2.1.2       2018-03-15 [1] CRAN (R 3.6.0)                 
#>  xfun          0.12        2020-01-13 [1] CRAN (R 3.6.1)                 
#>  yaml          2.2.1       2020-02-01 [1] CRAN (R 3.6.1)                 
#> 
#> [1] /home/psadil/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library

Expected result

When running the plan the second time, I expected combo to contain "1a" "1b". But rather than dropping the second number, the second letter was dropped.

@wlandau
Copy link
Member

wlandau commented Mar 6, 2020

Wow, thanks for catching such a serious bug. Should be fixed now in d6f2dde.

@psadil
Copy link
Author

psadil commented Mar 7, 2020

Thanks for the fix!

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