Reading the documentation of the drake package, I found no other way to define the order of the targets without the use of 'file_in' and 'file_out'.
file_in() marks individual files (and whole directories) that your targets depend on.
file_out() marks individual files (and whole directories) that your targets create.
It is not possible, however, to use both with dynamic targets.
So how can I define an order that should be followed between dynamic targets?
I also tried to use make(plan, targets = c("ftp_list", "download.dbc", "dbc_list", "generate_parquet"))
, but it didn't work
In the code below, for example, I have four targets. What I'd like (order):
- Get ftp list from the server
- Download the first file from the ftp list (few space in the hd to download all)
- Get the downloaded file
- Convert as .parquet (and then, start over. download the second file, convert to parquet...)
Any idea how I can link dynamic targets without using file_in and file_out (not allowed in this case)? Thanks!
Code just as example:
URL <- "ftp://ftp.url"
LOCAL_PATH <- paste0(getwd())
plan <- drake_plan(
ftp_list = obtain_filenames_from_url(url_ = URL,
remove_extension_from_filename_ = FALSE,
full_names = TRUE)[0:10],
download.dbc = target(download_dbc(ftp_list,
local_path = paste0(LOCAL_PATH, "/")),
dynamic = map(ftp_list)),
dbc_list = target(list.files(LOCAL_PATH, full.names = TRUE,
pattern = "*.dbc")),
generate_parquet = target(convert_dbc(dbc_list, delete_dbc_after_conversion = TRUE),
dynamic = map(dbc_list))
)
plan graph output: