-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d737097
commit af4151c
Showing
7 changed files
with
44 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: conbenchcoms | ||
Title: An API wrapper for conbench communications | ||
Version: 0.0.7 | ||
Version: 0.0.8 | ||
Authors@R: c( | ||
person("Jonathan", "Keane", , "[email protected]", role = c("aut", "ctb"), | ||
comment = c(ORCID = "0000-0001-7087-9776")), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
#' Get history for a benchmark | ||
#' | ||
#' @param benchmark_id the hash of a benchmark to get the history for | ||
#' @inheritParams jsonlite::fromJSON | ||
#' @param benchmark_id the ID of a benchmark result to get the history for | ||
#' | ||
#' @return the response | ||
#' @return a tibble of history | ||
#' @export | ||
history <- function(benchmark_id, simplifyVector = TRUE, flatten = TRUE, ...) { | ||
history <- function(benchmark_id) { | ||
req <- req_url_path_append(conbench_request(), "history", benchmark_id) | ||
|
||
req <- req_url_query(req, page_size = 1000) | ||
resp <- conbench_perform(req) | ||
json <- resp_body_json(resp, simplifyVector = TRUE, flatten = TRUE) | ||
data <- dplyr::as_tibble(json[["data"]]) | ||
|
||
while (!is.null(json[["metadata"]][["next_page_cursor"]])) { | ||
req <- req_url_path_append(conbench_request(), "history", benchmark_id) | ||
req <- req_url_query( | ||
req, | ||
page_size = 1000, | ||
cursor = json[["metadata"]][["next_page_cursor"]] | ||
) | ||
resp <- conbench_perform(req) | ||
json <- resp_body_json(resp, simplifyVector = TRUE, flatten = TRUE) | ||
data <- dplyr::bind_rows(data, dplyr::as_tibble(json[["data"]])) | ||
} | ||
|
||
resp_body_json(resp, simplifyVector = simplifyVector, flatten = flatten, ...) | ||
data | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
tests/testthat/resp-class/localhost/api/history/hist-id-981e53.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"benchmark_id": "hist-id", | ||
"timestamp": "2022-04-07T21:11:19", | ||
"unit": "s" | ||
} | ||
], | ||
"metadata": { | ||
"next_page_cursor": null | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters