docker - 如何使用自定义 Docker 映像运行 Python Google Cloud Dataflow 作业?
问题描述
我想使用自定义 Docker 映像运行 Python Google Cloud Dataflow 作业。
根据文档,这应该是可能的:https ://beam.apache.org/documentation/runtime/environments/#testing-customized-images
为了尝试这个功能,我已经使用这个公共回购https://github.com/swartchris8/beam_wordcount_with_docker中的文档中的命令行选项设置了基本的 wordcount 示例管道
我可以使用图像在本地使用PortableRunner 运行 wordcount 作业,apachebeam/python3.6_sdk
但使用 Dataflow 我无法做到这一点。
对于 PortableRunner,我尽可能密切关注文档,我的参数是:
python -m wordcount --input wordcount.py \
--output counts \
--runner=PortableRunner \
--job_endpoint=embed \
--environment_config=apachebeam/python3.6_sdk
对于数据流:
python -m wordcount --input wordcount.py \
--output gs://healx-pubmed-ingestion-tmp/test/wordcount/count/count \\
--runner=DataflowRunner \
--project=healx-pubmed-ingestion \
--job_name=dataflow-wordcount-docker \
--temp_location=gs://healx-pubmed-ingestion-tmp/test/wordcount/tmp \
--experiment=beam_fn_api \
--sdk_location=/Users/chris/beam/sdks/python/container/py36/build/target/apache-beam.tar.gz \
--worker_harness_container_image=apachebeam/python3.6_sdk \
--region europe-west1 \
--zone europe-west1-c
有关完整的详细信息,请参阅链接的 repo。
我在这里做错了什么,或者 Dataflow 中的 Python 作业不支持此功能?
解决方案
您应该能够将自定义容器与 Dataflow 一起使用--experiment=--use_runner_v2
,默认情况下很快就会启用。示例命令行可能如下所示:
pip install apache-beam[gcp]==2.24.0
python -m apache_beam.examples.wordcount \
--output gs://healx-pubmed-ingestion-tmp/test/wordcount/ \
--runner=DataflowRunner \
--project=healx-pubmed-ingestion \
--region europe-west1 \
--temp_location=gs://healx-pubmed-ingestion-tmp/test/wordcount/tmp \
--worker_harness_container_image=apache/beam_python3.6_sdk:2.24.0 \
--experiment=use_runner_v2
要自定义容器,请按照https://beam.apache.org/documentation/runtime/environments/#customizing-container-images上的说明进行操作。
推荐阅读
- angular - Angular Firebase - DocumentReference.set() 错误
- javascript - TS2451:无法重新声明块范围变量
- java - JavaFX:检查是否已设置事件处理程序/过滤器的方法?
- python - 带有滚动视图的 Kivy 1.10.1 下拉菜单无法在触摸时滚动
- python - 简单的神经网络无法做出正确的预测。我在哪里做错了?
- sql - 排除与 Postgres 中每个父记录关联的第一条记录
- laravel - Laravel 5.8 按需通知错误 Call to a member function create() on null
- c - 错误的输出 fscanf()
- powershell - 确定并获取目录名称中的数字并在表达式中使用该数字
- intraweb - 如何从其他计算机访问 TIWApplication