Dan
Dan

Reputation: 5313

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?

Upvotes: 5

Views: 1960

Answers (2)

marianosimone
marianosimone

Reputation: 3606

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

Upvotes: 8

Dan
Dan

Reputation: 5313

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.

Upvotes: 3

Related Questions