MLFlow运行未记录在数据库和工件位置中

时间:2019-05-13 21:26:32

标签: mlflow

设置号 操作系统:ubuntu 18.04 LTS

适用于Linux(x86_64)的MySQL版本14.14 Distrib 5.7.26,使用EditLine包装器

(还安装了以下依赖项: sudo apt-get安装libmysqlclient-dev sudo pip3安装mysqlclient 康达安装-c anaconda sqlalchemy )

Python 3.7.3

我遵循的步骤

在那里创建的数据库名为#mlflow_tracker

现在我尝试以“

”启动MlFlow服务器
(base) asraful@asraful:~$ conda activate my_env

(my_env) asraful@asraful:~$ mlflow server  --backend-store-uri "mysql://mlflow:password@localhost:3306/mlflow_tracker"  --default-artifact-root /mnt/mlflow_bucket  --host 0.0.0.0

这将输出显示为#

[2019-05-14 01:49:56 +0600] [9976] [INFO] Starting gunicorn 19.9.0
[2019-05-14 01:49:56 +0600] [9976] [INFO] Listening at: http://0.0.0.0:5000 (9976)
[2019-05-14 01:49:56 +0600] [9976] [INFO] Using worker: sync
[2019-05-14 01:49:56 +0600] [9979] [INFO] Booting worker with pid: 9979
[2019-05-14 01:49:56 +0600] [9980] [INFO] Booting worker with pid: 9980
[2019-05-14 01:49:56 +0600] [9981] [INFO] Booting worker with pid: 9981
[2019-05-14 01:49:56 +0600] [9989] [INFO] Booting worker with pid: 9989

因此,我尝试使用波纹管脚本#

进行一次测试
import os
from mlflow import log_metric, log_param, log_artifact

if __name__ == "__main__":
    # Log a parameter (key-value pair)
    log_param("param1", 5)

    # Log a metric; metrics can be updated throughout the run
    log_metric("foo", 1)
    log_metric("foo", 2)
    log_metric("foo", 3)

    # Log an artifact (output file)
    with open("output.txt", "w") as f:
        f.write("Hello world!")
    log_artifact("output.txt")

此代码运行完美。

  

因此,我的期望是:

指标将保存在mlflow_tracker数据库中。 其他数据将保存在/ mnt / mlflow_bucket

我将 backend-store-uri配置为:mlflow_tracker数据库 还有 default-artifact-root:/ mnt / mlflow_bucket

  

但是遇到#

问题

所有指标和元数据都在默认mlflow位置下写入: /〜/ mlFlow / mlruns / 0

而且,如果我尝试从浏览器访问mlflow ui,则获得了默认图像和波纹管堆栈跟踪。

Traceback (most recent call last):
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2262, in _wrap_pool_connect
return fn()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 363, in connect
return _ConnectionFairy._checkout(self)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 760, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 492, in checkout
rec = pool._do_get()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 139, in _do_get
self._dec_overflow()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 129, in reraise
raise value
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 136, in _do_get
return self._create_connection()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 308, in _create_connection
return _ConnectionRecord(self)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 437, in __init__
self.__connect(first_connect_check=True)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 639, in __connect
connection = pool._invoke_creator(self)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
return dialect.connect(*cargs, **cparams)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 453, in connect
return self.dbapi.connect(*cargs, **cparams)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
return Connection(*args, **kwargs)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/MySQLdb/connections.py", line 164, in __init__
super(Connection, self).__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/mlflow/server/handlers.py", line 81, in wrapper
return func(*args, **kwargs)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/mlflow/server/handlers.py", line 326, in _list_experiments
experiment_entities = _get_store().list_experiments(request_message.view_type)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/mlflow/server/handlers.py", line 35, in _get_store
return SqlAlchemyStore(store_dir, artifact_root)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/mlflow/store/sqlalchemy_store.py", line 58, in __init__
Base.metadata.create_all(self.engine)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/sql/schema.py", line 4287, in create_all
ddl.SchemaGenerator, self, checkfirst=checkfirst, tables=tables
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2032, in _run_visitor
with self._optional_conn_ctx_manager(connection) as conn:
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2024, in _optional_conn_ctx_manager
with self._contextual_connect() as conn:
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2226, in _contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2266, in _wrap_pool_connect
e, dialect, self
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1536, in _handle_dbapi_exception_noconnection
util.raise_from_cause(sqlalchemy_exception, exc_info)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 128, in reraise
raise value.with_traceback(tb)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 2262, in _wrap_pool_connect
return fn()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 363, in connect
return _ConnectionFairy._checkout(self)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 760, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 492, in checkout
rec = pool._do_get()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 139, in _do_get
self._dec_overflow()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 129, in reraise
raise value
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/impl.py", line 136, in _do_get
return self._create_connection()
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 308, in _create_connection
return _ConnectionRecord(self)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 437, in __init__
self.__connect(first_connect_check=True)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/pool/base.py", line 639, in __connect
connection = pool._invoke_creator(self)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
return dialect.connect(*cargs, **cparams)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 453, in connect
return self.dbapi.connect(*cargs, **cparams)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/MySQLdb/__init__.py", line 84, in Connect
return Connection(*args, **kwargs)
File "/home/asraful/anaconda3/envs/my_env/lib/python3.7/site-packages/MySQLdb/connections.py", line 164, in __init__
super(Connection, self).__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (2002, "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)")
(Background on this error at: http://sqlalche.me/e/e3q8)

我的问题是:

我在这里缺少什么?对此可能有什么解决方案?

0 个答案:

没有答案