11 December 2011

Appengine backends and task queues

To get appengine to send queued tasks to a backend, you need to set the host header when queuing the task. E.g.
    deferred.defer(
        batch.DoStuff, arg1, arg2, arg3,
        _headers={'Host': backends.get_hostname(backend='backend_name')})

5 comments:

  1. To a backend *in particular*, you mean? Good to know, thanks!

    ReplyDelete
  2. Actually, it's to a backend type. Not a particular backend instance. For task queues, you shouldn't care about backend instances.

    ReplyDelete
  3. you can also use target. http://code.google.com/appengine/docs/python/taskqueue/overview-push.html#Push_Queues_and_Backends . looks like that's _target in the deferred lib.

    ReplyDelete
  4. Now I feel silly for missing that.

    ReplyDelete
  5. it was added at some point. i think the same time we added backends. the docs are probably even newer.

    ReplyDelete