Cron作业没有运行(在开发中) [英] Cron jobs not running (in dev)

查看:102
本文介绍了Cron作业没有运行(在开发中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've specified a cron job (to test in development) but it doesn't seem to be running. How does one make sure the jobs will work in production?

cron.yaml:

cron.yaml:

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

app.yaml:

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

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

main.py:

main.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被定义为: p>

FeedCron is defined as:

class CronHandler(webapp.RequestHandler):

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

我期待看到行,注意:CronHandler获取请求 ,在应用程序引擎的日志中。我正在使用GoogleAppEngineLauncher应用(版本:1.5.3.1187)来启动&停止应用程序。

I was expecting to see the line, "NOTE: CronHandler get request", in the app engine's logs. I'm using the GoogleAppEngineLauncher app (version: 1.5.3.1187) to start & stop the app.

推荐答案

D'Oh!刚刚在SDK文档中看到了精美的打印:

D'Oh! Just saw the fine print in the SDK documentation:


使用Python SDK时,dev_appserver的管理界面
允许您可以在/ _ah / admin / cron中查看cron作业。

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

开发服务器不会自动运行您的cron作业。您
可以使用您本地桌面的cron或计划任务界面
使用curl或类似工具触发您作业的网址。

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.

这篇关于Cron作业没有运行(在开发中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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