Dataflow中的自定义Apache Beam Python版本

Gui*_*lle 4 python google-cloud-dataflow apache-beam

我想知道是否有可能在Google Dataflow中运行自定义的Apache Beam Python版本。公共存储库中不可用的版本(撰写本文时:0.6.0和2.0.0)。例如,来自Apache Beam官方存储库的HEAD版本,或与此相关的特定标签。

我知道有可能按照官方文档中所述打包自定义软件包(例如,本地私有软件包)。这里回答了有关如何对其他一些脚本执行此操作的问题。甚至还有GIST 对此进行指导

但是我没有设法获得当前的Apache Beam开发版本(或带标签的版本),该版本可在其官方存储库的master分支中获得,并打包并通过脚本发送到Google Dataflow。例如,对于最新的可用标签,PiP要处理的链接为:git+https://github.com/apache/beam.git@v2.1.0-RC2#egg=apache_beam[gcp]&subdirectory=sdks/python我得到如下信息:

INFO:root:Executing command: ['.../bin/python', '-m', 'pip', 'install', '--download', '/var/folders/nw/m_035l9d7f1dvdbd7rr271tcqkj80c/T/tmpJhCkp8', 'apache-beam==2.1.0', '--no-binary', ':all:', '--no-deps']
DEPRECATION: pip install --download has been deprecated and will be removed in the future. Pip now has a download command that should be used instead.
Collecting apache-beam==2.1.0
  Could not find a version that satisfies the requirement apache-beam==2.1.0 (from versions: 0.6.0, 2.0.0)
No matching distribution found for apache-beam==2.1.0
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?(我想知道是否有可能,因为Google Dataflow可能已经修复了可以运行到官方发布版本的Apache Beam版本)。

Gui*_*lle 6

在我一直在帮助的一个Apache Beam的JIRA上得到这个问题的答案时,我会回答自己。

如果要在Google Cloud Dataflow中使用自定义的Apache Beam Python版本(即,--runner DataflowRunner使用来--sdk_location <apache_beam_v1.2.3.tar.gz>运行管道,<apache_beam_v1.2.3.tar.gz>则在运行管道时必须使用该选项;您要使用的相应打包版本的位置在哪里) 。

例如,在撰写本文时,如果您已签出HEADApache Beam的git 存储库的版本,则必须先通过导航到Python SDK打包存储库cd beam/sdks/python,然后运行python setup.py sdist(将在dist子目录中创建压缩的tar文件))。

之后,您可以像这样运行管道:

python your_pipeline.py [...your_options...] --sdk_location beam/sdks/python/dist/apache-beam-2.2.0.dev0.tar.gz
Run Code Online (Sandbox Code Playgroud)

Google Cloud Dataflow将使用提供的SDK。