84 Commits (7bda1ca969700baa5dc94c22758a8e61d93b6ab9)

Author SHA1 Message Date
Vincent Driessen 7bda1ca969 Encapsulate the result property (it should not directly be set). 14 years ago
Vincent Driessen 6266f68310 Style fixes (flake8). 14 years ago
Vincent Driessen 8da204f74a Always use cPickle, never 'regular' pickle.
This fixes #18.
14 years ago
Vincent Driessen 9318825429 Abstract away from the concrete pickle implementation.
Choose cPickle, if available, for best performance.
14 years ago
Vincent Driessen 90a458ca8e Add more colorful terminal output.
For better visual parsability.
14 years ago
Vincent Driessen 63ef198fd6 Improve work generator. 14 years ago
Vincent Driessen 791f8169f5 Remove dead code. 14 years ago
Vincent Driessen e05acfedce Fix putting jobs on the failure queue when they fail. 14 years ago
Vincent Driessen 7c903e45ef Simplify the persistence of jobs.
Fixes #23 and #24.
14 years ago
Vincent Driessen bffe6cbbde Encapsulate internal function call representation.
This means it's not allowed anymore to directly set func, args, and
kwargs.  Instead, use the for_call() constructor.
14 years ago
Vincent Driessen 370399f8f7 CHECKPOINT: dequeue_any now returns the queue that was popped from. 14 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.
14 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.
14 years ago
Vincent Driessen 65105b44c3 CHECKPOINT: Initial part of the big refactor. 14 years ago
Vincent Driessen fcca48a9d7 Rename empty property -> is_empty() method. 14 years ago
Vincent Driessen 4d2f64d4b6 Mental note to self. 14 years ago
Vincent Driessen 20e908039f Initially set the exc_info property, so it does not raise an
AttributeException when accessed.
14 years ago
Vincent Driessen fdce187c27 Putting failed jobs on the failure queue. 14 years ago
Vincent Driessen 7eb8d92605 Put unreadable tasks on the failure queue. 14 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.
14 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.
14 years ago
Vincent Driessen db5753b0d6 Put Job in its own file. 14 years ago
Vincent Driessen 210477c2ab Throw DequeueError when reading unprocessable data from queue. 14 years ago
Vincent Driessen 62ae299114 Fix mathematical meaning of the < operator.
This is used for alphabetical queue ordering.
14 years ago
Vincent Driessen 5c6f002878 Silently pass when trying to kill child that is already dead.
This fixes #16.
14 years ago
Vincent Driessen 039a132374 Add ellipsis, to indicate we're waiting here. 14 years ago
Vincent Driessen 66775b7012 Put the version number somewhere central. 14 years ago
Vincent Driessen aecb0a1bf0 Simplify calling .work() or .work(burst=True). 14 years ago
Vincent Driessen 636b6690d6 Add the signal name to the debug message. 14 years ago
Vincent Driessen a154ef0bd9 Remove comment.
This ain't the right way to terminate when blocking by pop.
14 years ago
Vincent Driessen 62949c9adb Extra debug output. 14 years ago
Vincent Driessen dde3ea8ef7 Take down horse process when the worker is terminated. 14 years ago
Vincent Driessen 4ac243b3e8 Print what signal was received in a debug statement. 14 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).
14 years ago
Vincent Driessen 88cbaa1df9 Slight code reshuffle + added some comments on the construction. 14 years ago
Vincent Driessen 7cba8449d9 Add comments. 14 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.
14 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).
14 years ago
Vincent Driessen ba965a1dd9 Minor text change 14 years ago
Vincent Driessen 2d2b351f7c Change logging format. 14 years ago
Vincent Driessen 8678f26df0 Factor out call string. 14 years ago
Vincent Driessen 2ec12f1775 Fix bugje. 14 years ago
Vincent Driessen 1358246238 Better logging output. 14 years ago
Vincent Driessen 1dd73cb28d Fix comment. 14 years ago
Vincent Driessen cc8f05b3c6 Add __str__ to Job. 14 years ago
Vincent Driessen 55fd393626 Worker.find_by_key method now returns None for nonexisting workers. 14 years ago
Vincent Driessen 507558f6bc Avoid forked work horse to register death of its parent worker. 14 years ago
Vincent Driessen bd1778c610 Fix comment typo's. 14 years ago
Vincent Driessen 4ad6281641 Rewrite the ANSI color formatter a bit. 14 years ago
Vincent Driessen edcc012b2d Document the Queue class. 14 years ago