On Thu, 2009-01-29 at 11:34 -0800, Chris wrote:
> I have a python / django  script that I have written which will be
> used as a cron. Basically this script goes out to my database and gets
> rows from a given table and performs a specific task then deletes the
> row once finished. What I would like to do is have multiple instances
> of this script running to check for new additions to this table every
> 15 minutes or so. I am not sure how I can divide up the work to be
> processed among all running scripts with out having issues.
> 
> Currently the script does an .objects.all() call and runs through the
> entire list but as mentioned would like to find a way to divide this
> up and with out another instance trying to process a row that is being
> processed by another instance.
> 
> The main question would be how I can tell the script to not process a
> given row b/c another instance of the script is currently processing
> the row or is in its queue to be processed.
> 
> It would also be nice to be to have the ability to add or remove
> instances of the script in times when the table is more or less full
> with rows to process.

In other words, you need a persistent queue. Put things into the queue,
pop the leading element for next processing. There are a lot of options
around. Here's a reasonable place to start:

http://code.google.com/p/queues/

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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