I'm in the same boat here.  My plan is similar.

>From views.py, record the job in the DB.
Start the daemon thread.
Return a "Processing..." response to the browser.
When the daemon thread is done, it records it in the DB.
The browser page uses AJAX to query the DB and update the status.
When the DB changes, the browser page then shows "Done." and the
results.

One unanswered question is whether updating the DB with the models is
thread safe.  I realize that Django itself is not guaranteed to be
thread safe, but I don't yet see that there would be any problems
inserting & updating models (db rows) so far.  I know I'll have to
worry about things like race conditions, but I suspect that actual
operation of updating a model would not be affected.  Hopefully that's
true and I don't run into crazy threading bugs.

Your method will be safer, since calling a web service to signal the
end of the job is concurrency, but avoids the threading problem.  It's
no different than multiple users calling the server at once.
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to