构建ELyra私有镜像的想法

299 阅读1分钟

已经解决的ELyra存在的问题:

Generic component execution fails due to AttributeError: module 'packaging.version' has no attribute 'LegacyVersion'

10.png

在最新版本的ELyra已经解决了该问题:

11.png

因此,在构建Elyra私有镜像时,请采用最新版本。

目前使用Elyra的两个主要问题:

在Kubeflow中,由于每个组件的运行环境都是独立的(可以视为不同的容器),因此,Elyra在运行管道的过程中,每次启动一个组件时,都会进行如下操作:

1.png

主要有以下几个步骤:

2.png

  1. raw.githubusercontent.com 下载 bootstrapper.py
sh -c "echo 'Downloading https://raw.githubusercontent.com/elyra-ai/elyra/v3.14.1/elyra/kfp/bootstrapper.py' 
curl --fail -H 'Cache-Control: no-cache' -L https://raw.githubusercontent.com/elyra-ai/elyra/v3.14.1/elyra/kfp/bootstrapper.py --output bootstrapper.py"
  1. 同上,从 raw.githubusercontent.com 下载 requirements-elyra.txt

  2. 同上,从 raw.githubusercontent.com 下载 requirements-elyra-py37.txt

  3. 执行 pip install 命令,安装所需包:

sh -c "python3 -m pip install packaging && python3 -m pip freeze > requirements-current.txt
  1. 执行 bootstrapper.py
python3 bootstrapper.py 

在实际执行时, 容易发生两个问题:

  1. 在下载bootstrapper.py ,requirements-elyra.txt,requirements-elyra-py37.txt时,得从 raw.githubusercontent.com(即github)实时下载,易发生网断的情况; 建议直接将这几个文件打包入镜像,或者将raw.githubusercontent.com改至本地;

正常下载成功时输出Log:

4.png

下载失败时输出Log: 5.png

:只要在执行脚本代码前发生报错(从github下载文件,pip install所需包等),报错的最后两行都是:"cannot save artfact ..." 所以这两行报错没什么参考意义...

  1. 在pip install 所需包时,易发生网络问题;

6.png

7.png

如图,在执行pip install包时,网络中断了...

仔细看Log,可以发现,它pip install 的包正是requirements-elyra.txt里的包:

8.png

9.png

建议pip install -i 清华源;

ELyra源码中关于构建镜像的部分

Elyra 源码地址:

elyra-ai/elyra: Elyra extends JupyterLab with an AI centric approach. (github.com)

关于构建镜像的部分:

elyra/etc/docker at main · elyra-ai/elyra (github.com)

12.png

13.png

注意采用最新版本;

可添加自定义Python包。