def test_uri_types(): assert is_local_uri("mlruns") assert is_local_uri("./mlruns") assert is_local_uri("file:///foo/mlruns") assert is_local_uri("file:foo/mlruns") assert not is_local_uri("https://whatever") assert not is_local_uri("http://whatever") assert not is_local_uri("databricks") assert not is_local_uri("databricks:whatever") assert not is_local_uri("databricks://whatever") assert is_databricks_uri("databricks") assert is_databricks_uri("databricks:whatever") assert is_databricks_uri("databricks://whatever") assert not is_databricks_uri("mlruns") assert not is_databricks_uri("http://whatever") assert is_http_uri("http://whatever") assert is_http_uri("https://whatever") assert not is_http_uri("file://whatever") assert not is_http_uri("databricks://whatever") assert not is_http_uri("mlruns")
def before_run_validations(tracking_uri, backend_config): """Validations to perform before running a project on Databricks.""" if backend_config is None: raise ExecutionException("Backend spec must be provided when launching MLflow project " "runs on Databricks.") if not is_databricks_uri(tracking_uri) and \ not is_http_uri(tracking_uri): raise ExecutionException( "When running on Databricks, the MLflow tracking URI must be of the form " "'databricks' or 'databricks://profile', or a remote HTTP URI accessible to both the " "current client and code running on Databricks. Got local tracking URI %s. " "Please specify a valid tracking URI via mlflow.set_tracking_uri or by setting the " "MLFLOW_TRACKING_URI environment variable." % tracking_uri)
def before_run_validations(tracking_uri, backend_config): """Validations to perform before running a project on Databricks.""" if backend_config is None: raise ExecutionException( "Backend spec must be provided when launching MLflow project " "runs on Databricks.") elif "existing_cluster_id" in backend_config: raise MlflowException(message=( "MLflow Project runs on Databricks must provide a *new cluster* specification." " Project execution against existing clusters is not currently supported. For more" " information, see https://mlflow.org/docs/latest/projects.html" "#run-an-mlflow-project-on-databricks"), error_code=INVALID_PARAMETER_VALUE) if not is_databricks_uri(tracking_uri) and \ not is_http_uri(tracking_uri): raise ExecutionException( "When running on Databricks, the MLflow tracking URI must be of the form " "'databricks' or 'databricks://profile', or a remote HTTP URI accessible to both the " "current client and code running on Databricks. Got local tracking URI %s. " "Please specify a valid tracking URI via mlflow.set_tracking_uri or by setting the " "MLFLOW_TRACKING_URI environment variable." % tracking_uri)