-
Notifications
You must be signed in to change notification settings - Fork 2
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
Basic support for dependencies #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, one comment about an additional test but could also leave that for a separate PR
orderly3::orderly_depends("explicit", "latest", c(graph.png = "mygraph.png")) | ||
orderly3::orderly_artefact("Final plot", "graph.png") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test case where the name of the dependency is different from the artefact? Ran into an issue with this in orderly2 which is what vimc/orderly2#8 is addressing. Could also do that in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example the dependency is being renamed, but there's no "unexpected files" check yet here (it'll be a bit harder to add). Or is it something else that's missing in the orderly2 test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the name of the dependency after being pulled into this report run is different from the name of the artefact. They are the same here as you say. Though actually if we have no unexpected files check here then comment above is not relevant!
@@ -1,6 +1,7 @@ | |||
# Generated by roxygen2: do not edit by hand | |||
|
|||
export(orderly_artefact) | |||
export(orderly_depends) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the most consistent with the other function names would be orderly_dependency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in #9
##' | ||
##' @return Undefined | ||
##' @export | ||
orderly_depends <- function(name, query, use) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like it would be nice if you could just do function(name, query, ...)
where ...
is the named file arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but here's the pair of issues issue with that:
First, In the case where you want to compute the filenames passing in dots is hard as R does not have a spread/splat operator. This will be an issue for Pete's case where we are pulling in things from different regions and renaming them as what we can do with an explicit use
argument is:
for (r in regions) {
query <- rlang::expr(parameter:region == !!r)
use <- setNames("data.rds", file.path("data", paste0(r, ".rds")))
orderly_depends("data", query, use)
}
Second, you can compromise by adding a get collisions with names, so we could write:
orderly_depends <- function(name, query, ..., use = c(...)) {
}
or by carefully processing ...
, but this requires some care with any analysis of the contents in static_orderly_dependency
I think.
I had a look at sorting this out but it looks complicated enough that I'd rather kick it down the road a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with the previous PRs, mostly fairly straightforward I hope. Major issues are:
orderly_depends
; this could have beenorderly_use_dependency
perhaps. It might make sense to review all the names in one go?