首页 > 解决方案 > 使用 App Engine Cron 服务的 Cron 作业:每天在给定时间

问题描述

我正在尝试使用 Terraform 部署调度查询 (BigQuery)。我想让我的调度查询每天凌晨 3 点运行。调度查询正在使用 App Engine Cron 服务。

Terraform 提供的示例中包含一个计划作业。这对我有用。

 schedule               = "first sunday of quarter 00:00"

但是,我试图在每天凌晨 3:00 运行我的调度查询。我尝试的是:“ every 24h at 03:00”,然后是“ every 24h from 03:00”,但这些都不起作用

基于此文档Data transfer schedule...Examples of valid format: 1st,3rd monday of month 15:30, every wed,fri of jan,jun 13:15, and first sunday of quarter 00:00. See more explanation about the format here: https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format NOTE: the granularity should be at least 8 hours, or less frequent.

我的代码:main.tf

resource "google_bigquery_data_transfer_config" "query_config" {

  for_each               = local.jobs

  display_name           = each.value.display_name
  data_source_id         = each.value.data_source_id
  schedule               = "every 24h at 03:00"
  destination_dataset_id = each.value.destination_dataset_id
  params = {
    destination_table_name_template = each.value.destination_table_name_template
    write_disposition               = each.value.write_disposition
    query                           = file("scheduling_queries/sql_repo/${each.value.display_name}.sql")
  }
}

标签: google-cloud-platformgoogle-bigquerycronterraform

解决方案


在几次失败后得到它:every day 03:15


推荐阅读