1

I have a long-running process written in Python 2.7 that I would like to send KML files to my GWT application asynchronously as the KML files are generated.

I have been trying to determine what Python web framework I could use as the back-end with the Python process that could possibly allow the webapp to be hosted on Google AppEngine.

I was able to write a simple python webserver using Cherrypy that sent the kml using JSON from the back-end to GWT using an http request; however, I would like the files to be sent to GWT as they are generated since it may be several minutes between each one. What would be a relatively simple but effective way to achieve this? (Comet? Long-polling? Websockets?)

After researching more python web frameworks, I started experimenting with Tornado because it is non-blocking and seems like it could return data as it is generated possibly using long-polling as mentioned in this answer. However, it looks like GAE requires WSGI which would not allow a Tornado webserver to be non-blocking.

I have read answers to similar questions such as this one. However, I am not sure if updates in web frameworks, GWT, or GAE has changed what is the best option today, or whether some of these answers apply to my case.

What Python web framework would you recommend I use to send data to my asynchronous GWT app using long-polling or another method relatively simply? Could I use this web framework with GAE, or would I need to use something else?

Community
  • 1
  • 1
dave
  • 59
  • 5
  • 1
    So basically you have a task that takes sometime to complete and you want somehow notify the client when it is ready to be able to retrieve it? – Lipis Sep 29 '12 at 17:07
  • Yes, however one request from the client will generate several files, possibly several minutes apart to be sent back to the same client. I would like the files to be sent when they are created on the server side and displayed on the client side when they are created as opposed to sending all files together once the long process has completed. – dave Sep 29 '12 at 21:37

1 Answers1

3

If I understood the problem correctly you might don't need any special framework and you can solve it with what you have: Tasks API and Channel API.

With Tasks API you can perform long task and when the task is complete you can get a notification. You can combine it with the Channel API to push messages directly to the client when a particular task is complete.

You could use also the deferred library to simplify your life with tasks and maybe even using the PubNub for your push notifications, since the setup is easier and you can have many subscribers at the same time.

Lipis
  • 19,958
  • 18
  • 88
  • 117
  • Thanks, this may be what I am looking for. Do you know if the Task API allows data to be transferred from one task to the next for the same client? For example, a client would send one request, and that request might produce five tasks, with each task using the result from the previous task. – dave Sep 29 '12 at 21:50
  • 1
    After looking into the Channel and Task APIs, they seem to be what I need. Thanks! – dave Oct 07 '12 at 13:12