Re: Raw access to cache table

2014-12-23 Thread Collin Anderson
Hi Russ, Makes sense. Thanks. Collin On Sunday, December 21, 2014 5:41:34 PM UTC-6, Russell Keith-Magee wrote: > > > On Sun, Dec 21, 2014 at 12:55 PM, Collin Anderson > wrote: >> >> Hi Erik, >> >> If you want a nicer interface, I just ran manage.py inspecdb on one of my

Re: Raw access to cache table

2014-12-22 Thread Erik Cederstrand
Hi Russel, > Den 22/12/2014 kl. 00.40 skrev Russell Keith-Magee : > > If you *do* want to do complex queries on the database cache table, the > approach suggested by Collin is as good an approach as any. A managed table > will give you ORM operations over an arbitrary

Re: Raw access to cache table

2014-12-22 Thread Erik Cederstrand
Hi Colin, > Den 21/12/2014 kl. 05.55 skrev Collin Anderson : > > If you want a nicer interface, I just ran manage.py inspecdb on one of my > databases and got this for the cache table. Not sure why django still does it > by hand. > > class Cache(models.Model): >

Re: Raw access to cache table

2014-12-21 Thread Russell Keith-Magee
On Sun, Dec 21, 2014 at 12:55 PM, Collin Anderson wrote: > > Hi Erik, > > If you want a nicer interface, I just ran manage.py inspecdb on one of my > databases and got this for the cache table. Not sure why django still does > it by hand. > Gather `round, children, and let

Re: Raw access to cache table

2014-12-20 Thread Collin Anderson
Hi Erik, If you want a nicer interface, I just ran manage.py inspecdb on one of my databases and got this for the cache table. Not sure why django still does it by hand. class Cache(models.Model): cache_key = models.CharField(primary_key=True, max_length=255) value = models.TextField()

Re: Raw access to cache table

2014-12-19 Thread Erik Cederstrand
> Den 18/12/2014 kl. 12.20 skrev Erik Cederstrand : > > Hi list, > > I'm using Django as a hub to synchronize data between various external > systems. To do this, I have some long-running Django management commands that > are started as cron jobs. To ensure that

Re: Raw access to cache table

2014-12-18 Thread François Schiettecatte
Hi I use fcntl.flock() from the fcntl module. I have used this method in C, Perl and Python, works great. Happy to share code. François > On Dec 18, 2014, at 9:24 AM, Javier Guerra Giraldez > wrote: > > On Thu, Dec 18, 2014 at 6:20 AM, Erik Cederstrand >

Re: Raw access to cache table

2014-12-18 Thread Javier Guerra Giraldez
On Thu, Dec 18, 2014 at 6:20 AM, Erik Cederstrand wrote: > I'm using Django as a hub to synchronize data between various external > systems. To do this, I have some long-running Django management commands that > are started as cron jobs. To ensure that only one job is

Re: Raw access to cache table

2014-12-18 Thread Avraham Serour
I implemented a network lock using redis, the module had some other functionalities, but the basic lock class was: class Lock(): """ Regular behavior lock, works across the network, useful for distributed processes """ def __init__(self, name): self.redis =

Re: Raw access to cache table

2014-12-18 Thread Vijay Khemlani
I'm not sure that using a cache system as a lock mechanism is a good idea. What I would do is setup a task queue (using celery and rabbitMQ) with a single worker, that way you guarantee that only one task is running at a time and you can queue as many as you want. Also, each task has a maximum

Raw access to cache table

2014-12-18 Thread Erik Cederstrand
Hi list, I'm using Django as a hub to synchronize data between various external systems. To do this, I have some long-running Django management commands that are started as cron jobs. To ensure that only one job is working on a data set at any one time, I have implemented a locking system