The drake
manual gives the following example of using dynamic subtargets:
https://books.ropensci.org/drake/dynamic.html#dynamic-transformations
library(gapminder)
library(drake)
plan <- drake_plan(
subset = head(gapminder),
row = target(subset, dynamic = map(subset))
)
make(plan)
#> ▶ target subset
#> ▶ dynamic row
#> > subtarget row_9939cae3
#> > subtarget row_e8047114
#> > subtarget row_2ef3db10
#> > subtarget row_f9171bbe
#> > subtarget row_7d6002e9
#> > subtarget row_509468b3
#> ■ finalize row
Created on 2020-09-02 by the reprex package (v0.3.0)
Now lets say that for some reason, one or more these subtargets fail, e.g. row_9939cae3
. I would like to investigate the reason for that, and to do that I need to know the exact arguments that are being feed into the target function. How do I get a copy of that data?
Thanks for the help in advance.
Mark
Unfortunately,
drake
does not make this easy, but it is possible. I recommend dropping into an interactive debugger for the failed sub-target. For example, supposerow_f9171bbe
failed. In one of your custom functions, you can usecancel_if()
andid_chr()
to jump straight torow_f9171bbe
and then runbrowser()
right after that.