Ejemplo n.º 1
0
def _before_run_validations(tracking_uri, cluster_spec):
    """Validations to perform before running a project on Databricks."""
    _check_databricks_auth_available()
    if cluster_spec is None:
        raise ExecutionException("Cluster spec must be provided when launching MLflow project runs "
                                 "on Databricks.")
    if tracking.is_local_uri(tracking_uri):
        raise ExecutionException(
            "When running on Databricks, the MLflow tracking URI must be set to a remote URI "
            "accessible to both the current client and code running on Databricks. Got local "
            "tracking URI %s." % tracking_uri)
Ejemplo n.º 2
0
def _create_databricks_run(tracking_uri, experiment_id, source_name,
                           source_version, entry_point_name):
    """
    Make an API request to the specified tracking server to create a new run with the specified
    attributes. Return an ``ActiveRun`` that can be used to query the tracking server for the run's
    status or log metrics/params for the run.
    """
    if tracking.is_local_uri(tracking_uri):
        eprint(
            "WARNING: MLflow tracking URI is set to a local URI (%s), so results from "
            "Databricks will not be logged permanently." % tracking_uri)
    return tracking._create_run(experiment_id=experiment_id,
                                source_name=source_name,
                                source_version=source_version,
                                entry_point_name=entry_point_name,
                                source_type=SourceType.PROJECT)
Ejemplo n.º 3
0
def test_uri_types():
    assert tracking.is_local_uri("mlruns")
    assert tracking.is_local_uri("./mlruns")
    assert tracking.is_local_uri("file:///foo/mlruns")
    assert not tracking.is_local_uri("https://whatever")
    assert not tracking.is_local_uri("http://whatever")
    assert not tracking.is_local_uri("databricks")
    assert not tracking.is_local_uri("databricks:whatever")
    assert not tracking.is_local_uri("databricks://whatever")

    assert tracking._is_databricks_uri("databricks")
    assert tracking._is_databricks_uri("databricks:whatever")
    assert tracking._is_databricks_uri("databricks://whatever")
    assert not tracking._is_databricks_uri("mlruns")
    assert not tracking._is_databricks_uri("http://whatever")

    assert tracking._is_http_uri("http://whatever")
    assert tracking._is_http_uri("https://whatever")
    assert not tracking._is_http_uri("file://whatever")
    assert not tracking._is_http_uri("databricks://whatever")
    assert not tracking._is_http_uri("mlruns")
Ejemplo n.º 4
0
def _create_databricks_run(tracking_uri, experiment_id, source_name,
                           source_version, entry_point_name):
    """
    Makes an API request to the specified tracking server to create a new run with the specified
    attributes. Returns an `ActiveRun` that can be used to query the tracking server for the run's
    status or log metrics/params for the run.
    """
    if tracking.is_local_uri(tracking_uri):
        # TODO: we'll actually use the Databricks deployment's tracking URI here in the future
        eprint(
            "WARNING: MLflow tracking URI is set to a local URI (%s), so results from "
            "Databricks will not be logged permanently." % tracking_uri)
        return None
    else:
        # Assume non-local tracking URIs are accessible from Databricks (won't work for e.g.
        # localhost)
        return tracking._create_run(experiment_id=experiment_id,
                                    source_name=source_name,
                                    source_version=source_version,
                                    entry_point_name=entry_point_name,
                                    source_type=SourceType.PROJECT)