From b143dbf28ff52d6c8e2685f84e0e8287a707e720 Mon Sep 17 00:00:00 2001 From: Amy Paguirigan Date: Mon, 6 Dec 2021 14:58:52 -0800 Subject: [PATCH] repair when your first job fails --- DESCRIPTION | 2 +- R/cromwellJobs.R | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3489d6f..ed82bd9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: fh.wdlR Title: Convenience Tools for Managing WDL Workflows via Cromwell -Version: 2.0.0 +Version: 2.0.1 Authors@R: person(given = "Amy", family = "Paguirigan", diff --git a/R/cromwellJobs.R b/R/cromwellJobs.R index 8469ef8..0f0fb97 100644 --- a/R/cromwellJobs.R +++ b/R/cromwellJobs.R @@ -38,8 +38,9 @@ cromwellJobs <- function(days = 1, workflowName = NULL, workflowStatus = NULL, ) ))$results cromTable <- purrr::map_dfr(cromDat, dplyr::bind_rows) - if (nrow(cromTable) > 0) { - cromTable <- dplyr::rename(cromTable, "workflow_id" = "id", "workflowName" = "name") + if (nrow(cromTable) > 0 & "id" %in% names(cromTable)) { + cromTable <- dplyr::rename(cromTable, "workflow_id" = "id") + if ("name" %in% colnames(cromTable)) {cromTable <- dplyr::rename(cromTable, "workflowName" = "name")} cromTable$submission <- lubridate::with_tz(lubridate::ymd_hms(cromTable$submission), tzone = "US/Pacific") if ("start" %in% colnames(cromTable) == T) { cromTable$start <- lubridate::with_tz(lubridate::ymd_hms(cromTable$start), tzone = "US/Pacific") } @@ -52,7 +53,7 @@ cromwellJobs <- function(days = 1, workflowName = NULL, workflowStatus = NULL, } else { cromTable <- data.frame("workflow_id" = NA, stringsAsFactors = F) } - convertToChar <- c("submission", "start", "end", "workflwoDuration") + convertToChar <- c("submission", "start", "end", "workflowDuration") theseCols <- colnames(cromTable) %in% convertToChar cromTable[theseCols] <- lapply(cromTable[theseCols], as.character) return(cromTable)