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

target invalidated when referenced from another plan #681

Closed
idavydov opened this issue Jan 16, 2019 · 3 comments
Closed

target invalidated when referenced from another plan #681

idavydov opened this issue Jan 16, 2019 · 3 comments

Comments

@idavydov
Copy link

idavydov commented Jan 16, 2019

library(drake)

plan.a <- drake_plan(a=10)

make(plan.a)
#> target a
loadd(a)

plan.b <- drake_plan(b=a+10)

make(plan.b)
#> target b

make(plan.a)
#> Unloading targets from environment:
#>   a
#> target a

Note that target a was not changed, however it's invalidated.

This works as expected:

library(drake)

plan.a <- drake_plan(a=10)

make(plan.a)
#> target a
a.copy <- readd(a)

plan.b <- drake_plan(b=a.copy+10)

make(plan.b)
#> target b

make(plan.a)
#> All targets are already up to date.
@wlandau
Copy link
Member

wlandau commented Jan 16, 2019

That's a great point. Please include all your targets in a single plan (with bind_plans(),rbind(), or dplyr::bind_rows()). drake thinks plan.a and plan.b are for different projects, and this is unlikely to change in future development. Sorry if this is inconvenient. The API I am developing in #674 should make it easier to keep things consolidated.

You could split up different plans into different projects with different sessions and caches. (See the cache argument to make() and https://ropenscilabs.github.io/drake-manual/store.html.)

@idavydov
Copy link
Author

idavydov commented Jan 16, 2019

Thanks. Do you think this could detected with a warning? This behavior is not entirely obvious, and took a lot of time to debug for me.

Regarding my case, combining two plans is not a good option, since the second plan is created conditionally based on the results of the first plan. This is because not all branches of the graph can be computed (see second point of #528), so I'm trying to solve it with a preprocessing plan.

Having a separate cache is an option, I did it for a while. But I discovered that readd() and loadd() inside .Rmd are always using the default cache, and hard-coding cache for every readd() and loadd() call looks kinda ugly. I'm not sure this could be in principle solved by drake.

@wlandau
Copy link
Member

wlandau commented Jan 16, 2019

Do you think this could detected with a warning?

I could be convinced. However, for large workflows, it seems like this would require a lot of cache operations, so I doubt it will scale well. I would be happy to review a pull request, though.

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