Cron tasks not running (in dev)

I specified the cron job (for testing in development), but it does not seem to work. How to make sure that jobs will work in production?

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:

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 is defined as:

class CronHandler(webapp.RequestHandler):

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

I expected to see the line, β€œNOTE: CronHandler request to receive,” in the application engine logs. I am using the GoogleAppEngineLauncher application (version: 1.5.3.1187) to start and stop the application.

+5
source share
4 answers

D'oh! Just looked at the fine print in the SDK documentation:

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

cron. cron URL- .

+3

.

-, Cron: http://localhost:8000/cron

(-) cron. , , :

  • " ", URL- (!)
  • . , ,
+2

cron dev-. python script, URL- cron .

import urllib2
import time
while True:
    print urllib2.urlopen("http://localhost:9080/cron/jobs/")
    time.sleep(60)

url http://localhost:9080/cron/jobs/, . , .

0
source

Well, my interface and backend code have been separated. So I cracked some ajax code in the user interface to regularly remove backend endpoints. This modeled the cron jobs for me in the local dev environment.

0
source

All Articles