mlflow升级的方法是什么
这篇“mlflow升级的方法是什么”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“mlflow升级的方法是什么”文章吧。
升级以及准备
参照之前mlflow的搭建使用 ,我们先建立mlflow 1.4.0和mlflow 1.11.0的conda环境
假设你已经建立好了对应的conda环境,且分别为mlflow-1.4.0 和mlflow-1.11.0 则执行:
condaactivatemlflow-1.11.0
参考mlflow db upgrade ,执行
mlflowdbupgrademysql://user:passwd@host:port/db如:mlflowdbupgrademysql://root:root@localhost/mlflow
其中
名词 | 解释 |
---|
user | 数据库的用户名 |
passwd | 数据库的密码 |
host | 数据库的主机地址 |
port | 数据库的端口,如默认为3306则可以省略 |
db | 数据库的database |
如果执行成功则会看到如下输出信息:
2020/11/0210:24:50INFOmlflow.store.db.utils:UpdatingdatabasetablesINFO[alembic.runtime.migration]ContextimplMySQLImpl.INFO[alembic.runtime.migration]Willassumenon-transactionalDDL.INFO[alembic.runtime.migration]Runningupgrade2b4d017a5e9b->cfd24bdc0731,UpdaterunstatusconstraintwithkilledINFO[alembic.runtime.migration]Runningupgradecfd24bdc0731->0a8213491aaa,drop_duplicate_killed_constraintWARNI[0a8213491aaa_drop_duplicate_killed_constraint_py]Failedtodropcheckconstraint.DroppingcheckconstraintsmaynotbesupportedbyyourSQLdatabase.Exceptioncontent:(MySQLdb._exceptions.ProgrammingError)(1064,"YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenear'CHECKstatus'atline1")[SQL:ALTERTABLErunsDROPCHECKstatus](Backgroundonthiserrorat:http://sqlalche.me/e/f405)INFO[alembic.runtime.migration]Runningupgrade0a8213491aaa->728d730b5ebd,addregisteredmodeltagstableINFO[alembic.runtime.migration]Runningupgrade728d730b5ebd->27a6a02d2cf1,addmodelversiontagstableINFO[alembic.runtime.migration]Runningupgrade27a6a02d2cf1->84291f40a231,addrun_linktomodel_version
如果此时再在mlflow 1.4.0的环境下 再执行:
mlflowserver\--backend-store-urimysql://root:root@localhost/mlflow\--host0.0.0.0-p5002\--default-artifact-roots3://mlflow
就会报错:
2020/11/0210:25:41ERRORmlflow.cli:Errorinitializingbackendstore2020/11/0210:25:41ERRORmlflow.cli:Detectedout-of-datedatabaseschema(foundversion84291f40a231,butexpected2b4d017a5e9b).Takeabackupofyourdatabase,thenrun'mlflowdbupgrade<database_uri>'tomigrateyourdatabasetothelatestschema.NOTE:schemamigrationmayresultindatabasedowntime-pleaseconsultyourdatabase'sdocumentationformoredetail.Traceback(mostrecentcalllast):File"/Users/ljh/opt/miniconda3/envs/mlflow-1.4.0-dev/lib/python3.6/site-packages/mlflow/cli.py",line263,inserverinitialize_backend_stores(backend_store_uri,default_artifact_root)File"/Users/ljh/opt/miniconda3/envs/mlflow-1.4.0-dev/lib/python3.6/site-packages/mlflow/server/handlers.py",line97,ininitialize_backend_stores_get_tracking_store(backend_store_uri,default_artifact_root)File"/Users/ljh/opt/miniconda3/envs/mlflow-1.4.0-dev/lib/python3.6/site-packages/mlflow/server/handlers.py",line83,in_get_tracking_store_tracking_store=_tracking_store_registry.get_store(store_uri,artifact_root)File"/Users/ljh/opt/miniconda3/envs/mlflow-1.4.0-dev/lib/python3.6/site-packages/mlflow/tracking/_tracking_service/registry.py",line37,inget_storereturnbuilder(store_uri=store_uri,artifact_uri=artifact_uri)File"/Users/ljh/opt/miniconda3/envs/mlflow-1.4.0-dev/lib/python3.6/site-packages/mlflow/server/handlers.py",line54,in_get_sqlalchemy_storereturnSqlAlchemyStore(store_uri,artifact_uri)File"/Users/ljh/opt/miniconda3/envs/mlflow-1.4.0-dev/lib/python3.6/site-packages/mlflow/store/tracking/sqlalchemy_store.py",line99,in__init__mlflow.store.db.utils._verify_schema(self.engine)File"/Users/ljh/opt/miniconda3/envs/mlflow-1.4.0-dev/lib/python3.6/site-packages/mlflow/store/db/utils.py",line52,in_verify_schema"moredetail."%(current_rev,head_revision))mlflow.exceptions.MlflowException:Detectedout-of-datedatabaseschema(foundversion84291f40a231,butexpected2b4d017a5e9b).Takeabackupofyourdatabase,thenrun'mlflowdbupgrade<database_uri>'tomigrateyourdatabasetothelatestschema.NOTE:schemamigrationmayresultindatabasedowntime-pleaseconsultyourdatabase'sdocumentationformoredetail.
这说明升级成功
此时再在mlflow 1.11.0的conda环境下执行:
mlflowserver\--backend-store-urimysql://root:root@localhost/mlflow\--host0.0.0.0-p5003\--default-artifact-roots3://mlflow
就能正常的看到页面,这样mlflow 从1.4.0到1.11.0的升级就完成了
注意事项
如果是线上操作,则先备份数据库,因为该升级不一定能保证升级成功,如升级失败,直接从备份数据库恢复或者参照失败处理进行处理
以上就是关于“mlflow升级的方法是什么”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。