如何通过 运行 Google Compute Engine cron 作业安排数据流作业
How to schedule Dataflow Job by running Google Compute Engine cron job
在 Dataflow FAQ 中列出了 运行 Compute Engine 上的自定义 (cron) 作业进程是一种安排数据流管道的方法。我对具体应该如何完成感到困惑:如何在计算引擎上启动数据流作业并启动 cron 作业。
谢谢!
我在 App Engine 上工作,但我想这与 Compute Engine 类似
Cron 将以您指定的频率命中您服务上的端点。因此,您需要为该端点设置一个请求处理程序,它将在命中时启动数据流作业(基本上在您的请求处理程序中,您需要定义您的管道,然后在其上调用 'run')。
这应该是它的基础知识。我做的一个额外步骤是让我的 cron 作业的请求处理程序启动云任务,然后让我的云任务的请求处理程序启动数据流作业。我这样做是因为我注意到管道的 'run' 命令有时需要一段时间,而云任务有 10 分钟的超时,而 cron 作业的超时为 30 秒(或者是 60 秒)。
您可以使用 Google Cloud Scheduler to execute your Dataflow Job. On Cloud Scheduler you have targets, these could be HTTP/S endpoints, Pub/Sub topics, App Engine applications, you can use your Dataflow template as target. Review this external article to see an example: Schedule Your Dataflow Batch Jobs With Cloud Scheduler or if you want to add more services to the interacion: Scheduling Dataflow Pipeline using Cloud Run, PubSub and Cloud Scheduler.
在 Dataflow FAQ 中列出了 运行 Compute Engine 上的自定义 (cron) 作业进程是一种安排数据流管道的方法。我对具体应该如何完成感到困惑:如何在计算引擎上启动数据流作业并启动 cron 作业。
谢谢!
我在 App Engine 上工作,但我想这与 Compute Engine 类似
Cron 将以您指定的频率命中您服务上的端点。因此,您需要为该端点设置一个请求处理程序,它将在命中时启动数据流作业(基本上在您的请求处理程序中,您需要定义您的管道,然后在其上调用 'run')。
这应该是它的基础知识。我做的一个额外步骤是让我的 cron 作业的请求处理程序启动云任务,然后让我的云任务的请求处理程序启动数据流作业。我这样做是因为我注意到管道的 'run' 命令有时需要一段时间,而云任务有 10 分钟的超时,而 cron 作业的超时为 30 秒(或者是 60 秒)。
您可以使用 Google Cloud Scheduler to execute your Dataflow Job. On Cloud Scheduler you have targets, these could be HTTP/S endpoints, Pub/Sub topics, App Engine applications, you can use your Dataflow template as target. Review this external article to see an example: Schedule Your Dataflow Batch Jobs With Cloud Scheduler or if you want to add more services to the interacion: Scheduling Dataflow Pipeline using Cloud Run, PubSub and Cloud Scheduler.