【问题标题】:How to safely shutdown mlflow ui?如何安全关闭 mlflow ui?
【发布时间】:2020-06-17 05:55:54
【问题描述】:

在远程服务器上运行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

【问题讨论】:

    标签: python r machine-learning mlflow


    【解决方案1】:

    我最近在远程服务器调用mlflow ui时也遇到了类似的问题。用于退出的命令行中的Ctrl + C 通常有效。 但是,如果没有,使用pkill -f gunicorn 可以解决我的问题。 注意,您也可以使用ps -A | grep gunicorn先查找进程,然后手动使用kill [PID]。 类似的问题似乎已经在here 讨论过一次。

    【讨论】:

      【解决方案2】:

      默认情况下,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.
      
      

      【讨论】:

      • 感谢您的回复,对我迟到的回复感到抱歉。这有效 - 并且可能是比 pkill 选项更好的解决方法。但是旧进程仍在运行...
      【解决方案3】:

      如果您无法连接到已经在运行的 mlflow,您可以运行以下命令来终止 UI 以生成另一个:

      lsof -i :5000
      

      此外,使用 MLFlow,您可以使用-port 分配一个端口号,如果您需要启动多个 UI,您想防止混淆;例如一个用于跟踪,一个用于服务等。默认情况下,服务器在端口 5000 上运行。如果该端口已被使用,请使用 –port 选项指定不同的端口:

      mlflow models serve -m runs:/<RUN_ID>/model --port 1234
      

      【讨论】:

        【解决方案4】:

        快速解决方案:

        直接杀死进程

        fuser -k 5000/tcp
        

        命令语法

        fuser -k <port>/tcp
        

        奖励: fuser 5000/tcp 将打印绑定在该端口上的进程的 PID。

        注意: 仅适用于 Linux。 更普遍的是使用 lsof -i4(或 6 用于 IPv6)。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-12-11
          • 2019-04-05
          • 2014-08-14
          • 1970-01-01
          • 2010-12-20
          • 2012-05-01
          相关资源
          最近更新 更多