Start backend with async urlfetch in Google App Engine

I am experimenting with several GAE features.

I created a Dynamic Backend, but I have several problems that allow this work to work without task queues

Base Code:

class StartHandler(webapp2.RequestHandler): def get(self): #... do stuff... if __name__ == '__main__': _handlers = [(r'/_ah/start', StartHandler)] run_wsgi_app(webapp2.WSGIApplication(_handlers)) 

The backend is dynamic. Therefore, whenever he receives a call, he does it and then stops.

Everything works great when I use inside my handlers:

 url = backends.get_url('worker') + '/_ah/start' urlfetch.fetch(url) 

But I want this call to be async due to the fact that it may take up to 10 minutes to complete Backend.

So I changed the code above:

 url = backends.get_url('worker') + '/_ah/start' rpc = urlfetch.create_rpc() urlfetch.make_fetch_call(rpc, url) 

But then the backend does not start. I am not interested in completing a request or getting any data from it.

What am I missing - are you implementing it incorrectly?

Thank you all

+4
source share
1 answer

Using RPC to asynchronously call without calling the get_result () method in the rpc object will not provide urlfetch to the receiver. As soon as your code exits pending asynchronous calls that have not been completed, it will be interrupted.

The only way to make an asynchronous handler is to queue a queue on a queue in a queue.

+2
source

All Articles