不幸的是,目前似乎无法通过 UI 或 CLI 执行此操作:-/
执行此操作的方法取决于您使用的后端文件存储的类型。
文件存储:
如果您使用文件系统作为存储机制(默认),那么这很容易。“已删除”的实验被移动到一个.trash
文件夹中。你只需要清除它:
rm -rf mlruns/.trash/*
截至文档的当前版本(1.7.2),他们说:
建议使用 cron 作业或替代工作流机制来清除.trash
文件夹。
SQL 数据库:
这更棘手,因为需要删除依赖项。我正在使用 MySQL,这些命令对我有用:
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";