gpt4 book ai didi

google-app-engine - Cron 作业未运行(在开发中)

转载 作者:太空宇宙 更新时间:2023-11-03 15:24:23 25 4
gpt4 key购买 nike

我已经指定了一个 cron 作业(以在开发中进行测试),但它似乎没有运行。如何确保作业在生产中有效?

cron.yaml:

cron:
- description: cron test gathering
url: /test/cron
schedule: every 2 minutes from 09:00 to 23:00

应用程序.yaml:

application: cron_test
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
script: main.py

主要.py:

url_map = [ ('/test/cron', test.CronHandler),
('/error', err.Err404Handler)]

application = webapp.WSGIApplication(url_map, debug=False)

def main():
wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
main()

FeedCron 定义为:

class CronHandler(webapp.RequestHandler):

def get(self):
logging.info("NOTE: CronHandler get request");
return None

我原以为会在应用引擎的日志中看到“注意:CronHandler 获取请求”这一行。我正在使用 GoogleAppEngineLauncher 应用程序(版本:1.5.3.1187)启动和停止该应用程序。

最佳答案

噢!刚在 SDK 文档中看到细则:

When using the Python SDK, the dev_appserver has an admin interface that allows you to view cron jobs at /_ah/admin/cron.

The development server doesn't automatically run your cron jobs. You can use your local desktop's cron or scheduled tasks interface to trigger the URLs of your jobs with curl or a similar tool.

关于google-app-engine - Cron 作业未运行(在开发中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7249645/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com