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

Add custom file_out() files back to dependency graph visuals #486

Closed
wlandau opened this issue Jul 30, 2018 · 1 comment
Closed

Add custom file_out() files back to dependency graph visuals #486

wlandau opened this issue Jul 30, 2018 · 1 comment
Assignees

Comments

@wlandau
Copy link
Member

wlandau commented Jul 30, 2018

Examples like #451 (comment) will be much easier to visualize this way. And from #483, detailed input/output file dependency information is available to drake_graph_info().

@wlandau wlandau self-assigned this Jul 30, 2018
@wlandau wlandau changed the title Add custom file_out() files back in visuals Add custom file_out() files back to dependency graph visuals Jul 30, 2018
@wlandau
Copy link
Member Author

wlandau commented Jul 30, 2018

An example modified from #451 should be a good test case:

library(drake)
library(glue)
library(rlang)
library(tidyverse)

write_command <- function(cmd, inputs = NULL , outputs = NULL){
  inputs <- enexpr(inputs)
  outputs <- enexpr(outputs)
  expr({
    glue_data(
      list(
        inputs = file_in(!!inputs),
        outputs = file_out(!!outputs)
      ),
      !!cmd
    ) %>%
      lapply(FUN = system)
  }) %>%
    expr_text
}

meta_plan <- tribble(
  ~cmd, ~inputs, ~outputs,
  "cat {inputs} > {outputs}", c("in1.txt", "in2.txt"), c("out1.txt", "out2.txt"),
  "cat {inputs} {inputs} > {outputs}", c("out1.txt", "out2.txt"), c("out3.txt", "out4.txt")
)

plan <- tibble(
  target = paste0("target_", seq_len(nrow(meta_plan))),
  command = pmap_chr(meta_plan, write_command)
) %>%
  print

writeLines("in2", "in1.txt")
writeLines("in2", "in2.txt")
make(plan)
writeLines("out3", "out3.txt")

config <- drake_config(plan)
vis_drake_graph(config)

graph

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

1 participant