cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Can we delte Mlflow experiment

User16826994223
Honored Contributor III

I am using ML flow and my need of the hour is to delete an experiment and want to create another experiment with same run.

client = MlflowClient(tracking_uri=server)
client.delete_experiment(1)

This deletes the

experiment, but when I run a new experiment with the same name as the one I just deleted, it will return this error:

You can restore the experiment, or permanently delete the experiment to create a new one

1 ACCEPTED SOLUTION

Accepted Solutions

User16826994223
Honored Contributor III

I think this is the limitation and now we have no way to do this via the UI or CLI

The way to do it depends on the type of backend file store that you are using.

If you are using file store it is easy as the deleted experiment is stored in the trash folder

.t
 
rm -rf mlruns/.trash/*

View solution in original post

2 REPLIES 2

User16826994223
Honored Contributor III

I think this is the limitation and now we have no way to do this via the UI or CLI

The way to do it depends on the type of backend file store that you are using.

If you are using file store it is easy as the deleted experiment is stored in the trash folder

.t
 
rm -rf mlruns/.trash/*

User16826994223
Honored Contributor III

SQL Database:

This is more tricky, as there are dependencies that need to be deleted. I am using MySQL, and these commands work for me:

USE mlflow_db;  # the name of your database
DELETE FROM experiment_tags WHERE experiment_id=ANY(
    SELECT experiment_id FROM experiments where lifecycle_stage="deleted"
);
DELETE FROM latest_metrics WHERE run_uuid=ANY(
    SELECT run_uuid FROM runs WHERE experiment_id=ANY(
        SELECT experiment_id FROM experiments where lifecycle_stage="deleted"
    )
);
DELETE FROM metrics WHERE run_uuid=ANY(
    SELECT run_uuid FROM runs WHERE experiment_id=ANY(
        SELECT experiment_id FROM experiments where lifecycle_stage="deleted"
    )
);
DELETE FROM tags WHERE run_uuid=ANY(
    SELECT run_uuid FROM runs WHERE experiment_id=ANY(
        SELECT experiment_id FROM experiments where lifecycle_stage="deleted"
    )
);
DELETE FROM runs WHERE experiment_id=ANY(
    SELECT experiment_id FROM experiments where lifecycle_stage="deleted"
);
DELETE FROM experiments where lifecycle_stage="deleted";

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group