OpenYuanrong源码编译教程-20251111

OpenYuanrong 是 OpenEuler 社区最近刚开源的一个分布式计算引擎,目前还没有发布正式版本。该项目主要分为三个部分:runtime(多语言运行时),datasystem(数据系统),functionsystem(函数系统)

目前编译适配和部署文档相对都比较潦草,本文尝试以官方教程为基础补充一些编译过程中的操作细节。该项目整体虽然是C++作为主要编程语言开发的,但是并没有使用 makefile 来组织整个项目的编译过程,其中的遍地开花的shell脚本令人眼花缭乱。

获取项目源码

创建一个空的文件夹用于存放项目源码,代码clone后建议修改代码权限以避免存在root权限的文件。

mkdir ~/openyuanrong
git clone -b master https://gitee.com/openeuler/yuanrong-functionsystem.git  openyuanrong/yuanrong-functionsystem
git clone -b master https://gitee.com/openeuler/yuanrong-datasystem.git  openyuanrong/yuanrong-datasystem
git clone -b master https://gitee.com/openeuler/yuanrong-runtime.git  openyuanrong/yuanrong-runtime
git clone -b master https://gitee.com/openeuler/ray-adapter.git  openyuanrong/ray-adapter
chown -R 1000:1000 openyuanrong

下载代码后目录结构如下

$ tree -L 1 openyuanrong/
openyuanrong/
├── ray-adapter
├── yuanrong-datasystem
├── yuanrong-functionsystem
└── yuanrong-runtime

4 directories, 0 files

准备编译环境

因为 OpenYuanrong 是OpenEuler社区的开源软件,所以目前貌似只能支持在OpenEuler系统上编译该软件,同时还强制使用特定的操作系统版本,依赖特定的软件版本,存在较为复杂的耦合关系。

本文推荐在容器镜像中编译该软件,避免大量安装依赖的过程中污染系统的运行环境。

此处推荐使用容器镜像:openeuler/openeuler:22.03 其他版本的系统镜像容易出现版本不兼容。下载软件编译镜像,通过绑定文件夹的形式启动容器,同时建议以UID=1000的用户权限启动容器。

$ docker pull openeuler/openeuler:22.03
$ docker run -it --rm \
  --name make-yuanrong \
  --hostname make-yuanrong \
  -w /home/yuanrong \
  -u yuanrong \
  -v $(pwd)/openyuanrong:/home/yuanrong/openyuanrong \
  openeuler/openeuler:22.03 /bin/bash

编译OpenYuanrong

编译yuanrong-dayasystem数据系统

进入数据系统的文件夹中安装编译依赖,此处需要保持良好的网络链接,无需连接国际互联网。

$ cd  openyuanrong/yuanrong-datasystem
$ bash install_tools.sh

安装完成时会有如下提示:

==========================================
Tool                 Version
------------------------------------------
Java                 1.8.0_382
Maven                3.9.11
Go                   go1.21.4
Bazel                6.5.0
Python 3.9           3.9.11
Python 3.10          3.10.2
Python 3.11          3.11.4
Ninja                OK (via ninja-build)
protoc               3.14.0
CMake                3.22.0
GCC                  10.3.1
glibc                2.34
Doxygen              1.9.2
==========================================
Build environment is ready.
Run: source /etc/profile.d/*.sh to load in current shell.

随后启动数据系统的编译(在哪个目录下启动这个脚本都可以)

bash openyuanrong/yuanrong-datasystem/build.sh -X off

编译完成后可以看到如下编译产物

$ tree openyuanrong/yuanrong-datasystem/output/
openyuanrong/yuanrong-datasystem/output/
├── openyuanrong_datasystem-0.5.0-cp310-cp310-manylinux_2_34_x86_64.whl
└── yr-datasystem-v0.5.0.tar.gz

0 directories, 2 files

没有指定版本号时编译脚本自动使用了0.5.0版本号,不知道从哪获得的也是非常特色了。

编译yuanrong-functionsystem函数系统

进入函数系统的文件夹中安装编译依赖,此处需要保持良好的网络链接,无需连接国际互联网。

$ cd  openyuanrong/yuanrong-functionsystem
$ bash install_tools.sh

编译依赖安装完毕后需要额外执行以下特定的脚本修改环境中的Golang版本。

$ source /etc/profile.d/buildtools-go.sh

启动编译前可能需要修改Golang的依赖下载地址,推荐使用国内的软件源。

$ export GOPROXY=https://proxy.golang.com.cn,https://goproxy.cn,direct

拷贝数据系统编译产物到函数系统的文件夹中,为函数系统的编译提供数据系统的SDK。随后启动数据系统的编译。

$ mkdir -p openyuanrong/yuanrong-functionsystem/datasystem/output
$ tar xf openyuanrong/yuanrong-datasystem/output/yr-datasystem-v0.5.0.tar.gz -C openyuanrong/yuanrong-functionsystem/datasystem/output
$ bash openyuanrong/yuanrong-functionsystem/build.sh

编译完成后可以看到如下编译产物

$ tree openyuanrong/yuanrong-functionsystem/output/
openyuanrong/yuanrong-functionsystem/output/
├── sym.tar.gz
└── yr-functionsystem-v0.0.1.tar.gz

0 directories, 2 files

没有指定版本号时编译脚本在这里又自动使用了0.0.1版本号,版本不一致也是很幽默了。

编译yuanrong-runtime多语言运行时

未完待续

You may also like...

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注