MLflow CLI
$ mlflow 基金会 中风险mlflow CLI 用于启动实验追踪服务(mlflow server)、管理实验与运行记录(mlflow experiments、runs)以及本地模型服务与容器打包(mlflow models serve、build-docker)。注意 server 与 models serve 会作为常驻 HTTP 服务运行。
pip install mlflow 在 Shell 中使用 mlflow experiments / mlflow runs 管理实验;启动 mlflow server 或 models serve 必须置于后台守护,避免阻塞。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
mlflow runs describe 可输出 JSON 且管理命令非交互,但 experiments 列表缺乏 --json,且 server/models serve 会阻塞为守护进程。
runs describeoutputs JSON;serverandmodels serveare blocking daemons
默认安全写入本地 ./mlruns,但在 models serve 中加载不可信的序列化模型存在 Python 反序列化执行风险。
- Model serving deserializes Python artifacts; defaults to local
./mlruns
可通过 pip/uvx 安装,但 mlflow 的 Python 依赖树较庞大(含 Flask/Gunicorn/SQLAlchemy 等)。
- Heavy Python dependency footprint via PyPI
覆盖追踪服务、实验 CRUD 与模型镜像打包(build-docker),但复杂指标检索更依赖 SDK 或 REST API。
- Unified tracking server, experiment management, and model serving CLI
LF AI & Data / Databricks 维护的开源项目(mlflow/mlflow),Apache-2.0 协议。
- Official
mlflow/mlflowrepository
mlflow.org/docs/latest/cli.html 官方文档清晰。
- Official CLI docs at mlflow.org/docs/latest/cli.html
安全边界、鉴权与放权指南
读取 MLFLOW_TRACKING_URI、MLFLOW_TRACKING_TOKEN 或 ~/.mlflow/ 与 Databricks 配置文件;默认无鉴权写入本地 ./mlruns。
免费开源(Apache-2.0 协议)Python CLI。
# MLflow CLI Agent Rules - Never run `mlflow server` or `mlflow models serve` synchronously in agent shells—they start blocking HTTP servers. - Confirm `MLFLOW_TRACKING_URI` before creating/deleting experiments so you do not write stray `./mlruns` folders or mutate shared servers.
Agent 高频安全命令配方
只读查询(安全推荐)
mlflow runs describe --run-id <RUN_ID>
打印指定 Run ID 的详细 JSON 元数据、指标与超参数。
受控写入与预演
mlflow experiments create --experiment-name eval-suite-v1
在当前配置的 MLFLOW_TRACKING_URI 或本地 ./mlruns 中注册新实验。
核心优势
- +
mlflow runs describe --run-id直接输出结构化 JSON 指标与参数。 - + 开箱即用的本地
./mlruns追踪与一键models build-docker打包。
注意事项与踩坑点
- !
mlflow server与mlflow models serve会作为前台服务永久阻塞。 - ! Python 依赖包体积较大,且各子命令对 JSON 输出的支持不够统一。