【问题标题】:Creating cron jobs for different services in app engine在应用引擎中为不同的服务创建 cron 作业
【发布时间】:2020-01-13 00:03:22
【问题描述】:

我正在尝试在 Google Cloud Platform 中为 App Engine 创建 cron 作业。但不幸的是,每当我尝试部署一个 cron 作业时,它也会覆盖另一个作业。此外,它们存在于不同的目录中。请在下面找到 CRON.yaml

cron:
 - description: "sample1"
   url: /
   target: sample1
   schedule: everyday 08:10
   timezone: Asia/Singapore

cron:
 - description: "sample2"
   url: /
   target: sample2
   schedule: everyday 08:00
   timezone: Asia/Singapore

两者都是不同的 cron.yaml 文件。但是当我部署使用 gcloud app deploy --project <<project>> cron.yaml ,正在覆盖。

请指教。

【问题讨论】:

    标签: python google-app-engine google-cloud-platform cron yaml


    【解决方案1】:

    您有 2 个解决方案

    • 只使用一个文件。实际上,当您上传 CRON 描述时,它会覆盖所有现有的。无法执行追加。 Cron 是一个 yaml 列表,这样做
    cron:
     - description: "sample1"
       url: /
       target: sample1
       schedule: everyday 08:10
       timezone: Asia/Singapore
     - description: "sample2"
       url: /
       target: sample2
       schedule: everyday 08:00
       timezone: Asia/Singapore
    
    • 目前,已提取 AppEngine 功能以供所有其他 Google Cloud 产品使用。顺便说一句,Memcache 变成了 MemoryStore,Cron 变成了 Scheduler(Endpoint 正在提取中)。因此,您可以使用 Cloud Scheduler 来执行您的 cron。您没有要定义的 YAML 文件,您必须通过 GUI 或命令行设置新的 Google Cloud 服务。请注意,重试策略不适用于 GUI,只能通过 CLI 使用

    【讨论】:

    • 哇,谢谢 :) 它有效...但看起来很奇怪,单独的 yaml 文件会覆盖另一个文件。但是在一个 yaml 中组合起来就像一种魅力
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-30
    • 1970-01-01
    • 2023-03-12
    • 2012-06-12
    • 1970-01-01
    • 2014-08-18
    • 2014-12-07
    相关资源
    最近更新 更多