Skip to content

Commit

Permalink
styling changes
Browse files Browse the repository at this point in the history
- change all fxn names from camelCase to snake_case
- change all or at least most internal variables from camelCase to snake_case
- not set in stone in our guide yet but I intend for us to use snake_case across all getwilds pkgs
-
  • Loading branch information
sckott committed Jan 5, 2024
1 parent f932b27 commit 577f803
Show file tree
Hide file tree
Showing 80 changed files with 651 additions and 633 deletions.
32 changes: 16 additions & 16 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(cromwellAbort)
export(cromwellBackends)
export(cromwellCache)
export(cromwellCall)
export(cromwellConfig)
export(cromwellFailures)
export(cromwellGlob)
export(cromwellJobs)
export(cromwellOutputs)
export(cromwellSubmitBatch)
export(cromwellTiming)
export(cromwellValidate)
export(cromwellVersion)
export(cromwellWorkflow)
export(workflowInputs)
export(workflowOptions)
export(cromwell_abort)
export(cromwell_backends)
export(cromwell_cache)
export(cromwell_call)
export(cromwell_config)
export(cromwell_failures)
export(cromwell_glob)
export(cromwell_jobs)
export(cromwell_outputs)
export(cromwell_submit_batch)
export(cromwell_timing)
export(cromwell_validate)
export(cromwell_version)
export(cromwell_workflow)
export(workflow_inputs)
export(workflow_options)
importFrom(dplyr,as_tibble)
importFrom(dplyr,tibble)
importFrom(magrittr,"%>%")
Expand Down
14 changes: 7 additions & 7 deletions R/cromUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
#' Requires valid Cromwell server URL to be set. See [cromwellSettings]
#' @export
#' @examples \dontrun{
#' jobs <- cromwellJobs()
#' workflowOptions(jobs$workflow_id[1])
#' jobs <- cromwell_jobs()
#' workflow_options(jobs$workflow_id[1])
#' }
workflowOptions <- function(workflow_id) {
workflow_options <- function(workflow_id) {
check_url()
dplyr::as_tibble(jsonlite::fromJSON(cromwellWorkflow(workflow_id)$options))
dplyr::as_tibble(jsonlite::fromJSON(cromwell_workflow(workflow_id)$options))
}

#' Pull the workflow inputs provided for a Cromwell workflow job
#'
#' @template workflowid
#' @return Returns a data frame of the inputs for a workflow previously run
#' @author Amy Paguirigan
#' @inheritSection workflowOptions Important
#' @inheritSection workflow_options Important
#' @export
workflowInputs <- function(workflow_id) {
workflow_inputs <- function(workflow_id) {
check_url()
dplyr::as_tibble(jsonlite::fromJSON(cromwellWorkflow(workflow_id)$inputs))
dplyr::as_tibble(jsonlite::fromJSON(cromwell_workflow(workflow_id)$inputs))
}
6 changes: 3 additions & 3 deletions R/cromwellAbort.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#' @template workflowid
#' @return Returns the response from the API post
#' @author Amy Paguirigan
#' @inheritSection workflowOptions Important
#' @inheritSection workflow_options Important
#' @export
cromwellAbort <- function(workflow_id) {
cromwell_abort <- function(workflow_id) {
check_url()
crom_mssg("Aborting job in Cromwell")
httpPOST(url = make_url("api/workflows/v1", workflow_id, "abort")) %>%
http_post(url = make_url("api/workflows/v1", workflow_id, "abort")) %>%
dplyr::as_tibble()
}
6 changes: 3 additions & 3 deletions R/cromwellBackends.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#'
#' @return Cromwell backend options
#' @author Amy Paguirigan
#' @inheritSection workflowOptions Important
#' @inheritSection workflow_options Important
#' @export
cromwellBackends <- function() {
cromwell_backends <- function() {
check_url()
crom_mssg("Getting backend options from Cromwell")
all <- httpGET(make_url("api/workflows/v1/backends"))
all <- http_get(make_url("api/workflows/v1/backends"))
all$supportedBackends <- unlist(all$supportedBackends)
return(all)
}
32 changes: 16 additions & 16 deletions R/cromwellCache.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
#' workflow. NOTE: Currently does not support subworkflows well.
#' @author Amy Paguirigan
#' @autoglobal
#' @inheritSection workflowOptions Important
#' @inheritSection workflow_options Important
#' @export
cromwellCache <- function(workflow_id) {
cromwell_cache <- function(workflow_id) {
check_url()
crom_mssg(paste0(
"Querying for call caching metadata for workflow id: ",
workflow_id
))

crommetadata <-
httpGET(
http_get(
url = make_url("api/workflows/v1", workflow_id, "metadata"),
query = list(expandSubWorkflows = "false"),
as = "parsed"
Expand All @@ -26,35 +26,35 @@ cromwellCache <- function(workflow_id) {
if (length(crommetadata$calls) > 0) {
# if there are calls to be queried, continue
# we only want the calls data from the metadata for this workflow
bobCalls <- purrr::pluck(crommetadata, "calls")
bobCallMeta <-
purrr::map(bobCalls, function(callData) {
bob_calls <- purrr::pluck(crommetadata, "calls")
bob_call_meta <-
purrr::map(bob_calls, function(call_data) {
# for each of the calls in the workflow...
purrr::map_dfr(callData, function(shardData) {
purrr::map_dfr(call_data, function(shard_data) {
# and for each of the shards in that workflow...
if ("inputs" %in% names(shardData)) {
if ("inputs" %in% names(shard_data)) {
a <- purrr::keep(
shardData,
names(shardData) %in% c("callCaching", "inputs", "outputs")
shard_data,
names(shard_data) %in% c("callCaching", "inputs", "outputs")
) # select only these lists
# flatten them and make them a data frame
b <- dplyr::as_tibble(rbind(unlist(a)))
# add the shard Index associated
b$shardIndex <- shardData$shardIndex
b$shardIndex <- shard_data$shardIndex
} else {
b <- dplyr::as_tibble("shardIndex" = shardData$shardIndex)
b <- dplyr::as_tibble("shardIndex" = shard_data$shardIndex)
}
b$shardIndex <- as.character(b$shardIndex)
b$workflow_id <- workflow_id
b$executionStatus <- shardData$executionStatus
b$returnCode <- shardData$returnCode
b$jobId <- shardData$jobId
b$executionStatus <- shard_data$executionStatus
b$returnCode <- shard_data$returnCode
b$jobId <- shard_data$jobId
# then remove any data from the messy hitFailures lists
b <- dplyr::select(b, -dplyr::starts_with("callCaching.hitFailures"))
return(b)
})
})
geocache <- purrr::map_dfr(bobCallMeta, rbind, .id = "fullName")
geocache <- purrr::map_dfr(bob_call_meta, rbind, .id = "fullName")
# split fullname into workflowName and callName
geocache <- tidyr::separate(
data = geocache,
Expand Down
Loading

0 comments on commit 577f803

Please sign in to comment.