R/timming.R

Defines functions timming.WorkflowIdAndStatus timming.character timming

Documented in timming timming.character timming.WorkflowIdAndStatus

#' Get a visual diagram of a running workflow
#'
#' It will open a web page containing a javascript file which will render a
#' Gantt chart for the requested workflow. The bars in the chart represent start
#' and end times for individual task invocations.
#'
#' @param x Cromwell API endpoint of \code{WorkflowIdAndStatus} object.
#' @param ... not used
#'
#' @return \code{WorkflowOutputs} object containing outputs and id.
#'
#' @examples
#' \dontrun{
#' host <- "http://localhost:8000"
#' workflow <- system.file("extdata/workflow.wdl", package = "CromwellClient")
#' inputs <- system.file("extdata/inputs.json", package = "CromwellClient")
#' job <- submit(host, workflow, inputs)
#' timming(job)
#' }
#'
#' @rdname timming
#' @export
timming <- function(x, ...)
{
	UseMethod("timming", x)
}

#' Title
#'
#' @param id A workflow ID.
#' @param version Cromwell API Version.
#'
#' @rdname timming
#' @export
timming.character <- function(x, id, version = "v1", ...)
{
	url <- file.path(x, "api/workflows", version, id, "timing")
	viewer <- getOption("viewer")
	if (!is.null(viewer)) {
		viewer(url)
	} else {
  		utils::browseURL(url)
	}
}

#' @rdname timming
#' @export
timming.WorkflowIdAndStatus <- function(x, ...)
{
	timming(x$host, id = x$id, x$version)
}
labbcb/CromwellClient documentation built on Aug. 16, 2020, 9:11 p.m.