How to get started with mapreduce from cron on GAE Python

I have a mapreduce job defined in mapreduce.yaml:

mapreduce:
- name: JobName 
  mapper:
    input_reader: google.appengine.ext.mapreduce.input_readers.DatastoreInputReader
    handler: handler_name
    params:
    - name: entity_kind
      default: KindName

How to run it from cron? Is there any url that can run it?

+5
source share
2 answers

You can run the mapreduce task from any kind of AppEngine handler using control.py

from mapreduce import control

mapreduce_id = control.start_map(
    "My Mapper",
    "main.my_mapper",
    "mapreduce.input_readers.DatastoreInputReader",
    {"entity_kind": "models.MyEntity"},
    shard_count=10)
+10
source

Yes, if you look at the Getting Started page , it shows that you are setting the URL to app.yaml:

handlers:
- url: /mapreduce(/.*)?
  script: mapreduce/main.py
  login: admin

App Engine, cron.yaml :

cron:
- description: daily summary job
  url: /mapreduce
  schedule: every 24 hours
-6

All Articles