176 Commits (165b7ae6b93c378416db65cc8fc83f557f38345a)

Author SHA1 Message Date
foxx 0466562a13 Fixes from comments in #415
Added tox/vagrant tmp dir to gitignore
Removed unused import
Renamed id to job_id in enqueue_call() as per comments in #415
10 years ago
Selwin Ong 60c7a3cc6e working_queue.remove call should be pipelined. 10 years ago
foxx b6499ce71c Fixed another py3 bug - my bad. Also moved type checking further down 10 years ago
foxx f5779c194f Renamed job_id to id, and fixed py3 bug, per #415 10 years ago
foxx 2753f17e8e Fixed bug with format() in py3 11 years ago
foxx 72bc9e37b7 Forced job_id to only allow str/unicode 11 years ago
foxx 6bb8b26114 Allow job ID to be set on enqueue/enqueue_call() - fixes #412 11 years ago
Vincent Driessen 3de8a47f06 Merge pull request #390 from selwin/pipeline-dependency-registration
job.register_dependency() should support pipelining
11 years ago
Selwin Ong fc19a64670 job.register_dependency() should support pipelining. 11 years ago
Vincent Driessen b91b89a183 Use highest pickle protocol version to serialize job data. 11 years ago
Vincent Driessen 79db282879 Support enqueueing callable classes.
Fixes #388.
11 years ago
Vincent Driessen 865efd6e8c Leave setting the state to the worker, not the Job itself.
Should fix #389.
11 years ago
Vincent Driessen eb6fb27281 Change confusing method name. 11 years ago
Vincent Driessen 6299af15fc Merge branch 'master' of github.com:nvie/rq 11 years ago
Selwin Ong 638211df20 job.cancel() should remove itself from queue. 11 years ago
Andrew Gorcester 17a4ed056d use warnings.warn() instead of raise for DeprecationWarning 11 years ago
Vincent Driessen ab9e6b852e Fix PEP8 complaints. 11 years ago
Vincent Driessen 38ec259b6e Enable the most modern Python syntax. 11 years ago
Vincent Driessen 4746602c57 Explicit string check in Job constructor. 11 years ago
Vincent Driessen 057c4657ef Fix whitespace. 11 years ago
Vincent Driessen fdf4abcf69 Fix pipeline call. 11 years ago
Selwin Ong 835c353380 Job status should be updated during job.perform(). 11 years ago
Selwin Ong f5c3c9a6dd Deprecate job.status. 11 years ago
Malthe Borch ad529e2609 Add repr for (showing id and enqueue time). 11 years ago
Sylvain Zimmer f0a3dd262e Added connection argument to get_current_job() 11 years ago
Vincent Driessen 44233709ed Allow two-way setting of job data properties.
As a side-effect, this also enables us to lazily load the data.
11 years ago
Vincent Driessen 66a554bc29 Change AssertionError to proper TypeError. 11 years ago
Malthe Borch ce3924c901 Just use a regular private method along with 'property'. 11 years ago
Malthe Borch c898fe618e Move seemingly general purpose decorator into class scope, use and delete.
Also, reduce repeat attribute declarations, at the cost of a
requirement that decorated functions appear in the right order.
11 years ago
Malthe Borch ba0b39a43b Unpickle job data lazily. This fixes issue #294. 11 years ago
Malthe Borch c5a381fbe9 Remove dependency on 'times' library (see issue #286).
Basically, for the functionality needed, a dependency on 'times' (which
in turn depends on 'python-dateutil') seem unnecessary.
11 years ago
Selwin Ong e4589a4641 job.cancel() should be pipelined. 11 years ago
Vincent Driessen af87cce382 Merge branch 'selwin-custom-worker' 11 years ago
Selwin Ong 28dcb5dcd1 Renamed "--worker" flag to "--worker-class". 11 years ago
Selwin Ong 8aa5771646 job.cancel() now deletes dependents_key 11 years ago
Vincent Driessen 7fdd115e28 Merge branch 'jchia-master'
Conflicts:
	rq/job.py
	rq/queue.py
11 years ago
Vincent Driessen bb3dc5b0b2 Terminology change: waitlist -> dependents. 11 years ago
Joshua Chia b89d6c8990 Set timeout at Job creation instead of during enqueueing; made Queue.enqueue_call respect `timeout` when `after` is specified 11 years ago
Selwin Ong 15c4b562ba Reverse dependency mapping should be a set instead of a list. 11 years ago
Selwin Ong 93e5e552b7 Replaced "after" kwarg with "depends_on". 11 years ago
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 537476b488 PEP8ify. 12 years ago
Sylvain Zimmer a296619074 Split Job.dump() and Job.save() 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 328e7611d3 use utf-8 instead of ascii 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 6eeee85cc3 remove backwards compat for custom properties 12 years ago
Alex Morega a3b5ce5e46 accomodate py3 imports and builtins 12 years ago
Alex Morega a75ea0d693 changes by python-modernize 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 eadc7db29f First stab at writing implementing job dependency. 12 years ago
Selwin Ong a0c9267550 Job.create should also accept arguments in list format. 12 years ago
Vincent Driessen 5a5e14cc70 Merge branch 'hotfix/0.3.7'
Conflicts:
	CHANGES.md
	rq/version.py
12 years ago
Vincent Driessen 66741fff7b Fix bug where workers would not execute builtin functions properly. 12 years ago
Selwin Ong 85e9014296 Moved some logic from worker.perform_job() to job.cleanup(). 12 years ago
Vincent Driessen 501a3870e1 Ignore a job when there isn't a "data" key available. 12 years ago
Vincent Driessen 192770773a Remove unused import. 12 years ago
Vincent Driessen 83525c42c7 Prevent against 'created_at' field being None. 12 years ago
Vincent Driessen 67880343f1 Make inner_exception optional, and use new except syntax. 12 years ago
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.
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
Vincent Driessen 10237ddcb4 Merge branch 'job-access-within-job'
Conflicts:
	CHANGES.md
	rq/job.py
12 years ago
Timo Steidle 881b944283 Changed status "Running" into "started" to be more consistent with the other statuses 13 years ago
Timo Steidle 8787cfbb30 Added new job status "Running" 13 years ago
Vincent Driessen 7ff6ed72da Add backward compat (will be removed in 0.4).
This is to support users that are relying on the current custom property
implementation.  A warning will be displayed on the console, stating
that this support will be removed from RQ version 0.4.
13 years ago
Vincent Driessen 8cb6a21670 Only store custom properties when they're written to the meta dict. 13 years ago
Vincent Driessen 4b66d7af41 Merge branch 'master' into job-access-within-job
Conflicts:
	rq/job.py
13 years ago
Vincent Driessen 8581cd6463 Don't allow jobs without Redis connection.
And other connection-related fixes.
13 years ago
Vincent Driessen 95d3aed98e Store the job ID on the internal stack.
It does so instead of the instance itself.  Still returns the job---the
interface hasn't changed.
13 years ago
Vincent Driessen 372de4b45a Implement the get_current_job() function.
This fixes #125.
13 years ago
Vincent Driessen 781f3e0460 Add test for custom exc handling. 13 years ago
Vincent Driessen a017756748 Fetch fresh status value on every request.
It could probably require a bit of caching, to prevent too many fetches
per time slot (for example, return the locally cached value if that
value is as fresh as a second or so).

This fixes #120.
13 years ago
Vincent Driessen 6b0ebe9ceb Remove is_done property.
It is too similar to is_finished.
13 years ago
Vincent Driessen 9549b34d60 Add convenience accessor properties for status. 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
Vincent Driessen f06ef9c975 Merge branch 'selwin-async-2'
This fixes #114.
13 years ago
Vincent Driessen e2a0d83eee Whoops. 13 years ago
Vincent Driessen 83369f3b9b Prefer `result` over `return_value`.
`return_value` still is available as a backward-compatible accessor.

This fixes #116.
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 f6e67431d7 Refactor the .enqueue() API to not gobble the timeout kwargs.
This fixes #98.
13 years ago
Vincent Driessen 8436d9b2c8 PEP8ify. 13 years ago
Vincent Driessen 1a178d673b Fix bug where results wasn't correctly unpickled when refreshing from Redis. 13 years ago
Vincent Driessen a032896453 Add means of specifying the job function using strings. 13 years ago
Vincent Driessen 074af72536 Minor fix for empty dict check. 13 years ago
Selwin Ong 809874ee83 Don't store Job's "_instance" attribute in Redis. 13 years ago
Vincent Driessen 604fce99a1 Merge with master. 13 years ago
Selwin Ong 1fb0a1bfac Modified ``Job`` ``save`` and ``refresh`` methods to support persisting
additional ``Job`` attributes into Redis.
13 years ago
Omar Khan 03bd49511d Allow instance methods to be enqueued
Only works for picklable instances
13 years ago
mattdennewitz 9f2f9e367c Class methods now use given "cls" 13 years ago
Vincent Driessen 2982486448 New connection management.
Connections can now be set explicitly on Queues, Workers, and Jobs.
Jobs that are implicitly created by Queue or Worker API calls now
inherit the connection of their creator's.

For all RQ object instances that are created now holds that the
"current" connection is used if none is passed in explicitly.  The
"current" connection is thus hold on to at creation time and won't be
changed for the lifetime of the object.

Effectively, this means that, given a default Redis connection, say you
create a queue Q1, then push another Redis connection onto the
connection stack, then create Q2. In that case, Q1 means a queue on the
first connection and Q2 on the second connection.

This is way more clear than it used to be.

Also, I've removed the `use_redis()` call, which was named ugly.
Instead, some new alternatives for connection management now exist.

You can push/pop connections now:

    >>> my_conn = Redis()
    >>> push_connection(my_conn)
    >>> q = Queue()
    >>> q.connection == my_conn
    True
    >>> pop_connection() == my_conn

Also, you can stack them syntactically:

    >>> conn1 = Redis()
    >>> conn2 = Redis('example.org', 1234)
    >>> with Connection(conn1):
    ...     q = Queue()
    ...     with Connection(conn2):
    ...         q2 = Queue()
    ...     q3 = Queue()
    >>> q.connection == conn1
    True
    >>> q2.connection == conn2
    True
    >>> q3.connection == conn1
    True

Or, if you only require a single connection to Redis (for most uses):

    >>> use_connection(Redis())
13 years ago
Vincent Driessen 6bc173f122 Bugfix. 13 years ago
Vincent Driessen 28216cf63a Implement the requeue_job() top-level API function.
This completely fixes #37.
13 years ago
Vincent Driessen 98ea29b15a Don't expose the Job class at the top-level.
This partially fixes #37.
13 years ago
Vincent Driessen 0b837b4b12 Don't warn. In fact, we rely on this the more. 13 years ago
Vincent Driessen 15342f14d3 Store pickled function calls as strings.
This aids unpacking in the case of a function that isn't importable from
the worker's runtime. The unpickling will now (almost) always succeed,
and throw an ImportError later on, when the function is actually
accessed (thus imported implicitly).

The end result is a job on the failed queue, with exc_info describing
the import error, which is tremendously useful.
13 years ago
Vincent Driessen 14ecb8e956 Add specifics on the "ImportError" to the message in case of an attribute error. 13 years ago