Apache Beam 管道导入错误故障排除 [BoundedSource 对象大于允许的限制]

Troubleshooting apache beam pipeline import errors [BoundedSource objects is larger than the allowable limit]

我有一堆文本文件 (~1M) 存储在 google 云存储中。当我将这些文件读入 Google Cloud DataFlow 管道进行处理时,我总是得到以下错误:

Total size of the BoundedSource objects returned by BoundedSource.split() operation is larger than the allowable limit

故障排除页面显示:

You might encounter this error if you're reading from a very large number of files via TextIO, AvroIO or some other file-based source. The particular limit depends on the details of your source (e.g. embedding schema in AvroIO.Read will allow fewer files), but it is on the order of tens of thousands of files in one pipeline.

这是否意味着我必须将我的文件分成较小的批次,而不是一次全部导入?

我正在使用数据流 python sdk 来开发管道。

将文件分成批次是一种合理的解决方法 - 例如使用多个 ReadFromText 转换或使用多个管道读取它们。我认为在 1M 文件级别,第一种方法行不通。最好使用一个新功能:

读取大量文件的最佳方法是使用 ReadAllFromText。它没有可伸缩性限制(尽管如果您的文件数量非常少,它的性能会更差)。

它将在 Beam 2.2.0 中可用,但如果您愿意使用快照构建,它已经在 HEAD 中可用。

另请参阅 以获得 Java 版本。