R/tracking-ui.R

Defines functions mlflow_ui.NULL mlflow_ui.mlflow_client mlflow_ui mlflow_view_url

Documented in mlflow_ui

#' @importFrom utils browseURL
mlflow_view_url <- function(url) {
  getOption("page_viewer", browseURL)(url)

  invisible(url)
}

#' Run MLflow User Interface
#'
#' Launches the MLflow user interface.
#'
#' @examples
#' \dontrun{
#' library(mlflow)
#' install_mlflow()
#'
#' # launch mlflow ui locally
#' mlflow_ui()
#'
#' # launch mlflow ui for existing mlflow server
#' mlflow_set_tracking_uri("http://tracking-server:5000")
#' mlflow_ui()
#' }
#'
#' @template roxlate-client
#' @param ... Optional arguments passed to `mlflow_server()` when `x` is a path to a file store.
#' @export
mlflow_ui <- function(client, ...) {
  UseMethod("mlflow_ui")
}

#' @export
mlflow_ui.mlflow_client <- function(client, ...) {
  mlflow_view_url(client$get_host_creds()$host)
}

#' @export
mlflow_ui.NULL <- function(client, ...) {
  client <- mlflow_client()
  mlflow_ui(client)
}

Try the mlflow package in your browser

Any scripts or data that you put into this service are public.

mlflow documentation built on Sept. 6, 2021, 9:06 a.m.