On Aug 20, 11:05 am, Julien Phalip <[EMAIL PROTECTED]> wrote: > Hi, > > You could use Ajax for this. The client could periodically (say, every > second) send a request to the server asking if the calculation is > over. When the calculation is over, a flag would be set (in the > server's cache, for example) and the client would be notified at the > next ajax request. > > That should work and be quite simple to implement.
That is only half the answer. Before you get to this point you need a means of backgrounding the task to be completed. There are various options for that, but depending on how you are deploying your application some wouldn't be appropriate. Options include, creating a new thread to perform work in. Adding task to a queue, which existing thread picking that up and doing work. Executing a separate program in the background to do the work. Finally, contacting some separate long running process to do the task, with it possibly using any one of the techniques already listed here. Once the job is kicked off and running, you also have the problem of getting information about the state of the task. If you use a technique whereby work is done within the web server process, you have to contend with possibility that you may be deploying with a multi process web server and so subsequent requests may not go back to the same process. As such, information about the state of the task may need to be stored outside of the context of the web server processes so it can be queried from multiple clients. Even if using a single process web server, how do you cope with web server restarts. Should the task somehow be able to persist across such an event. Taking all these into consideration, one model that can generally work no matter what the web application deployment method is, is to run a separate backend application process whose only task is to run these tasks. The main web application could communicate with this dedicated process using XML-RPC or some other RPC mechanism. In other words, created a multi tiered application, with web interface being separated from process which does the work. Anyway, what one may end up using really all depends on the nature of the task being performed, but AJAX techniques in themselves are not necessarily the complete answer. :-) Graham > Cheers, > > Julien > > On Aug 20, 10:37 am, makebelieve <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I've built an app that accepts inputs from the user and then uses them > > to do some heavy data crunching. I've got everything working > > correctly, however, on some runs the process is too long and the > > browser times out before it can complete. Does anyone know a way > > around this? Ideally after hitting the calculate button I'd like to > > take the user to a "Calculations in Progress" page until the data > > crunching is complete. Any ideas on how to accomplish this? > > > Thank you in advance! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---