如何使用Apache Beam / Google DataFlow Python拆分大型镶木木材文件

发布于 2025-01-26 08:10:48 字数 1210 浏览 4 评论 0原文

我需要使用Apache Beam / Google DataFlow拆分30GB Parquet文件。 这是代码:

    with beam.Pipeline(options=pipeline_options) as p:
        (
            p 
            | 'Read' >> beam.io.ReadFromParquet("gs://my-bucket/input/my-file.parquet")
            | 'Write' >> beam.io.WriteToParquet(
                file_path_prefix="gs://my-bucket/output/",
                schema=SCHEMA,
                codec='snappy',
                file_name_suffix='.parquet',
                num_shards=20,
            )
         )

当我在小镶木木上运行此代码时,它运行正常。但是,当我在一个大文件(30GB parquet)上运行它时,它会粘上并在闲置时间后丢下错误:

Root cause: The worker lost contact with the service.

我试图在更强大的虚拟机上运行它,如建议在这里

--worker_machine_type=e2-standard-2 --disk_size_gb=500

但是这次,作业在同一步骤上粘贴并永远冻结:

我不是经验丰富的Apache Beam和DataFlow用户,很长一段时间都没有使用它。感谢任何帮助。

I need to split 30GB Parquet file with Apache Beam / Google Dataflow.
Here is the code:

    with beam.Pipeline(options=pipeline_options) as p:
        (
            p 
            | 'Read' >> beam.io.ReadFromParquet("gs://my-bucket/input/my-file.parquet")
            | 'Write' >> beam.io.WriteToParquet(
                file_path_prefix="gs://my-bucket/output/",
                schema=SCHEMA,
                codec='snappy',
                file_name_suffix='.parquet',
                num_shards=20,
            )
         )

When I run this code on a small Parquet file, it runs fine. But when I run it on a big file (30GB Parquet) it sticks and throws an error after some idle time:

Root cause: The worker lost contact with the service.

I tried to run it on more powerful virtual machines, as recommended here:

--worker_machine_type=e2-standard-2 --disk_size_gb=500

But this time the job sticks on the same step and freezes forever:

enter image description here

I'm not an experienced Apache Beam and Dataflow user and have not been using it for a long time. Appreciate any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文