排除apache beam管道导入错误[BoundedSource对象大于允许的限制]

2024-10-01 02:35:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一堆文本文件(~1M)存储在谷歌云存储上。当我将这些文件读入Google云数据流管道进行处理时,总是会出现以下错误:

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.

这是否意味着我必须将我的文件拆分成更小的批,而不是一次导入它们?在

我使用dataflowpythonsdk开发管道。在


Tags: 文件oftheinsource管道ison
1条回答
网友
1楼 · 发布于 2024-10-01 02:35:33

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

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

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

另请参见How can I improve performance of TextIO or AvroIO when reading a very large number of files?以获取Java版本。在

相关问题 更多 >