cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
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";

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.