770 Commits (4fc032bfbfbe45da4db2c3ce9f4aee535dbfa7df)

Author SHA1 Message Date
Vincent Driessen fcca48a9d7 Rename empty property -> is_empty() method. 13 years ago
Vincent Driessen 4d2f64d4b6 Mental note to self. 13 years ago
Vincent Driessen 20e908039f Initially set the exc_info property, so it does not raise an
AttributeException when accessed.
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
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.
13 years ago
Vincent Driessen db5753b0d6 Put Job in its own file. 13 years ago
Vincent Driessen 210477c2ab Throw DequeueError when reading unprocessable data from queue. 13 years ago
Vincent Driessen 62ae299114 Fix mathematical meaning of the < operator.
This is used for alphabetical queue ordering.
13 years ago
Vincent Driessen 5c6f002878 Silently pass when trying to kill child that is already dead.
This fixes #16.
13 years ago
Vincent Driessen 039a132374 Add ellipsis, to indicate we're waiting here. 13 years ago
Vincent Driessen 66775b7012 Put the version number somewhere central. 13 years ago
Vincent Driessen aecb0a1bf0 Simplify calling .work() or .work(burst=True). 13 years ago
Vincent Driessen 636b6690d6 Add the signal name to the debug message. 13 years ago
Vincent Driessen a154ef0bd9 Remove comment.
This ain't the right way to terminate when blocking by pop.
13 years ago
Vincent Driessen 62949c9adb Extra debug output. 13 years ago
Vincent Driessen dde3ea8ef7 Take down horse process when the worker is terminated. 13 years ago
Vincent Driessen 4ac243b3e8 Print what signal was received in a debug statement. 13 years ago
Vincent Driessen 7769d9875f Perform a warm shutdown on SIGTERM, too.
Just like with Ctrl+C (SIGINT), shutdown warmly at first when kill'ed
(SIGTERM).
13 years ago
Vincent Driessen 88cbaa1df9 Slight code reshuffle + added some comments on the construction. 13 years ago
Vincent Driessen 7cba8449d9 Add comments. 13 years ago
Vincent Driessen 1cbf92c166 Workaround for os.waitpid() throwing an OSError on SIGINT.
When SIGINT (``Ctrl+C``) is received when inside a blocking
os.waitpid(), OSError is thrown, effectively cancelling the wait.

However, to facilitate a "warm shutdown", as we intend, Ctrl+C is
perfectly allowed and we want to keep waiting for the child.  Therefore,
we perform a trick here, catching OSError, checking whether its cause
was SIGINT (errno == EINTR), and only in that case, loop to os.waitpid()
again.
13 years ago
Vincent Driessen e278bd2967 Exit gracefully when user hits Ctrl+C in a worker.
The currently running task will be waited for, so it can gracefully
be finished.  Further execution will be stopped.

If, during this waiting phase, Ctrl+C is hit again, the worker and the
horse will be terminated forcefully (this means work could be lost or
partially finished).
13 years ago
Vincent Driessen ba965a1dd9 Minor text change 13 years ago
Vincent Driessen 2d2b351f7c Change logging format. 13 years ago
Vincent Driessen 8678f26df0 Factor out call string. 13 years ago
Vincent Driessen 2ec12f1775 Fix bugje. 13 years ago
Vincent Driessen 1358246238 Better logging output. 13 years ago
Vincent Driessen 1dd73cb28d Fix comment. 13 years ago
Vincent Driessen cc8f05b3c6 Add __str__ to Job. 13 years ago
Vincent Driessen 55fd393626 Worker.find_by_key method now returns None for nonexisting workers. 13 years ago
Vincent Driessen 507558f6bc Avoid forked work horse to register death of its parent worker. 13 years ago
Vincent Driessen bd1778c610 Fix comment typo's. 13 years ago
Vincent Driessen 4ad6281641 Rewrite the ANSI color formatter a bit. 13 years ago
Vincent Driessen edcc012b2d Document the Queue class. 13 years ago
Vincent Driessen 45700fc788 Delete unused file. 13 years ago
Vincent Driessen c9ba66bd59 Register workers in a central set ("rq:workers"). 13 years ago
Vincent Driessen 1f12678468 Get Worker fetch methods. 13 years ago
Vincent Driessen 9e8a4d15be Document methods. 13 years ago
Vincent Driessen 6013227f4c Remove unused property. 13 years ago
Vincent Driessen aebfe74630 Add polling/scaling graphs. 13 years ago
Vincent Driessen a905961f94 Add some sample scripts. 13 years ago
Vincent Driessen a029e5437b Add beginnings of a rqworker script. 13 years ago
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.
13 years ago
Vincent Driessen a491ff248d Add simple helper function, to avoid users to learn about the `conn`
stack.

This makes it easier to start using the product.
13 years ago
Vincent Driessen 0ff2984adf Use __slots__, for minimal memory overhead. 13 years ago
Vincent Driessen 56c4445bb2 Shut up pyflakes. 13 years ago
Vincent Driessen b5ea5f32fe Variable renamed. 13 years ago
Vincent Driessen 8852859fc4 Improved the __repr__ and __str__ of Queues. 13 years ago
Vincent Driessen b4c1c85276 Add equality and comparison methods. 13 years ago
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.
13 years ago
Vincent Driessen f492a5ae2b Restructure some code.
No functional change, but leave the BLPOP'ing to the Queue, as the
queues know how to pop themselves.
13 years ago
Vincent Driessen 1a893e60cf Have work() return whether work has been done, or not.
And promote Worker to the rq namespace, so you can
    from rq import Worker
13 years ago
Vincent Driessen 1c9fa66bc1 Greatly simplify the setup.
Jobs don't even need to be tagged.  Any function can be put on queues.
13 years ago
Vincent Driessen 62b6b180f3 Also allow args and kwargs to enqueue() calls on Queue. 13 years ago
Vincent Driessen 196a9815d2 Add dequeue method to Queue. 13 years ago
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().
13 years ago
Vincent Driessen 407f3e8b38 Add ability to put work on alternate queues. 13 years ago
Vincent Driessen 1b8da4a861 Add test for putting work on queues. 13 years ago
Vincent Driessen 8dfdd452ef Bugfix.
Yeah, it's getting late.

It's my own fault.

I know.
13 years ago
Vincent Driessen 04c88577ed Bugfix: LPOP does not support multiple queue arguments.
Redis' BLPOP command takes multiple queue arguments, but LPOP can only
take a single queue.  Therefore, we need to loop over all queues
manually, in order, and raise an exception is no more work is available.
13 years ago
Vincent Driessen a77c3d9104 Support quitting when all work is done (i.e. queue is empty). 13 years ago
Vincent Driessen 8dc2b15a6e Remove empty file.
It is obsoleted by rq/proxy.py
13 years ago
Vincent Driessen 98ffcd8e05 Create soft dependency on logbook. 13 years ago
Vincent Driessen 227e107a82 Oops, fix some old references to current_connection. 13 years ago
Vincent Driessen d721f0708b Refactor the whole Redis connection stuff to be just as easy as in RDB. 13 years ago
Vincent Driessen 518db8c24b Add better connection management.
To start using RQ, push a Redis connection up its stack, like so:

    from rq import push_connection
    push_connection(Redis())
13 years ago
Vincent Driessen d8d388c841 Log the results of jobs. 13 years ago
Vincent Driessen f21b2af2b6 Make it an actual PyPI-managable Python package. 13 years ago