5

I want to save the parameters and metrics gotten from mlflow into an s3 bucket. Usually I get these from setting the tracking_uri in mlflow and that saves it on a server but I can't have a server in this case(was told no) and just want to store my parameters and metrics on the s3 bucket in the same manner as it would using the tracking_uri.

I can store the artifacts on the s3 bucket without issue but not the params/metrics.

Here is some code:

def mlflow_testing():
    
    tracking_uri =  "s3://bucket_name/mlflow/",
    experiment_name = "test",
    artifact_uri= "s3://bucket_name/mlflow/"
    
    mlflow.set_tracking_uri(tracking_uri)
    mlflow.create_experiment(experiment_name, artifact_uri)
    mlflow.set_experiment(experiment_name)
    
    with mlflow.start_run() as run:
        mlflow.log_param("test1", 0)
        mlflow.log_metric("test2", 1)
    
        with open("test.txt", "w") as f:
            f.write("this is an artifact")
    
        mlflow.log_artifact("test.txt")
        mlflow.end_run()

This is capable of storing the artifact text file on the s3 bucket(so long as I make the uri a local path like local_data/mlflow instead of the s3 bucket).

Setting the s3 bucket for the tracking_uri results in this error:

mlflow.tracking.registry.UnsupportedModelRegistryStoreURIException:
Model registry functionality is unavailable; got unsupported URI
's3://bucket_location/mlflow/' for model registry data storage.
Supported URI schemes are: ['', 'file', 'databricks', 'http', 'https',
'postgresql', 'mysql', 'sqlite', 'mssql']. See
https://www.mlflow.org/docs/latest/tracking.html#storage for how to
run an MLflow server against one of the supported backend storage
locations.

Does anyone have advice on getting around this without setting up a server? I just want those metrics and params.

1 Answers1

3

S3 is not a supported backend for MLFlow metrics and parameters. It is a supported backend for artifacts. https://www.mlflow.org/docs/latest/tracking.html#where-runs-are-recorded

You could write your metrics/parameters locally and upload it to S3 on a schedule as a backup if you'd like.

Kirit Thadaka
  • 429
  • 2
  • 5