google-cloud-platform - 带有python flex模板的数据流 - 启动器超时

标签 google-cloud-platform google-cloud-dataflow apache-beam data-pipeline

我正在尝试使用 flex 模板运行我的 python 数据流作业。当我使用直接运行器(没有 flex 模板)运行时,作业在本地运行良好,但是当我尝试使用 flex 模板运行它时,作业卡在“排队”状态一段时间,然后因超时而失败。
这是我在 GCE 控制台中找到的一些日志:

INFO:apache_beam.runners.portability.stager:Executing command: ['/usr/local/bin/python', '-m', 'pip', 'download', '--dest', '/tmp/dataflow-requirements-cache', '-r', '/dataflow/template/requirements.txt', '--exists-action', 'i', '--no-binary', ':all:'

Shutting down the GCE instance, launcher-202011121540156428385273524285797, used for launching.

Timeout in polling result file: gs://my_bucket/staging/template_launches/2020-11-12_15_40_15-6428385273524285797/operation_result.
Possible causes are:
1. Your launch takes too long time to finish. Please check the logs on stackdriver.
2. Service my_service_account@developer.gserviceaccount.com may not have enough permissions to pull container image gcr.io/indigo-computer-272415/samples/dataflow/streaming-beam-py:latest or create new objects in gs://my_bucket/staging/template_launches/2020-11-12_15_40_15-6428385273524285797/operation_result.
3. Transient errors occurred, please try again.
对于 1,我看不到有用的 lo。对于 2,服务帐户是默认服务帐户,因此它应该具有所有权限。
我该如何进一步调试?
这是我的 Docker 文件:
FROM gcr.io/dataflow-templates-base/python3-template-launcher-base

ARG WORKDIR=/dataflow/template
RUN mkdir -p ${WORKDIR}
WORKDIR ${WORKDIR}

ADD localdeps localdeps
COPY requirements.txt .
COPY main.py .
COPY setup.py .
COPY bq_field_pb2.py .
COPY bq_table_pb2.py .
COPY core_pb2.py .

ENV FLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILE="${WORKDIR}/requirements.txt"
ENV FLEX_TEMPLATE_PYTHON_PY_FILE="${WORKDIR}/main.py"
ENV FLEX_TEMPLATE_PYTHON_SETUP_FILE="${WORKDIR}/setup.py"

RUN pip install -U  --no-cache-dir -r ./requirements.txt
我正在遵循本指南 - https://cloud.google.com/dataflow/docs/guides/templates/using-flex-templates

最佳答案

可以在 requirements.txt 中找到此问题的可能原因。文件。如果您正在尝试安装 apache-beam在需求文件中,flex 模板将遇到您所描述的确切问题:作业在排队状态中停留一段时间,最后以 Timeout in polling result 失败。 .
原因是,它们受 this 的影响。问题。这仅影响 flex 模板,作业在本地或使用标准模板正常运行。
解决办法是单独安装在Dockerfile中。

RUN pip install -U apache-beam==<your desired version>
RUN pip install -U -r ./requirements.txt

关于google-cloud-platform - 带有python flex模板的数据流 - 启动器超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64813705/

相关文章:

google-app-engine - 如何等待 Google App Engine 操作完成?

google-cloud-platform - 如何从云存储中的存储桶中下载对象?

tensorflow - 本地预测的 gcloud 问题

java - Dataflow DoFn 中的数据存储查询在云中运行时会减慢管道速度

python - 如何从 PCollection Apache Beam Python 创建 N 个元素组

python - Apache Beam/Dataflow 作业中是否可以有非并行步骤?

google-cloud-platform - 限制对 Google Cloud Function 的访问

google-bigquery - 如何捕获 BigQueryIO.Write 抛出的任何异常并挽救输出失败的数据?

python - 来自数据流的 BigQuery 流式传输无提示地失败

python - 光束/数据流 Python : AttributeError: '_UnwindowedValues' object has no attribute 'sort'