Commit Graph

79 Commits

Author SHA1 Message Date
Vincent Driessen 5dba007222 Add script to calculate project size.
This will help keep the "lightweight" claim up.
2011-11-24 16:56:14 +01:00
Vincent Driessen 88cbaa1df9 Slight code reshuffle + added some comments on the construction. 2011-11-24 16:21:52 +01:00
Vincent Driessen 7cba8449d9 Add comments. 2011-11-24 15:52:15 +01:00
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.
2011-11-24 15:42:01 +01:00
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).
2011-11-24 14:26:21 +01:00
Vincent Driessen ba965a1dd9 Minor text change 2011-11-22 07:36:46 +01:00
Vincent Driessen 2d2b351f7c Change logging format. 2011-11-21 22:41:50 +01:00
Vincent Driessen 8678f26df0 Factor out call string. 2011-11-21 20:52:05 +01:00
Vincent Driessen 2ec12f1775 Fix bugje. 2011-11-21 17:12:47 +01:00
Vincent Driessen 1358246238 Better logging output. 2011-11-21 17:10:58 +01:00
Vincent Driessen 1dd73cb28d Fix comment. 2011-11-21 15:01:52 +01:00
Vincent Driessen d291f1dc4a Text fix. 2011-11-21 14:46:48 +01:00
Vincent Driessen ec4da2b3ad Add sort-by-queue flag. 2011-11-21 14:31:17 +01:00
Vincent Driessen cc8f05b3c6 Add __str__ to Job. 2011-11-21 14:10:15 +01:00
Vincent Driessen fd3831f8f2 Fix b0rken test case due to new naming conventions. 2011-11-21 13:27:34 +01:00
Vincent Driessen 55fd393626 Worker.find_by_key method now returns None for nonexisting workers. 2011-11-21 13:24:00 +01:00
Vincent Driessen 507558f6bc Avoid forked work horse to register death of its parent worker. 2011-11-21 13:23:31 +01:00
Vincent Driessen bd1778c610 Fix comment typo's. 2011-11-21 13:22:38 +01:00
Vincent Driessen 0f38cfdd84 Add rqinfo -w command, to monitor active workers. 2011-11-21 13:21:45 +01:00
Vincent Driessen 4ad6281641 Rewrite the ANSI color formatter a bit. 2011-11-21 10:52:23 +01:00
Vincent Driessen edcc012b2d Document the Queue class. 2011-11-21 10:25:18 +01:00
Vincent Driessen 45700fc788 Delete unused file. 2011-11-21 09:56:15 +01:00
Vincent Driessen c9ba66bd59 Register workers in a central set ("rq:workers"). 2011-11-18 17:32:43 +01:00
Vincent Driessen 1f12678468 Get Worker fetch methods. 2011-11-18 16:55:29 +01:00
Vincent Driessen 9e8a4d15be Document methods. 2011-11-18 16:55:18 +01:00
Vincent Driessen 6013227f4c Remove unused property. 2011-11-18 16:54:54 +01:00
Vincent Driessen aebfe74630 Add polling/scaling graphs. 2011-11-18 01:56:23 +01:00
Vincent Driessen 15c4efd2e1 Generate less intensive work. 2011-11-18 01:56:18 +01:00
Vincent Driessen a905961f94 Add some sample scripts. 2011-11-18 01:44:28 +01:00
Vincent Driessen a029e5437b Add beginnings of a rqworker script. 2011-11-18 00:51: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 d761dd0280 Add BSD license, copied from git-flow. 2011-11-17 15:22:47 +01:00
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.
2011-11-17 13:29:32 +01:00
Vincent Driessen 0ff2984adf Use __slots__, for minimal memory overhead. 2011-11-16 19:12:19 +01:00
Vincent Driessen ced001cbb9 Update README with some project values. 2011-11-16 00:53:56 +01:00
Vincent Driessen 56c4445bb2 Shut up pyflakes. 2011-11-16 12:46:25 +01:00
Vincent Driessen b5ea5f32fe Variable renamed. 2011-11-16 12:46:10 +01:00
Vincent Driessen 8852859fc4 Improved the __repr__ and __str__ of Queues. 2011-11-16 12:45:59 +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 f492a5ae2b Restructure some code.
No functional change, but leave the BLPOP'ing to the Queue, as the
queues know how to pop themselves.
2011-11-16 01:05:38 +01:00
Vincent Driessen 652ced2580 Add sources of inspiration. 2011-11-16 00:37:59 +01:00
Vincent Driessen f15f6d7843 Fix terminology. 2011-11-15 23:31:53 +01:00
Vincent Driessen 83e29ca987 Document how to start a worker. 2011-11-15 23:00:55 +01:00
Vincent Driessen 22f3da1832 Update README (and example). 2011-11-15 22:45:51 +01:00
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
2011-11-15 22:44:17 +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