72 Commits (abac4a5f41efe6c9faef7f8d1f28124c1fe94c3f)

Author SHA1 Message Date
Vincent Driessen d66939ff4a Don't use the (internal) .enqueue_call() in unit tests. 13 years ago
Vincent Driessen e6bb7de8c0 Get rid of the ambiguity when passing the timeout argument to .enqueue() calls. 13 years ago
Vincent Driessen f6e67431d7 Refactor the .enqueue() API to not gobble the timeout kwargs.
This fixes #98.
13 years ago
Vincent Driessen 3a8f30a53e Add test. 13 years ago
Vincent Driessen 604fce99a1 Merge with master. 13 years ago
Selwin Ong 1fb0a1bfac Modified ``Job`` ``save`` and ``refresh`` methods to support persisting
additional ``Job`` attributes into Redis.
13 years ago
Vincent Driessen cfbbc3d0ea Merge remote-tracking branch 'omarkhan/instance_methods' 13 years ago
Omar Khan 03bd49511d Allow instance methods to be enqueued
Only works for picklable instances
13 years ago
Goran Peretin 34d161eb11 requeueing preserves job timeout 13 years ago
Goran Peretin 317a58a3b5 quarantine preserves job timeout 13 years ago
Vincent Driessen f5951900c8 Make unit tests compatible with Python < 2.7. 13 years ago
Vincent Driessen b45770cd3c Fix unit test expressions. 13 years ago
Vincent Driessen 2982486448 New connection management.
Connections can now be set explicitly on Queues, Workers, and Jobs.
Jobs that are implicitly created by Queue or Worker API calls now
inherit the connection of their creator's.

For all RQ object instances that are created now holds that the
"current" connection is used if none is passed in explicitly.  The
"current" connection is thus hold on to at creation time and won't be
changed for the lifetime of the object.

Effectively, this means that, given a default Redis connection, say you
create a queue Q1, then push another Redis connection onto the
connection stack, then create Q2. In that case, Q1 means a queue on the
first connection and Q2 on the second connection.

This is way more clear than it used to be.

Also, I've removed the `use_redis()` call, which was named ugly.
Instead, some new alternatives for connection management now exist.

You can push/pop connections now:

    >>> my_conn = Redis()
    >>> push_connection(my_conn)
    >>> q = Queue()
    >>> q.connection == my_conn
    True
    >>> pop_connection() == my_conn

Also, you can stack them syntactically:

    >>> conn1 = Redis()
    >>> conn2 = Redis('example.org', 1234)
    >>> with Connection(conn1):
    ...     q = Queue()
    ...     with Connection(conn2):
    ...         q2 = Queue()
    ...     q3 = Queue()
    >>> q.connection == conn1
    True
    >>> q2.connection == conn2
    True
    >>> q3.connection == conn1
    True

Or, if you only require a single connection to Redis (for most uses):

    >>> use_connection(Redis())
13 years ago
Vincent Driessen c684949045 Don't expose the FailedQueue class at the top-level.
This fixes #36.
13 years ago
Vincent Driessen 98ea29b15a Don't expose the Job class at the top-level.
This partially fixes #37.
13 years ago
Vincent Driessen 2b6101d110 Move job from Worker to Job test suite. 13 years ago
Vincent Driessen 15342f14d3 Store pickled function calls as strings.
This aids unpacking in the case of a function that isn't importable from
the worker's runtime. The unpickling will now (almost) always succeed,
and throw an ImportError later on, when the function is actually
accessed (thus imported implicitly).

The end result is a job on the failed queue, with exc_info describing
the import error, which is tremendously useful.
13 years ago
Vincent Driessen 14ecb8e956 Add specifics on the "ImportError" to the message in case of an attribute error. 13 years ago
Vincent Driessen be8f7684aa Fix accidentally passing unit test. 13 years ago
Vincent Driessen 3c05f20d95 Flake8. 13 years ago
Vincent Driessen 844c5ed8c7 Add @slow wrapper to avoid running slow tests.
Use ./run_tests -f to only run the fast tests.
13 years ago
Vincent Driessen 91fff48389 Flake8. 13 years ago
Vincent Driessen e807748ee6 Test the timing out of jobs.
Really looking for a way to speed up this test.  It takes up a whole
second doing nothing now, really.
13 years ago
Vincent Driessen 9ac9c23412 Flake8. 13 years ago
Vincent Driessen 7ef3b5ade8 Cleanup job hashes for jobs without result, too. 13 years ago
Vincent Driessen f07d28db86 Organize test fixtures into a separate file. 13 years ago
Vincent Driessen 5717a0ba15 Rename Job.for_call() -> Job.create().
This fixes #34.
13 years ago
Vincent Driessen 7e0b843d06 Implement requeue() method on FailedQueue. 13 years ago
Vincent Driessen 8e85c7eee3 Put Job directly in the top-level `rq` module. 13 years ago
Vincent Driessen 06ce9622ea Add compact() method on Queues, to remove dead messages. 13 years ago
Vincent Driessen 80a615a61c Flake8 style fixes. 13 years ago
Vincent Driessen e4055ca42f Allow queues to be emptied. 13 years ago
Vincent Driessen 9e33e1a08f Implement a cancel() method on jobs.
This fixes #29.
13 years ago
Vincent Driessen 53f55ba986 Flake8 style fixes in the test suite. 13 years ago
Vincent Driessen 11c7dbb376 Consistently renamed "failure" -> "failed" queue.
Fixes #28.
13 years ago
Vincent Driessen 7bda1ca969 Encapsulate the result property (it should not directly be set). 13 years ago
Vincent Driessen 8da204f74a Always use cPickle, never 'regular' pickle.
This fixes #18.
13 years ago
Vincent Driessen 9318825429 Abstract away from the concrete pickle implementation.
Choose cPickle, if available, for best performance.
13 years ago
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.
13 years ago
Vincent Driessen e05acfedce Fix putting jobs on the failure queue when they fail. 13 years ago
Vincent Driessen 7c903e45ef Simplify the persistence of jobs.
Fixes #23 and #24.
13 years ago
Vincent Driessen 370399f8f7 CHECKPOINT: dequeue_any now returns the queue that was popped from. 13 years ago
Vincent Driessen f516f8df2e CHECKPOINT: Handle failing and unreadable jobs.
Failing (or unreadable) jobs are correctly put on the failure queue by
the worker now.
13 years ago
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.
13 years ago
Vincent Driessen 65105b44c3 CHECKPOINT: Initial part of the big refactor. 13 years ago
Vincent Driessen 7fff52d99c Get rid of ugly custom assertion. 13 years ago
Vincent Driessen fcca48a9d7 Rename empty property -> is_empty() method. 13 years ago
Vincent Driessen fdce187c27 Putting failed jobs on the failure queue. 13 years ago
Vincent Driessen 7eb8d92605 Put unreadable tasks on the failure queue. 13 years ago
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.
13 years ago