[英]How to safely shutdown mlflow ui?
在远程服务器上运行mlflow ui
后,我无法再次重新打开mlflow ui
。
一种解决方法是使用pkill -u MyUserName
杀死服务器中的所有进程。
否则我会收到以下错误:
[INFO] Starting gunicorn 20.0.4
[ERROR] Connection in use: ('127.0.0.1', 5000)
[ERROR] Retrying in 1 second.
...
Running the mlflow server failed. Please see ther logs above for details.
我理解错误但我不明白:
1.关闭mlflow ui
的正确方法是什么
2.如何识别mlflow ui
进程以便只杀死该进程而不使用pkill
目前我关闭浏览器或使用 ctrl+C
我最近在远程服务器中调用mlflow ui
时也遇到了类似的问题。 命令行中的Ctrl + C
退出通常有效。 但是,如果没有,使用pkill -f gunicorn
可以解决我的问题。 注意,你也可以使用ps -A | grep gunicorn
ps -A | grep gunicorn
首先找到进程并手动kill [PID]
。 类似的问题似乎已经在这里讨论过一次。
如果您无法连接到已经在运行的 mlflow,您可以运行以下命令来终止 UI 以生成另一个:
lsof -i :5000
此外,使用 MLFlow,您可以使用-port
分配一个端口号,如果您需要启动多个 UI,您希望防止混淆; 例如,一个用于跟踪,一个用于服务等。默认情况下,服务器在端口 5000 上运行。如果该端口已被使用,请使用–port
选项指定不同的端口:
mlflow models serve -m runs:/<RUN_ID>/model --port 1234
2022 年 6 月更新:您可以在此处将--port
标志添加到此 cmd 以正确设置 MLFlow: 如何开始使用 MLflow SQL 存储而不是文件系统存储?
简单地杀死进程
fuser -k 5000/tcp
命令语法
fuser -k <port>/tcp
奖励: fuser 5000/tcp 将打印绑定在该端口上的进程的 PID。
注意:仅适用于 Linux。 更普遍的是使用 lsof -i4 (或 6 用于 IPv6)。
我在mlflow ui
命令上遇到错误。
错误是
[2022-04-19 10:48:02 -0400] [89933] [INFO] Starting gunicorn 20.1.0
[2022-04-19 10:48:02 -0400] [89933] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2022-04-19 10:48:02 -0400] [89933] [ERROR] Retrying in 1 second.
[2022-04-19 10:48:03 -0400] [89933] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2022-04-19 10:48:03 -0400] [89933] [ERROR] Retrying in 1 second.
[2022-04-19 10:48:04 -0400] [89933] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2022-04-19 10:48:04 -0400] [89933] [ERROR] Retrying in 1 second.
[2022-04-19 10:48:05 -0400] [89933] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2022-04-19 10:48:05 -0400] [89933] [ERROR] Retrying in 1 second.
[2022-04-19 10:48:06 -0400] [89933] [ERROR] Connection in use: ('127.0.0.1', 5000)
[2022-04-19 10:48:06 -0400] [89933] [ERROR] Retrying in 1 second.
[2022-04-19 10:48:07 -0400] [89933] [ERROR] Can't connect to ('127.0.0.1', 5000)
对我有用的解决方案:
第 1 步:获取进程 ID
ps -A | grep gunicorn
20734 ?? 0:39.17 /usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python /Users/XXX/env/bin/gunicorn - b 127.0.0.1:5000 -w 1 mlflow.server:app
第 2 步:从最后一个输出中获取PID ,并使用该 PID 终止正在使用该端口的进程
kill 20734
默认情况下,mlflow UI 绑定到端口 5000,因此后续调用将导致端口繁忙错误。
您可以启动多个 MLflow ui 并提供不同的端口号:
Usage: mlflow ui [OPTIONS]
Launch the MLflow tracking UI for local viewing of run results. To launch
a production server, use the "mlflow server" command instead.
The UI will be visible at http://localhost:5000 by default, and only
accept connections from the local machine. To let the UI server accept
connections from other machines, you will need to pass ``--host 0.0.0.0``
to listen on all network interfaces (or a specific interface address).
Options:
--backend-store-uri PATH URI to which to persist experiment and run
data. Acceptable URIs are SQLAlchemy-compatible
database connection strings (e.g.
'sqlite:///path/to/file.db') or local
filesystem URIs (e.g.
'file:///absolute/path/to/directory'). By
default, data will be logged to the ./mlruns
directory.
--default-artifact-root URI Path to local directory to store artifacts, for
new experiments. Note that this flag does not
impact already-created experiments. Default:
./mlruns
-p, --port INTEGER The port to listen on (default: 5000).
-h, --host HOST The network address to listen on (default:
127.0.0.1). Use 0.0.0.0 to bind to all
addresses if you want to access the tracking
server from other machines.
--help Show this message and exit.```
Try it and see what happens.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.