GAE cron作业意外关闭 [英] GAE cron job shuts down unexpectedly

查看:172
本文介绍了GAE cron作业意外关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google App Engine的应用程序中,我在cron.xml中配置了一些cron作业。

这些作业每天在我的应用程序版本上运行一次,并在db上做一些工作。

例如,一个cron任务调用 v1.myapp.appspot.com ...



实例似乎不再正常工作。它不会像我期望的那样执行cron作业。



在GAE仪表板上,我找到了一个有cron作业列表的部分,但是我看不到我的cron作业。



他们为什么消失?我的配置环境有什么问题?或为什么谷歌停止执行我的cron作业?

解决方案

cron作业配置是一个应用程序范围配置,它不是特定服务/版本的配置。每个cron部署(可以在不更新服务/版本的情况下完成)将覆盖以前部署的部署。



为了避免个人意外的错误,我有一个cron配置文件在应用程序级别,根据需要将每个服务内的符号链接到一起。



如果您想保留运行较旧版本的cron作业,您需要为它添加一个配置条目一个与该服务/版本相匹配的目标,否则当该版本不再是默认服务/版本时,cron作业将停止工作(因为cron触发的请求将指向默认服务/版本):

创建cron作业


 <?xml version =1.0encoding =UTF-8?> 
< cronentries>
< cron>
< url> / tasks / summary< / url>
< target> beta< / target>
< description>每日摘要作业< / description>
< schedule>每24小时< / schedule>
< / cron>
< / cronentries>

目标规格是可选的,并且是
服务/版本的名称。如果存在,目标将被添加到您应用程序的
主机名中,导致作业被路由到该服务/版本。如果未指定
目标,则作业将以默认版本的
默认服务运行。



I have some cron jobs configured in cron.xml in an application on Google App Engine.
These jobs work once a day on a version of my application and make some work on the db.
For example a cron job calls v1.myapp.appspot.com...

After some weeks this application instance seems to no longer work correctly. It does not execute the cron jobs as I expect.

On GAE Dashboard I found a section with a list of cron job, but I can't see my cron jobs there.

Why did they disapper? What's wrong with my configuration environment? or Why google stops the execution of my cron jobs?

解决方案

The cron job configuration is an app-wide scope configuration, it's not a configuration of a specific service/version. Every cron deployment (which can be done without necessarily updating a service/version) will overwrite the previously deployed one.

To avoid accidental errors personally I have a single cron config file at the app level, symlinked inside each service as needed.

If you want to keep the cron job for an older version running you need to add a configuration entry for it with a target matching that service/version, otherwise the cron job will stop working when that version is no longer the default one (as the cron-triggered requests will be directed towards the default service/version):

From Creating a cron job:

<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
  <cron>
    <url>/tasks/summary</url>
    <target>beta</target>
    <description>daily summary job</description>
    <schedule>every 24 hours</schedule>
  </cron>
</cronentries>

The target specification is optional and is the name of a service/version. If present, the target is prepended to your app's hostname, causing the job to be routed to that service/version. If no target is specified, the job will run in the default version of the default service.

这篇关于GAE cron作业意外关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆