Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
B
beam
管理
动态
成员
计划
Wiki
代码
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
部署
发布
模型注册表
分析
贡献者分析
仓库分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
Show more breadcrumbs
oss-mirrors
beam
提交
9dd1f684
未验证
提交
9dd1f684
编辑于
1个月前
作者:
Robert Bradshaw
提交者:
GitHub
1个月前
浏览文件
操作
下载
差异文件
Merge pull request #33907 Expand yaml provider documentation.
上级
7451a7e5
ea8c560f
No related branches found
分支 包含提交
No related tags found
标签 包含提交
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
website/www/site/content/en/documentation/sdks/yaml-providers.md
+41
-10
41 个添加, 10 个删除
.../www/site/content/en/documentation/sdks/yaml-providers.md
有
41 个添加
和
10 个删除
website/www/site/content/en/documentation/sdks/yaml-providers.md
+
41
−
10
浏览文件 @
9dd1f684
...
...
@@ -30,10 +30,26 @@ vend catalogues of schema transforms.
## Java
For example, you could build a jar that vends a
Exposing transform in Java that can be used in a YAML pipeline consists of
four main steps:
1.
Defining the transformation itself as a
[
PTransform
](
https://beam.apache.org/documentation/programming-guide/#composite-transforms
)
that consumes and produces zero or more
[
schema'd PCollections
](
https://beam.apache.org/documentation/programming-guide/#creating-schemas
)
.
2.
Exposing this transform via a
[
SchemaTransformProvider
](
https://beam.apache.org/releases/javadoc/current/org/apache/beam/sdk/schemas/transforms/SchemaTransformProvider.html
)
which provides an identifier used to refer to this transform later as well
as metadata like a human-readable description and its configuration parameters.
3.
Building a Jar that contains these classes and vends them via the
[
Service Loader
](
https://github.com/Polber/beam-yaml-xlang/blob/95abf0864e313232a89f3c9e57b950d0fb478979/src/main/java/org/example/ToUpperCaseTransformProvider.java#L30
)
infrastructure.
4.
Writing a
[
provider specification
](
https://beam.apache.org/documentation/sdks/yaml/#providers
)
that tells Beam YAML where to find this jar and what it contains.
If the transform is already exposed as a
[
cross language transform
](
https://beam.apache.org/documentation/sdks/python-multi-language-pipelines/
)
or
[
schema transform
](
https://beam.apache.org/releases/javadoc/current/org/apache/beam/sdk/schemas/transforms/SchemaTransformProvider.html
)
and
then use
it in a
transform as follows
then steps 1-3 have been done for you. One
then use
s this
transform as follows
:
```
pipeline:
...
...
@@ -56,13 +72,14 @@ pipeline:
providers:
- type: javaJar
config:
jar: /path/or/url/to/myExpansionService.jar
jar: /path/or/url/to/myExpansionService.jar
transforms:
MyCustomTransform: "urn:registered:in:expansion:service"
MyCustomTransform: "urn:registered:in:expansion:service"
```
A full example of how to build a java provider can be found
[
here
](
https://github.com/apache/beam-starter-java-provider
)
.
We provide a
[
full cloneable example of how to build a java provider
](
https://github.com/apache/beam-starter-java-provider
)
that can be used to get started.
## Python
...
...
@@ -72,13 +89,27 @@ Arbitrary Python transforms can be provided as well, using the syntax
providers:
- type: pythonPackage
config:
packages:
- my_pypi_package>=version
- /path/to/local/package.zip
packages:
- my_pypi_package>=version
- /path/to/local/package.zip
transforms:
MyCustomTransform: "pkg.module.PTransformClassOrCallable"
MyCustomTransform: "pkg.module.PTransformClassOrCallable"
```
which can then be used as
```
- type: MyCustomTransform
config:
num: 3
arg: whatever
```
This will cause the dependencies to be installed before the transform is
imported (via its given fully qualified name) and instantiated
with the config values passed as keyword arguments (e.g. in this case
`pkg.module.PTransformClassOrCallable(num=3, arg="whatever")`
).
We offer a
[
python provider starter project
](
https://github.com/apache/beam-starter-python-provider
)
that serves as a complete example for how to do this.
...
...
This diff is collapsed.
点击以展开。
JiHu Release Tools Bot
@jihu-release-tools-bot
mentioned in commit
6ef40aff
·
1个月前
mentioned in commit
6ef40aff
mentioned in commit 6ef40affdd34ae7d892d2ba45668f9bb48467337
展开或隐藏提交列表
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录