Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make cron work with a specific app engine module?

I have an app.yaml as below:

application: myapp
module: mymodule
version: 1 
runtime: python27 
api_version: 1
threadsafe: true
...

The app also has a cron.yaml as below:

cron:
- description: increase a value every hour
  url: /test/inc
  schedule: every 60 minutes synchronized

How do I make my cron job target mymodule instead of the default module?

like image 650
Dan Avatar asked Aug 10 '13 14:08

Dan


2 Answers

In newer versions of GAE (tested at least with 1.8.6), you can just set the target for your cron task:

cron:
- description: increase a value every hour
  url: /test/inc
  schedule: every 60 minutes synchronized
  target: mymodule
like image 170
marianosimone Avatar answered Oct 27 '22 10:10

marianosimone


Thanks to @voscausa you can use a dispatch.yaml file https://developers.google.com/appengine/docs/python/modules/routing to route a cron job to the right module.

Make sure you run appcfg.py update_dispatch after you create the dispatch.yaml file.

like image 31
Dan Avatar answered Oct 27 '22 09:10

Dan