首页 > 解决方案 > 作业图太大,无法提交到 Google Cloud Dataflow

问题描述

我正在尝试在 Dataflow 上运行作业,每当我尝试提交它以使用 DataflowRunner 运行时,我都会从服务中收到以下错误:

{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Request payload size exceeds the limit: x bytes.",
    "reason" : "badRequest"
  } ],
  "message" : "Request payload size exceeds the limit: x bytes.",
  "status" : "INVALID_ARGUMENT"
}
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "(3754670dbaa1cc6b): The job graph is too large. Please try again with a smaller job graph, or split your job into two or more smaller jobs.",
    "reason" : "badRequest",
    "debugInfo" : "detail: \"(3754670dbaa1cc6b): CreateJob fails due to Spanner error: New value exceeds the maximum size limit for this column in this database: Jobs.CloudWorkflowJob, size: 17278017, limit: 10485760.\"\n"
  } ],
  "message" : "(3754670dbaa1cc6b): The job graph is too large. Please try again with a smaller job graph, or split your job into two or more smaller jobs.",
  "status" : "INVALID_ARGUMENT"
}

如何将我的工作更改为更小,或增加工作大小限制?

标签: javapythongoogle-cloud-dataflowapache-beam

解决方案


此问题有一个解决方法,可让您将作业图的大小增加到最多 100MB。您可以指定此实验:--experiments=upload_graph

实验激活了一个新的提交路径,该路径将作业文件上传到 GCS,并通过不包含作业图的 HTTP 请求创建作业 - 只是对其的引用。

这样做的缺点是 UI 可能无法正确显示作业,因为它依赖于 API 请求来共享作业。


额外说明:减小作业图的大小仍然是一种很好的做法。

一个重要提示是,有时可以创建一些匿名 DoFns / lambda 函数,这些函数在其闭包中具有非常大的上下文,因此我建议查看代码中的任何闭包,并确保它们不包含非常大的上下文他们自己。

也许避免匿名 lambdas/DoFns 会有所帮助,因为上下文将是类的一部分,而不是序列化对象。


推荐阅读