Commit Graph

37 Commits

Author SHA1 Message Date
Vincent Driessen 7bda1ca969 Encapsulate the result property (it should not directly be set). 2012-02-13 16:43:27 +01:00
Vincent Driessen 8da204f74a Always use cPickle, never 'regular' pickle.
This fixes #18.
2012-02-13 13:59:24 +01:00
Vincent Driessen 9318825429 Abstract away from the concrete pickle implementation.
Choose cPickle, if available, for best performance.
2012-02-13 13:59:24 +01:00
Vincent Driessen 39f106cdb3 Have the test suite find an empty Redis database.
Since the test suite `flushdb()`'s after running each test, we should
make sure the database is empty before we even start running tests.
This patch will make sure to never destroy any local production data
inside the running Redis instance.

This fixes #25.
2012-02-13 09:08:33 +01:00
Vincent Driessen e05acfedce Fix putting jobs on the failure queue when they fail. 2012-02-10 17:19:30 +01:00
Vincent Driessen 7c903e45ef Simplify the persistence of jobs.
Fixes #23 and #24.
2012-02-10 17:18:51 +01:00
Vincent Driessen 370399f8f7 CHECKPOINT: dequeue_any now returns the queue that was popped from. 2012-02-08 17:55:38 +01:00
Vincent Driessen f516f8df2e CHECKPOINT: Handle failing and unreadable jobs.
Failing (or unreadable) jobs are correctly put on the failure queue by
the worker now.
2012-02-08 15:18:27 +01:00
Vincent Driessen b1650cb9b9 CHECKPOINT: Second part of the big refactoring.
Jobs are now stored in separate keys, and only job IDs are put on Redis
queues.  Much of the code has been hit by this change, but it is for the
good.

No really.
2012-02-08 14:18:17 +01:00
Vincent Driessen 65105b44c3 CHECKPOINT: Initial part of the big refactor. 2012-02-08 00:40:43 +01:00
Vincent Driessen 7fff52d99c Get rid of ugly custom assertion. 2012-02-07 20:59:29 +01:00
Vincent Driessen fcca48a9d7 Rename empty property -> is_empty() method. 2012-02-07 20:53:06 +01:00
Vincent Driessen fdce187c27 Putting failed jobs on the failure queue. 2012-01-30 20:55:52 +01:00
Vincent Driessen 7eb8d92605 Put unreadable tasks on the failure queue. 2012-01-30 19:41:13 +01:00
Vincent Driessen 0be1cb6ac0 Change the way jobs are pickled.
There is no job tuple anymore, but instead Jobs are picklable by
themselves natively.  Furthermore, I've added a way to annotate Jobs
with created_at and enqueued_at timestamps, to drive any future Job
performance stats.  (And to enable requeueing, while keeping hold of the
queue that the Job originated from.)

This fixes #17.
2012-01-30 16:52:28 +01:00
Vincent Driessen 0503eb2829 Clarified responsibility of the Job class.
The Job itself has nothing to do with queueing and dequeueing, so the
DequeueError wasn't appropriate here, either.
2012-01-28 09:00:02 +01:00
Vincent Driessen 1f64157c38 Broke down tests into multiple files. 2012-01-28 07:58:40 +01:00
Vincent Driessen 210477c2ab Throw DequeueError when reading unprocessable data from queue. 2012-01-27 15:17:14 +01:00
Vincent Driessen 2c72d94ebd Run class initializations only once. 2011-11-27 08:00:41 +01:00
Vincent Driessen 068db4cb35 Shut up logbook during tests. 2011-11-26 09:32:19 +01:00
Vincent Driessen aecb0a1bf0 Simplify calling .work() or .work(burst=True). 2011-11-26 09:31:14 +01:00
Vincent Driessen 213ac73e19 Remove blinker dependency. 2011-11-24 16:57:01 +01:00
Vincent Driessen fd3831f8f2 Fix b0rken test case due to new naming conventions. 2011-11-21 13:27:34 +01:00
Vincent Driessen d780c929c0 Change semantics of work(). Add work_burst().
work() will now start the worker run loop, and work_burst() now leads to
the burst-then-quit behaviour.
2011-11-17 22:39:53 +01:00
Vincent Driessen b4c1c85276 Add equality and comparison methods. 2011-11-16 12:45:16 +01:00
Vincent Driessen a5ea45af57 Make the dequeue methods return values consistent.
I merely refactored the internal calls. No external API changes have been made in this commit. In order to make the dequeueing methods consistent, each dequeue method now returns a Job instance, which is just a nice lightweight wrapper around the job tuple.

The Job class makes it easier to pass the method call info around, along with some possible meta information, like the queue the job originated from.

This fixes #7.
2011-11-16 12:44:33 +01:00
Vincent Driessen 1c9fa66bc1 Greatly simplify the setup.
Jobs don't even need to be tagged.  Any function can be put on queues.
2011-11-15 21:18:35 +01:00
Vincent Driessen 62b6b180f3 Also allow args and kwargs to enqueue() calls on Queue. 2011-11-15 09:36:38 +01:00
Vincent Driessen 159eba6df2 Add arg to test case. 2011-11-15 09:36:35 +01:00
Vincent Driessen fc5097ce7a Better test naming. 2011-11-15 09:36:32 +01:00
Vincent Driessen 196a9815d2 Add dequeue method to Queue. 2011-11-15 09:36:29 +01:00
Vincent Driessen b5e0377eb0 Allow jobs to be declared without a default queue.
This makes it impossible to use delay() on them.  Instead, you should
use enqueue().
2011-11-15 09:36:18 +01:00
Vincent Driessen 407f3e8b38 Add ability to put work on alternate queues. 2011-11-15 08:38:12 +01:00
Vincent Driessen 1b8da4a861 Add test for putting work on queues. 2011-11-15 08:13:16 +01:00
Vincent Driessen d721f0708b Refactor the whole Redis connection stuff to be just as easy as in RDB. 2011-11-14 21:32:49 +01:00
Vincent Driessen 05e83c5231 Add a very minor beginning to the test cases. 2011-11-14 14:18:21 +01:00
Vincent Driessen c45e056786 Add some project meta stuff. 2011-11-14 12:11:58 +01:00