-
Notifications
You must be signed in to change notification settings - Fork 9
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 capability to version cases #105
Add capability to version cases #105
Conversation
Regarding 2, what exactly does create a history discontinuity in conbench? @austin3dickey have you happened to learn this yet? |
We should document this since it comes up frequently, but: Differences in:
|
We definitely shouldn't break history — we could either migrate and add 1s in everywhere or we could have a special case in conbench history where for version |
Hmm, yeah I think this is ok. It is like many of the other variables that defines a case (at least on the conbench side)... |
Hm, so we are writing most params (currently including |
@@ -93,6 +98,8 @@ Benchmark <- function(name, | |||
after_each = TRUE, | |||
teardown = TRUE, | |||
valid_params = function(params) params, | |||
case_version = function(params) NULL, | |||
packages_used = function(params) "arrow", |
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.
Added this because it's already called, but previously we were relying on every benchmark adding it in the same way though ...
. I'm now leaning more towards R6-ifying this class
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.
Not a ton to say other than that it feels like until we actually need a version change we should stick with the NULL == 1
situation.
Right now |
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.
This is looking good — thanks! A few comments that might be quick to fix or a longer thread to unravel.
bm_versioned <- Benchmark( | ||
"versioned", | ||
setup = function(x = c('foo', 'bar')) cat(x), | ||
case_version = function(params) c("foo" = 1L, "bar" = 2L)[params$x] |
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 can and will look at the code, but we should also test what happens if foo
is not mentioned here? Is that possible?
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.
Because of how I constructed this example, if params
were list(x = "baz")
(or any novel value), it will return NA
, which will get written to the tags as "tags": {..., "case_version": null}
, which I think may break history in conbench (though I'm not 💯).
R/run.R
Outdated
@@ -186,6 +186,8 @@ run_bm <- function(bm, ..., n_iter = 1, profiling = FALSE, global_params = list( | |||
defaults <- lapply(get_default_args(bm$setup), head, 1) | |||
defaults$cpu_count <- parallel::detectCores() | |||
params <- modifyList(defaults, list(...)) | |||
params$case_version <- bm$case_version(params) |
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.
Hmm looks like my question in the tests below: I think this would return NA
? Would it be possible to wrap this such that if something isn't defined in the function it'll return NULL
?
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.
Yep, that's what I'm thinking; we should either do stopifnot(is.na(case_version))
or automatically replace it with NULL
(with a warning, probably?). I'm leaning towards erroring—we should see this when adjusting benchmarks (presuming we run them with all arg combinations), and we don't want to accidentally switch back to not versioning without noticing.
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.
Ok, put in a stopifnot()
and a test for it
ah crap my git branches got conflated! sorry, fixing |
8658ed2
to
ee625f1
Compare
Successor to #104; closes #101. This PR inserts versioning for cases into params via a benchmark-configurable function that takes a case (a named list of params) and returns an integer version.
There are a couple important questions here:
cpu_count
,lib_path
, a dataframe ofpackages
); at some point we should move this stuff to a metadata section.1L
, but I haven't quite figured out yet whether this will break all the histories in conbench. If so, it's probably better to change it to default to not setting it.