0

I have a GAE application which has an app.yaml that describes the request handlers and uses the deferred extension to put tasks onto a push queue which is targeted at a backend also defined in my application.

However, I've seen notices in the GAE dashboard saying "you're using backends, you should look at modules". So I've looked at modules and I'm having some difficulty figuring out how to define my backend as a module. My backend does not need any explicitly defined request handlers. It only processes tasks from the queue. But when I create the module yaml file for the backend with no handlers, the dev server complains that it's an invalid file.

I tried using the backend_conversion.py file and that duplicates the request handlers from my default module into my backend module, which seems to work, but it feels wrong.

The project source can be found here and the branch with the module conversion is here.

Any advice would be appreciated.

Harshal Patil
  • 6,659
  • 8
  • 41
  • 57
dOxxx
  • 1,540
  • 1
  • 12
  • 28
  • You'll have to add a handlers section with something in it - I guess the check made sense before modules existed, but now not so much. – Greg Jan 11 '14 at 17:36

2 Answers2

2

You can set the directive target to the queue definition in queue.yaml:

- name: solver_queue
  ...
  target: solver_backend

and add the parameter _queue to the deferred.defer:

deferred.defer(function, param1, param2, _queue='solver_queue')
Gianni Di Noia
  • 1,577
  • 10
  • 25
  • Thanks for that hint. I was already using the _queue parameter, but I was also targeting the solverbackend in the defer call as well using _target. I prefer setting it in the queue.yaml file like you describe. – dOxxx Jan 14 '14 at 00:27
0

My backend does not need any explicitly defined request handlers. It only processes tasks from the queue.

The reason why you may feel backend_conversion.py is wrong is because it duplicates your handlers and you feel your backend don't need handlers before. But backend needs handlers as frontend instance. What you backend actually did is running your whole app (defined by app.yaml) on backend instance. Thus your frontend instance and backend instance actually share the same code before.

Therefore

the backend_conversion.py file and that duplicates the request handlers

is a right behaviour.

lucemia
  • 6,349
  • 5
  • 42
  • 75
  • Sure, I guess I can see why as a default conversion that would make sense. But then why can't I edit that definition and remove the handlers without errors? – dOxxx Jan 14 '14 at 00:29