Question

I've just implemented modules on GAE and am trying to run a Cron job from a certain module. My app.yaml has following values at the top:

application: myapp
module: default
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
#all handlers

The reporting.yaml for the module I am trying to activate has the following settings:

application: myapp
module: reporting
version: 1
instance_class: B4
runtime: python27
api_version: 1
threadsafe: true

handlers:
#same handlers as app.yaml

Finally my cron.yaml looks as following:

cron:
- description: update reports
  url: /update
  schedule: every day 12:00
  target: reporting

I need the module because the job requires more memory then the normal instance offers. For some reason however, when I look in the Logs of my app, it keeps executing the cron job on the default module. Why is it not accepting the target parameter?

Était-ce utile?

La solution

Turns out I missed to upload the module itself with following command:

appcfg update app.yaml reporting.yaml

After doing this, the target parameter worked.

Autres conseils

Please check the below text from GAE document - target element for version not module.

If the target parameter has been set for a job, the request is sent to the specified version.

How about forward cron job to your target module as like the below example code in GAE document?

import urllib2
from google.appengine.api import modules

url = "http://%s/" % modules.get_hostname(module="reporting")
try:
  result = urllib2.urlopen(url)
  doSomethingWithResult(result)
except urllib2.URLError, e:
  handleError(e)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top