100 Commits (fd44ad39d49e1ea978384d1480653781fa75175c)

Author SHA1 Message Date
Selwin Ong fd44ad39d4 Python 3 fixes for job dependency stuff. 12 years ago
Selwin Ong fcfe55fe13 Merge branch 'master' into job_dependency
Conflicts:
	rq/job.py
	rq/queue.py
12 years ago
Vincent Driessen 1b558704d3 Fix: COMPACT_QUEUE should be a unique key.
This fixes #230.  Thanks, @sylvinus.
12 years ago
Vincent Driessen 90fcb6c9d0 PEP8ify. 12 years ago
Vincent Driessen 57ea6203d1 Let's not change positional argument order.
This may break other people's programs.
12 years ago
H. İbrahim Güngör 10bda9684d Pass description parameter to job constructor in order to distinguish job names in queue.jobs or in rq-dashboard. Add related test case. 12 years ago
Alex Morega 8d61d3bf26 port string handling to py3
Redis uses byte values for everything. We save queue names and job
IDs as unicode. So we need to convert every time we get data from redis.
12 years ago
Alex Morega a3b5ce5e46 accomodate py3 imports and builtins 12 years ago
Onilton Maciel 3afc32f08a End calculation in get_jobs_ids in fixed. Length is respected 12 years ago
Onilton Maciel 97de8ea3cc Fixed typos and errors found. Tests passing now 12 years ago
oniltonmaciel 5cfbae61a9 Replaced limit by length and start by offset
Replaced limit by length and start by offset to remove a possible ambiguity
12 years ago
Selwin Ong 6ee45597ca Don't fail if job dependency is modified during enqueue process. 12 years ago
Selwin Ong e7e8579888 Merge branch 'master' of git://github.com/nvie/rq into job_dependency
Conflicts:
	rq/queue.py
12 years ago
Selwin Ong 2e826e2b1f Internally renamed the term "parent" to "dependency". 12 years ago
Selwin Ong 0dfb041383 Simplify enqueue_waitlist by using lpop. 12 years ago
Selwin Ong 18ff57ef35 Avoid race conditions when enqueueing job with dependency. 12 years ago
Vincent Driessen 73b7453e40 Fix typo. 12 years ago
Vincent Driessen 2fb6e5ca1a Minor refactoring of the paging logic. 12 years ago
Alex Morega e3075ea6be get a page of jobs 12 years ago
Alex Morega ef0f04bff6 extract `safe_fetch_job` method 12 years ago
Selwin Ong 6550f86646 Don't enqueue waitlisted jobs on failed execution. 12 years ago
Selwin Ong eadc7db29f First stab at writing implementing job dependency. 12 years ago
Selwin Ong c987569650 Safe fetching a deleted job removes the deleted job from queue. 12 years ago
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).
12 years ago
Vincent Driessen e4d37332f0 Fix typos. 12 years ago
Vincent Driessen 640195d5e4 Merge branch 'master' into yaniv-aknin-worker_ttl 12 years ago
Vincent Driessen c0a594d47a Merge pull request #177 from selwin/master
FailedQueue.requeue should set job status back to Queued
12 years ago
Selwin Ong e5fa82aa5d Merge branch 'master' of github.com:selwin/rq 12 years ago
Selwin Ong 05d744c9af Requeuing a job should set its status back to Queued. 12 years ago
Vincent Driessen 4688498e2d Attach job ID when unpickling fails in .dequeue().
This makes the behaviour consistent with .dequeue_any().
12 years ago
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.
12 years ago
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.
12 years ago
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).
12 years ago
Selwin Ong f498de57b6 Always call job.save even on synchronous queues so get_current_job doesn't fail 13 years ago
Vincent Driessen 8581cd6463 Don't allow jobs without Redis connection.
And other connection-related fixes.
13 years ago
Vincent Driessen 4224304291 I like this implementation of an 'enum' better. 13 years ago
Selwin Ong 442b389b97 Job returning None as result are now persisted correctly.
Job status can now be checked via ``status`` property which should
return either "queued", "finished" or "failed".
13 years ago
Selwin Ong 06d75630e0 Execute job immediately if Queue(async=False) 13 years ago
Selwin Ong a5e6765990 Added "result_ttl" property on jobs that determines how long job results are persisted in Redis. 13 years ago
Vincent Driessen d697ddb93a Resolve connections early.
Fixes #101.
13 years ago
Vincent Driessen abac4a5f41 Since we only have the timeout option, don't be too generic. 13 years ago
Vincent Driessen f6374f2dfa Add new way of invoking .enqueue(), either implicitly or explicitly. 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 a032896453 Add means of specifying the job function using strings. 13 years ago
Goran Peretin 34d161eb11 requeueing preserves job timeout 13 years ago
Goran Peretin 317a58a3b5 quarantine preserves job timeout 13 years ago
Jonas 415a159ac3 Pass connection explicitly to Job.fetch 13 years ago
Vincent Driessen 697a4a89f8 Actually use any given default_timeout for queues. 13 years ago
Selwin Ong 5989228330 Queue.lpop should take connection as argument. 13 years ago