Google App Engine:task_retry_limit不起作用? [英] Google App Engine: task_retry_limit doesn't work?

查看:232
本文介绍了Google App Engine:task_retry_limit不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Python GAE应用程序。



我希望我的任务停止运行,或者只是在失败时重试一次。现在,尽管我的yaml文件告诉他们,他们仍会永远运行!



以下是一个queue.yaml条目:

   -  name:globalPurchase 
rate:10 / s
bucket_size:100
retry_parameters:
task_retry_limit:1

如果globalPurchase任务失败并显示500错误代码,则会永久重试它,直到它在日志中成功显示此消息:

队列globalPurchase上名为task14的任务失败,代码为500;将在30秒内重试

为什么task_retry_limit实际上没有被使用?

解决方案

我有同样的问题。在这方面的文档和工具是缺乏的,但这里是我发现的:


  • 重试参数在开发服务器中没有效果。我尝试了很多不同的组合,但它总是只是无限期地重试30秒。这些参数在我部署到生产服务器时生效。

  • 我没有找到禁用所有重试的方法(除了确保我的处理程序不会抛出异常)。

    • 如果 task_retry_limit = 0 ,那么它仍会重试

    • code> task_retry_limit = 0 并且 task_age_limit 被设置,那么queue.yaml被拒绝,消息是

    • 同样,如果 task_age_limit = 0
    • $,则它会发出抱怨。 b $ b
    • 如果你设置了 task_retry_limit = 1 task_age_limit = 1s (显然是最小值)仍然得到一次重试。


  • 最短重试时间为20秒。如果您的配置指定的延迟小于20,则会等待20秒。

  • 第一次重试之前的时间是不可预知的;它似乎被随机推迟了一分钟。之后,重试将按照配置的时间表进行。


I have a Python GAE app.

I want my tasks to stop running or just retry once if they fail. Right now, they run forever despite what my yaml file is telling them!

Here is a queue.yaml entry:

 - name: globalPurchase
   rate: 10/s
   bucket_size: 100
   retry_parameters:
     task_retry_limit: 1

If globalPurchase task fails with a 500 error code, it is retried forever until it succeeds with this message in the logs:

"Task named "task14" on queue "globalPurchase" failed with code 500; will retry in 30 seconds"

Why is task_retry_limit not actually being used?

解决方案

I had the same problem. The documentation and tooling in this area is lacking, but here's what I found:

  • The retry parameters have no effect in the development server. I tried lots of different combinations, but it was always just indefinite retries 30s apart. The parameters did take effect when I deployed to the production server.
  • I haven't found a way to disable all retries (other than by ensuring that my handler doesn't throw exceptions).
    • If task_retry_limit=0, then it still retries.
    • If task_retry_limit=0 and task_age_limit is set, then the queue.yaml is rejected with a message that task_retry_limit must be positive.
    • Similarly, it complains if task_age_limit=0.
    • If you set task_retry_limit=1 and task_age_limit=1s (apparently the minimum values), you still get one retry.
  • The minimum retry time is 20 seconds. If the delay specified by your configuration is les than 20, than it will just wait 20 seconds.
  • The time before the first retry is unpredictable; it seems to be randomly delayed by up to a minute. After that, the retries follow the configured schedule.

这篇关于Google App Engine:task_retry_limit不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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