Skip to content

Commit 6178c82

Browse files
authored
Merge pull request #49 from getwilds/dev
rcromwell v3.3.0 Updates
2 parents c58df3d + 4ab55ef commit 6178c82

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+424
-569
lines changed

DESCRIPTION

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: rcromwell
22
Title: Convenience Tools for Managing WDL Workflows via Cromwell
3-
Version: 3.2.5
3+
Version: 3.3.0
44
Authors@R: c(
55
person("Amy", "Paguirigan", role = "aut",
66
comment = c(ORCID = "0000-0002-6819-9736")),
@@ -12,30 +12,28 @@ URL: https://getwilds.org/rcromwell, https://github.com/getwilds/rcromwell
1212
BugReports: https://github.com/getwilds/rcromwell/issues
1313
Description: A repo containing a basic R package for using Cromwell with WDL workflows via R.
1414
Imports:
15-
httr,
1615
jsonlite,
1716
dplyr,
1817
purrr,
1918
tidyr,
2019
lubridate,
2120
rlang,
22-
glue
21+
glue,
22+
curl,
23+
httr2
2324
License: MIT + file LICENSE
24-
Depends: R (>= 3.6.0)
25+
Depends: R (>= 4.1.0)
2526
Roxygen: list(markdown = TRUE, roclets = c("collate", "namespace", "rd",
2627
"roxyglobals::global_roclet"))
2728
RoxygenNote: 7.3.2
2829
Encoding: UTF-8
2930
Suggests:
30-
curl,
3131
knitr,
3232
rmarkdown,
3333
roxyglobals,
3434
testthat (>= 3.0.0),
35-
vcr (>= 0.6.0),
36-
webmockr
37-
Remotes:
38-
ropensci/vcr
35+
vcr (>= 1.6.0),
36+
webmockr (>= 1.0.0)
3937
Config/testthat/edition: 3
4038
Config/roxyglobals/filename: globals.R
4139
Config/roxyglobals/unique: FALSE

NAMESPACE

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ export(cromwell_workflow)
1919
export(cw_url)
2020
export(workflow_inputs)
2121
export(workflow_options)
22+
importFrom(curl,form_file)
2223
importFrom(dplyr,"%>%")
2324
importFrom(dplyr,any_of)
2425
importFrom(dplyr,as_tibble)
2526
importFrom(dplyr,relocate)
2627
importFrom(dplyr,tibble)
2728
importFrom(glue,glue)
28-
importFrom(httr,GET)
29-
importFrom(httr,POST)
30-
importFrom(httr,content)
31-
importFrom(httr,status_code)
32-
importFrom(httr,stop_for_status)
33-
importFrom(httr,upload_file)
29+
importFrom(httr2,req_body_multipart)
30+
importFrom(httr2,req_error)
31+
importFrom(httr2,req_headers)
32+
importFrom(httr2,req_method)
33+
importFrom(httr2,req_perform)
34+
importFrom(httr2,req_url_query)
35+
importFrom(httr2,request)
36+
importFrom(httr2,resp_body_json)
3437
importFrom(jsonlite,fromJSON)
3538
importFrom(lubridate,now)
3639
importFrom(lubridate,with_tz)
@@ -43,7 +46,6 @@ importFrom(purrr,map_dfr)
4346
importFrom(purrr,pluck)
4447
importFrom(purrr,reduce)
4548
importFrom(rlang,abort)
46-
importFrom(rlang,caller_env)
4749
importFrom(rlang,has_name)
4850
importFrom(rlang,is_character)
4951
importFrom(rlang,is_logical)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# rcromwell 3.3.0
2+
3+
* Swapping `httr` for `httr2` and fixing styling (@sckott in [#48](https://github.com/getwilds/rcromwell/pull/48))
4+
15
# rcromwell 3.2.5
26

37
* gains new function `cromwell_labels` that hits the `/labels` route (#43) (#45)

R/cromwellAbort.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
cromwell_abort <- function(workflow_id, url = cw_url(), token = NULL) {
1010
check_url(url)
1111
crom_mssg("Aborting job in Cromwell")
12-
http_post(make_url(url, "api/workflows/v1", workflow_id, "abort"),
12+
http_req_post(
13+
url = make_url(url, "api/workflows/v1", workflow_id, "abort"),
1314
token = token
14-
) %>%
15+
) |>
16+
http_perform() |>
1517
dplyr::as_tibble()
1618
}

R/cromwellBackends.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
cromwell_backends <- function(url = cw_url(), token = NULL) {
99
check_url(url)
1010
crom_mssg("Getting backend options from Cromwell")
11-
all <- http_get(make_url(url, "api/workflows/v1/backends"), token = token)
11+
all <- http_req_get(
12+
url = make_url(url, "api/workflows/v1/backends"),
13+
token = token
14+
) |>
15+
http_perform()
1216
all$supportedBackends <- unlist(all$supportedBackends)
1317
return(all)
1418
}

R/cromwellCache.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ cromwell_cache <- function(workflow_id, url = cw_url(), token = NULL) {
2020
}
2121

2222
cromwell_cache_http <- function(workflow_id, url = cw_url(), token = NULL) {
23-
http_get(
23+
http_req_get(
2424
url = make_url(url, "api/workflows/v1", workflow_id, "metadata"),
25-
query = list(expandSubWorkflows = "false"),
26-
as = "parsed",
2725
token = token
28-
)
26+
) |>
27+
req_url_query(expandSubWorkflows = "false") |>
28+
http_perform()
2929
}
3030

3131
#' @autoglobal
@@ -50,7 +50,7 @@ cromwell_cache_process <- function(crommetadata, workflow_id) {
5050
# add the shard Index associated
5151
b$shardIndex <- shard_data$shardIndex
5252
} else {
53-
b <- dplyr::as_tibble("shardIndex" = shard_data$shardIndex)
53+
b <- dplyr::tibble("shardIndex" = shard_data$shardIndex)
5454
}
5555
b$shardIndex <- as.character(b$shardIndex)
5656
b$workflow_id <- workflow_id

R/cromwellCall.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ cromwell_call <- function(workflow_id, url = cw_url(), token = NULL) {
2727
check_url(url)
2828
crom_mssg(glue("Querying for call metadata for workflow id: {workflow_id}"))
2929
crommetadata <-
30-
http_get(
30+
http_req_get(
3131
url = make_url(url, "api/workflows/v1", workflow_id, "metadata"),
32-
query = list(expandSubWorkflows = "true"),
33-
as = "parsed",
3432
token = token
35-
)
33+
) |>
34+
req_url_query(expandSubWorkflows = "true") |>
35+
http_perform()
3636
# if the response is a character vector, then return it and stop
3737
if (is.character(crommetadata)) stop(crommetadata)
3838
# if the response is a list, meaning it has some content, continue

R/cromwellFailures.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ cromwell_failures <- function(workflow_id, url = cw_url(), token = NULL) {
2525
))
2626

2727
response <-
28-
http_get(
28+
http_req_get(
2929
url = make_url(url, "api/workflows/v1", workflow_id, "metadata"),
30-
query = list(includeKey = "failures", includeKey = "jobId"),
31-
as = "parsed",
3230
token = token
33-
)
31+
) |>
32+
req_url_query(includeKey = "failures", includeKey = "jobId") |>
33+
http_perform()
3434
cromwell_failures_process(response, workflow_id)
3535
}
3636

R/cromwellGlob.R

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ cromwell_glob <- function(
3030
check_url(url)
3131
crom_mssg(glue("Querying for metadata for workflow id: {workflow_id}"))
3232
url <- make_url(url, "api/workflows/v1", workflow_id, "metadata")
33-
http_get(
34-
url = url,
35-
query = list(expandSubWorkflows = tolower(expand_sub_workflows)),
36-
as = "parsed",
37-
token = token
38-
)
33+
http_req_get(url = url, token = token) |>
34+
req_url_query(expandSubWorkflows = tolower(expand_sub_workflows)) |>
35+
http_perform()
3936
}

R/cromwellJobs.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ cromwell_jobs <- function(days = 1,
3434
check_url(url)
3535
crom_mssg(glue("Querying cromwell for jobs in the last {days} days"))
3636
query <- cromwell_jobs_query(days, workflow_name, workflow_status)
37-
jobs_data <- http_get(
38-
make_url(url, "api/workflows/v1/query"),
39-
query = query, token = token
40-
)
37+
jobs_data <- http_req_get(
38+
url = make_url(url, "api/workflows/v1/query"),
39+
token = token
40+
) |>
41+
req_url_query(!!!query) |>
42+
http_perform()
4143
cromwell_jobs_process(jobs_data$results)
4244
}
4345

R/cromwellLogs.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ cromwell_logs <- function(workflow_id, url = cw_url(), token = NULL) {
2020
}
2121

2222
cromwell_logs_query <- function(workflow_id, url = cw_url(), token = NULL) {
23-
http_get(
23+
http_req_get(
2424
url = make_url(
2525
url,
2626
"api/workflows/v1",
2727
workflow_id,
2828
"logs"
2929
),
30-
as = "parsed",
3130
token = token
32-
)
31+
) |>
32+
http_perform()
3333
}
3434

3535
cromwell_logs_process <- function(response, workflow_id) {

R/cromwellOutputs.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ cromwell_outputs <- function(workflow_id, url = cw_url(), token = NULL) {
1919
}
2020

2121
cromwell_outputs_query <- function(workflow_id, url = cw_url(), token = NULL) {
22-
http_get(
22+
http_req_get(
2323
url =
2424
make_url(
2525
url,
2626
"api/workflows/v1",
2727
workflow_id,
2828
"outputs"
2929
),
30-
as = "parsed",
3130
token = token
32-
)
31+
) |>
32+
http_perform()
3333
}
3434

3535
#' @autoglobal

R/cromwellSubmitBatch.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ cromwell_submit_batch_query <- function(
4343
)
4444
}
4545
body <- list(
46-
workflowSource = httr::upload_file(wdl)
46+
workflowSource = curl::form_file(wdl)
4747
)
4848

4949
if (!is.null(params) && !is.null(batch)) {
@@ -78,10 +78,10 @@ cromwell_submit_batch_query <- function(
7878
}
7979

8080
cromwell_submit_batch_http <- function(body, url, token) {
81-
http_post(
81+
http_req_post(
8282
url = make_url(url, "api/workflows/v1"),
83-
body = body,
84-
encode = "multipart",
8583
token = token
86-
)
84+
) |>
85+
req_body_multipart(!!!body) |>
86+
http_perform()
8787
}

R/cromwellTiming.R

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@
66
#' supplied set the url as the env var `CROMWELLURL`
77
#' @inheritSection workflow_options Important
88
#' @author Amy Paguirigan, Scott Chamberlain
9-
#' @details Internally this function uses [httr::BROWSE()] which uses
10-
#' [utils::browseURL()] - if a auth header is required you'll have to
11-
#' do that manually
9+
#' @details Internally this function uses [utils::browseURL()] - if an
10+
#' auth header is required you'll have to do that manually
1211
#' @return Opens a timing diagram in a browser
1312
cromwell_timing <- function(workflow_id, url = cw_url()) {
1413
check_url(url)
1514
crom_mssg("Getting timing diagram from Cromwell")
16-
httr::BROWSE(
17-
make_url(
18-
url,
19-
"api/workflows/v1",
20-
workflow_id,
21-
"timing"
22-
)
15+
url <- make_url(
16+
url,
17+
"api/workflows/v1",
18+
workflow_id,
19+
"timing"
2320
)
21+
browse(url)
2422
}

R/cromwellValidate.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ cromwell_validate <- function(
1515
check_url(url)
1616
crom_mssg("Validating a workflow for Cromwell")
1717

18-
body <- list(workflowSource = httr::upload_file(wdl))
18+
body <- list(workflowSource = curl::form_file(wdl))
1919
if (!is.null(all_inputs)) {
2020
body <- c(
2121
body,
22-
workflowInputs = list(httr::upload_file(all_inputs))
22+
workflowInputs = list(curl::form_file(all_inputs))
2323
)
2424
}
2525

26-
http_post(
26+
http_req_post(
2727
url = make_url(url, "api/womtool/v1/describe"),
28-
body = body,
29-
encode = "multipart",
3028
token = token
31-
)
29+
) |>
30+
req_body_multipart(!!!body) |>
31+
http_perform()
3232
}

R/cromwellVersion.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
#' @return (character) the Cromwell version
88
cromwell_version <- function(url = cw_url(), token = NULL) {
99
check_url(url)
10-
http_get(make_url(url, "engine/v1/version"), token = token)
10+
http_req_get(url = make_url(url, "engine/v1/version"), token = token) |>
11+
http_perform()
1112
}

R/cromwellWorkflow.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ cromwell_workflow <- function(workflow_id, url = cw_url(), token = NULL) {
2727
}
2828

2929
cromwell_workflow_http <- function(workflow_id, url, token) {
30-
http_get(
30+
http_req_get(
3131
url = make_url(url, "api/workflows/v1", workflow_id, "metadata"),
32-
query = list(expandSubWorkflows = "false", excludeKey = "calls"),
33-
as = "parsed",
3432
token = token
35-
)
33+
) |>
34+
req_url_query(expandSubWorkflows = "false", excludeKey = "calls") |>
35+
http_perform()
3636
}
3737

3838
cromwell_workflow_process <- function(meta, workflow_id) {

0 commit comments

Comments
 (0)