[英]Setting retry_parameters on cron.yaml
I am setting up a cron job related to an App Engine app (standard environment, Python 3) and want it to retry after 2 minutes on failure. 我正在设置与App Engine应用程序(标准环境,Python 3)相关的Cron作业,并希望它在失败2分钟后重试。 No matter what value I put in
retry_parameters
it seems to be retrying in 1 minute. 无论我在
retry_parameters
中retry_parameters
什么值,它似乎都将在1分钟内重试。 Looking at the docs, I don't see a mention of a max wait time, so I wonder if I've just messed up the cron.yaml
somehow. 查看文档,我没有看到最长等待时间的提法,所以我想知道是否只是以某种方式弄乱了
cron.yaml
。
Everything is working perfectly, except it is retrying sooner than I would like. 一切工作正常,只是重试的时间比我想的要早。 Here's the yams — is this a limit or have messed something up.
这是山药-这是一个极限还是弄乱了某些东西。
cron.yaml
: cron.yaml
:
cron:
- description: "daily call"
url: /twilio/start_call/
timezone: "America/Anchorage"
schedule: every day 17:00
retry_parameters:
min_backoff_seconds: 120.0
max_backoff_seconds: 360.0
max_doublings: 3
Edit: 编辑:
Here's a sample of the Stackdriver logs generated with the cron.yaml
. 下面是与生成的日志为Stackdriver的样本
cron.yaml
。 The function returned 503 each time until the last and cron was firing the jobs at 1-minute intervals: 每次函数返回503,直到最后一个命令和cron以1分钟的间隔触发作业:
2018-11-26 17:00:00.764 AKST GET 503 178 B 970 ms AppEngine-Google (+http://code.google.com/appengine) /twilio/start_call/
2018-11-26 17:01:01.939 AKST GET 503 178 B 704 ms AppEngine-Google;(+http://code.google.com/appengine) /twilio/start_call/
2018-11-26 17:02:02.747 AKST GET 503 178 B 850 ms AppEngine-Google;(+http://code.google.com/appengine) /twilio/start_call/
2018-11-26 17:03:03.702 AKST GET 503 178 B 666 ms AppEngine-Google;(+http://code.google.com/appengine) /twilio/start_call/
2018-11-26 17:04:04.477 AKST GET 200 189 B 65 ms AppEngine-Google; (+http://code.google.com/appengine) /twilio/start_call/
Here's what a particular log entry looks like expanded: 这是特定日志条目的扩展形式:
{ httpRequest: { status: 503 } insertId: "5bfca521000b366ac405955e" labels: { clone_id: "00c61b117cda9e441fb74ae3fd3225f528216a2a7e2fd701de97c95ac79fdc86ce3014f397" } logName: "projects/caller-app/logs/appengine.googleapis.com%2Frequest_log" operation: { first: true id: "5bfca52000ff0baa94727d8d2500016d7e7368656c7465722d63616c6c65720001323031383131323674313033313038000100" last: true producer: "appengine.googleapis.com/request_id" } protoPayload: { @type: "type.googleapis.com/google.appengine.logging.v1.RequestLog" appEngineRelease: "1.9.65" appId: "m~caller-app" cost: 1.9892999999999998e-8 endTime: "2018-11-27T02:00:01.734682Z" finished: true first: true host: "caller-app.appspot.com" httpVersion: "HTTP/1.1" instanceId: "00c61b117cda9e441fb74ae3fd3225f528216a2a7e2fd701de97c95ac79fdc86ce3014f397" instanceIndex: -1 ip: "0.1.0.1" latency: "0.970118s" megaCycles: "123" method: "GET" requestId: "5bfca52000ff0baa94727d8d2500016d7e7368656c7465722d63616c6c65720001323031383131323674313033313038000100" resource: "/twilio/start_call/" responseSize: "178" startTime: "2018-11-27T02:00:00.764564Z" status: 503 taskName: "22a1b20373e6b0b93d21726ad7218cff" taskQueueName: "__cron" traceId: "54903137240fb57e546907087fb94ca5" traceSampled: true urlMapEntry: "auto" userAgent: "AppEngine-Google; (+http://code.google.com/appengine)" versionId: "20181126t103108" } receiveTimestamp: "2018-11-27T02:00:01.759151584Z" resource: { labels: { module_id: "default" project_id: "caller-app" version_id: "20181126t103108" zone: "us-west2-3" } type: "gae_app" } timestamp: "2018-11-27T02:00:00.764564Z" trace: "projects/caller-app/traces/54903137240fb57e546907087fb94ca5" traceSampled: true }
So this was a simple case of mis-reading the documentation. 因此,这是一个误读文档的简单情况。 But in case anyone misreads it as well…
但是万一有人误读它的话……
Responding with a 503
is a special case. 响应
503
是一种特殊情况。 The documentation explains: 该文档说明:
By default, failed jobs are not retried unless a 503 status code is returned, in which case it is retried every minute until it succeeds or returns a 200-299 status code.
默认情况下,除非返回503状态码,否则不会重试失败的作业,在这种情况下,每分钟将重试一次,直到成功或返回200-299状态码。
It doesn't explicitly say it, but this means that when the server responds with a 503
status the retry_parameters
in cron.yaml
are ignored and it still retries every minute. 它没有明确说出来,但是这意味着当服务器回应一个
503
状态retry_parameters
在cron.yaml
被忽略,但它仍然重试的每一分钟。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.