Skip to content

Commit

Permalink
styling
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Feb 8, 2024
1 parent e2e65c6 commit b610be5
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 17 deletions.
6 changes: 4 additions & 2 deletions R/cromUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
workflow_options <- function(workflow_id, url = cw_url(), token = NULL) {
check_url(url)
dplyr::as_tibble(
jsonlite::fromJSON(cromwell_workflow(workflow_id, url, token)$options))
jsonlite::fromJSON(cromwell_workflow(workflow_id, url, token)$options)
)
}

#' Pull the workflow inputs provided for a Cromwell workflow job
Expand All @@ -29,5 +30,6 @@ workflow_options <- function(workflow_id, url = cw_url(), token = NULL) {
workflow_inputs <- function(workflow_id, url = cw_url(), token = NULL) {
check_url(url)
dplyr::as_tibble(
jsonlite::fromJSON(cromwell_workflow(workflow_id, url, token)$inputs))
jsonlite::fromJSON(cromwell_workflow(workflow_id, url, token)$inputs)
)
}
3 changes: 2 additions & 1 deletion R/cromwellAbort.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cromwell_abort <- function(workflow_id, url = cw_url(), token = NULL) {
check_url(url)
crom_mssg("Aborting job in Cromwell")
http_post(make_url(url, "api/workflows/v1", workflow_id, "abort"),
token = token) %>%
token = token
) %>%
dplyr::as_tibble()
}
3 changes: 3 additions & 0 deletions R/cromwellCall.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# nolint start

#' Retrieve metadata for the calls made in a Cromwell workflow job
#'
#' Retrieve and process call metadata for a specific workflow.
Expand Down Expand Up @@ -252,3 +254,4 @@ cromwell_call <- function(workflow_id, url = cw_url(), token = NULL) {
}
return(just_calls)
}
# nolint end
6 changes: 3 additions & 3 deletions R/cromwellGlob.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#' thisWorkflowID <- recentJobs$workflow_id[1]
#' workflowMeta <- cromwell_glob(workflow_id = thisWorkflowID)
#' }
cromwell_glob <- function(workflow_id, expand_sub_workflows = FALSE,
url = cw_url(), token = NULL) {

cromwell_glob <- function(
workflow_id, expand_sub_workflows = FALSE,
url = cw_url(), token = NULL) {
check_url(url)
crom_mssg(paste0("Querying for metadata for workflow id: ", workflow_id))
url <- make_url(url, "api/workflows/v1", workflow_id, "metadata")
Expand Down
6 changes: 4 additions & 2 deletions R/cromwellJobs.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ cromwell_jobs <- function(days = 1,
}
crom_dat <-
http_get(make_url(url, "api/workflows/v1/query"),
query = query, token = token)$results
query = query, token = token
)$results
cr_table <- purrr::map_dfr(crom_dat, dplyr::bind_rows)
if (nrow(cr_table) > 0 && "id" %in% names(cr_table)) {
cr_table <- dplyr::rename(cr_table, "workflow_id" = "id")
if ("name" %in% colnames(cr_table)) {
cr_table <- dplyr::rename(cr_table, "workflow_name" = "name")
}
cr_table$submission <- lubridate::with_tz(lubridate::ymd_hms(cr_table$submission),
cr_table$submission <- lubridate::with_tz(
lubridate::ymd_hms(cr_table$submission),
tzone = pkg_env$tzone
)
if ("start" %in% colnames(cr_table)) {
Expand Down
6 changes: 4 additions & 2 deletions R/cromwellOutputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ cromwell_outputs <- function(workflow_id, url = cw_url(), token = NULL) {
}
df$workflow_id <- workflow_id
} else {
df <- dplyr::tibble("workflow_id" =
"No outputs available for this workflow yet")
df <- dplyr::tibble(
"workflow_id" =
"No outputs available for this workflow yet"
)
}
return(df)
}
6 changes: 3 additions & 3 deletions R/cromwellValidate.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#' @template serverdeets
#' @return Returns the response from the API post which includes the workflow
#' ID that you'll need to monitor the job.
cromwell_validate <- function(wdl, all_inputs = NULL,
url = cw_url(), token = NULL) {

cromwell_validate <- function(
wdl, all_inputs = NULL,
url = cw_url(), token = NULL) {
check_url(url)
crom_mssg("Validating a workflow for Cromwell")

Expand Down
1 change: 0 additions & 1 deletion R/http.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ make_url <- function(base_url, ...) {
#' @param x a url. default: NULL
#' @keywords internal
check_url <- function(x = NULL) {

if (identical(x, "") || is.null(x)) {
stop("Set the env var `CROMWELLURL`. ",
"See ?cromwell_settings",
Expand Down
9 changes: 6 additions & 3 deletions tests/testthat/test-cromwell_jobs.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
test_that("cromwell_jobs", {
vcr::use_cassette("cromwell_jobs", {
res <- cromwell_jobs()
}, match_requests_on = c("method", "host", "path"))
vcr::use_cassette("cromwell_jobs",
{
res <- cromwell_jobs()
},
match_requests_on = c("method", "host", "path")
)

expect_s3_class(res, "tbl")
expect_equal(NCOL(res), 8)
Expand Down

0 comments on commit b610be5

Please sign in to comment.