Commit Graph

442 Commits

Author SHA1 Message Date
Vincent Driessen ad61c45f2f Update changelog. 2013-02-18 08:01:12 +01:00
Vincent Driessen a04169e561 Allow rqworker to run more silently. 2013-02-18 07:55:35 +01:00
Vincent Driessen 8005759cce Merge pull request #181 from selwin/del-on-nosuchjob
Safe fetching a deleted job removes the deleted job from queue.
2013-02-16 07:45:32 -08:00
Selwin Ong c987569650 Safe fetching a deleted job removes the deleted job from queue. 2013-02-16 18:50:37 +07:00
Vincent Driessen 501a3870e1 Ignore a job when there isn't a "data" key available. 2013-02-15 10:51:47 +01:00
Vincent Driessen 223e09f4fe Add rq.contrib.legacy.cleanup_ghosts() function, to clean up old mess. 2013-02-15 09:28:13 +01:00
Vincent Driessen f1d3da8ba2 Update changelog. 2013-02-15 08:53:45 +01:00
Vincent Driessen d39badb4cc Prevent the use of indefinite timeouts.
Using them would really mess with the new expiring worker keys (they
would disappear, even though the workers aren't dead).
2013-02-15 08:50:30 +01:00
Vincent Driessen e0866cdc6c Log the act of sending a heartbeat (DEBUG level). 2013-02-15 08:50:13 +01:00
Vincent Driessen e4d37332f0 Fix typos. 2013-02-15 08:49:30 +01:00
Vincent Driessen e8c1885eda Avoid negative timeouts when default_worker_ttl is < 60. 2013-02-15 08:49:18 +01:00
Vincent Driessen 640195d5e4 Merge branch 'master' into yaniv-aknin-worker_ttl 2013-02-15 08:08:32 +01:00
Vincent Driessen a7f927f845 Fix non-relative import. 2013-02-13 12:40:08 +01:00
Vincent Driessen 192770773a Remove unused import. 2013-02-13 12:40:08 +01:00
Vincent Driessen c0a594d47a Merge pull request #177 from selwin/master
FailedQueue.requeue should set job status back to Queued
2013-02-13 02:32:21 -08:00
Selwin Ong e5fa82aa5d Merge branch 'master' of github.com:selwin/rq 2013-02-13 11:51:15 +07:00
Selwin Ong 05d744c9af Requeuing a job should set its status back to Queued. 2013-02-13 11:50:40 +07:00
Vincent Driessen 4688498e2d Attach job ID when unpickling fails in .dequeue().
This makes the behaviour consistent with .dequeue_any().
2013-02-11 15:12:34 +01:00
Vincent Driessen 83525c42c7 Prevent against 'created_at' field being None. 2013-02-11 14:59:31 +01:00
Vincent Driessen 7d37c257ae Prepare for 0.3.6. 2013-02-06 23:28:03 +01:00
Vincent Driessen cd2a759be8 Add release date. 2013-02-06 23:26:52 +01:00
Vincent Driessen c427eda36c Bump version to 0.3.5. 2013-02-06 23:25:50 +01:00
Vincent Driessen 54254f2271 Patch the connection instances.
This patches the connection object (which is either a StrictRedis
instance or a Redis instance), to have alternative class methods that
behave exactly like their StrictRedis counterparts, no matter whether
which type the object is.  Only the ambiguous methods are patched.  The
exhaustive list:

- _zadd          (fixes argument order)
- _lrem          (fixes argument order)
- _setex         (fixes argument order)
- _pipeline      (always returns a StrictPipeline)
- _ttl           (fixes return value)
- _pttl          (fixes return value)

This makes it possible to call the methods reliably without polluting
the RQ code any further.
2013-02-06 22:54:20 +01:00
Vincent Driessen 67880343f1 Make inner_exception optional, and use new except syntax. 2013-01-31 16:28:24 +01:00
Idan Kamara 2baa2e370f job: save the real exception when unpickling fails
We raise our own exception which hides the real error (often an ImportError),
making it difficult to see what happend. Instead, save the original exception
too.
2013-01-30 14:28:26 +02:00
Yaniv Aknin 4925b09aa5 Set worker ttl and maintain it when idle/taking/finishing jobs
This change could use far better test coverage, but I'm not sure how to
test it without refactoring more of the code than I think is reasonable
in the scope of this work.
2013-01-26 22:58:51 +02:00
Yaniv Aknin 74c2351232 Refactor dequeue_any to accept arbitrary timeouts
The 'blocking' parameter was replaced with a 'timeout' parameter.

The timeout parameter is interpreted thus:
    0 - no timeout (block forever, equivalent to blocking=True)
    None - non-blocking (return value or None immediately, equivalent to
                         blocking=False)
    <integer> - maximum seconds to block

Upon timing out, a dequeue operation will raise DequeueTimeout.
2013-01-26 18:41:10 +02:00
Vincent Driessen 0bc451f75b Install importlib on Travis' py26 environment. 2013-01-24 10:17:46 +01:00
Vincent Driessen 36eb555981 Update Travis CI config file to use py.test. 2013-01-23 23:01:02 +01:00
Vincent Driessen 73e6017896 Add tox tests, for Python 2.6 and PyPy. 2013-01-23 22:57:44 +01:00
Vincent Driessen 06b48c2026 Use unittest2 for Python 2.6. 2013-01-23 22:43:30 +01:00
Vincent Driessen cc14d6f00b Update changelog. 2013-01-23 22:21:22 +01:00
Vincent Driessen 743cf3cd74 Merge branch 'vierja-ended_time' 2013-01-23 22:19:38 +01:00
Vincent Driessen 20d435a077 Prepare for 0.3.5. 2013-01-23 20:52:20 +01:00
Vincent Driessen f818fb5d43 Bump version to 0.3.4. 2013-01-23 20:49:42 +01:00
Vincent Driessen c7e54d8c1a Promote to 'beta' stage.
This should've been done on 0.3.0 already, actually.
2013-01-23 20:49:42 +01:00
Vincent Driessen e1b81b1669 Avoid new-style classes under Python 2.6.
Little ugly fix, required because Python 2.6's logging uses old-style
classes.  Thanks for finding this one, @deferraz.
2013-01-23 20:34:10 +01:00
Vincent Driessen 77fb32791d Include a copy of dictConfig in RQ, for Python 2.6 compat. 2013-01-23 16:38:31 +01:00
Vincent Driessen e29981a008 Bump to new development version. 2013-01-18 16:24:20 +01:00
Vincent Driessen 55bb32cb36 Release 0.3.3. 2013-01-18 15:51:17 +01:00
Vincent Driessen d4f5bcb817 Fix position of changelog entry. 2013-01-18 15:48:27 +01:00
Vincent Driessen d1c2b3b78d Merge branch 'selwin-remove-logbook'
Conflicts:
	rq/utils.py
	rq/worker.py
	setup.cfg
	setup.py
2013-01-18 15:47:21 +01:00
Vincent Driessen 37b3bb4bd4 Have Worker.work() setup logging.
Basically, I don't want to enforce users to configure _any_ logging
stack when writing a basic worker, like this:

    from rq import Worker, Queue, Connection

    with Connection():
        q = Queue()
        w = Worker([q])
        w.work(burst=True)

In case you want to disable logging altogether, you can configure your
logging stack to do so.
2013-01-18 15:42:18 +01:00
Vincent Driessen 90df03dc0b Add release notes. 2013-01-18 15:12:49 +01:00
Vincent Driessen 90b15fd0b6 Don't silently fail when unpickling.
When a pickled job string can't be unpickled because some required
module isn't loadable, this leads to an `UnpickleError` in the worker
(not in the horse).

Currently we just assume "garbage" in the job's data field, and silently
ignore it.

This is bad.

Really bad.

Because it avoids the normal exception handling mechanism that RQ has.

Historically, this "feature" was introduced to ignore any invalid pickle
data ("bad strings") on queues, and go on. However, we must assume data
inside `job.data` to be valid pickle data.

While an invalid _format_ of pickle data (e.g. the string "blablah"
isn't valid) leads to unpickle errors, unpickling errors will also occur
when the job can't be validly constructed in memory for other reasons,
like being unable to load a specific class.

Django is a good example of this: try submitting jobs that use
`django.conf.settings` while the `DJANGO_SETTINGS_MODULE` env var isn't
set. Currently, RQ workers will drop these jobs and dismiss them like
any non-valid pickle data. You won't be notified.

This patch changes RQ's behaviour to never ignore invalid string data on
any queue and _always_ handle these errors explicitly (but without
bringing the main loop down, of course).
2013-01-18 14:59:20 +01:00
Vincent Driessen 7216b1eedb Add .env.fish, for fish lovers. 2013-01-18 12:53:05 +01:00
Selwin Ong 40d0a7d9a9 Removed __main__ that was accidentally added to rqworker script. 2013-01-16 18:58:12 +07:00
Selwin Ong d1f586b413 Only configure logging handlers if not already present. 2013-01-16 18:53:32 +07:00
Javier Rey d660b611db ended_at time is now saved when job is finished 2013-01-12 16:37:25 -02:00
Selwin Ong f498de57b6 Always call job.save even on synchronous queues so get_current_job doesn't fail 2012-11-25 13:37:12 +01:00