Commit Graph

103 Commits

Author SHA1 Message Date
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
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
Vincent Driessen 10237ddcb4 Merge branch 'job-access-within-job'
Conflicts:
	CHANGES.md
	rq/job.py
2012-11-25 13:36:09 +01:00
Ulrich Petri 43038d3150 Added tests for config file loading 2012-11-24 14:53:22 +01:00
Vincent Driessen 5e59c6e28e Rename the const. 2012-09-14 09:56:10 +02:00
Scott Burns 538bbb1b55 Decorator accepts result_ttl argument 2012-09-13 11:07:52 -05:00
Vincent Driessen 8cb6a21670 Only store custom properties when they're written to the meta dict. 2012-09-03 11:54:40 +02:00
Vincent Driessen 5e80aa27eb Fix comment. 2012-09-02 23:10:35 +02:00
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.
2012-09-02 23:00:13 +02:00
Vincent Driessen 372de4b45a Implement the get_current_job() function.
This fixes #125.
2012-09-02 22:38:46 +02:00
Vincent Driessen 879a87d158 Remove logbook and replace it with logging.
This reverts commit 1ab8c19696 and
reintroduces all changes made by @dstufft.

Still, it needs more patches to reeanble the default log-to-console
behaviour.  See #121.
2012-09-02 11:26:31 +02:00
Vincent Driessen 1ab8c19696 Revert "Remove logbook and replace it with logging".
This reverts the commit range f367c38..978ba2d.

Issue #121 is currently blocking the 0.3.1 release.
2012-08-30 21:35:44 +02:00
Vincent Driessen 781f3e0460 Add test for custom exc handling. 2012-08-29 13:21:48 +02:00
Vincent Driessen 6b0ebe9ceb Remove is_done property.
It is too similar to is_finished.
2012-08-27 12:10:20 +02:00
Vincent Driessen 9549b34d60 Add convenience accessor properties for status. 2012-08-27 09:47:09 +02:00
Vincent Driessen 4224304291 I like this implementation of an 'enum' better. 2012-08-27 09:40:59 +02:00
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".
2012-08-25 17:58:15 +07:00
Vincent Driessen f06ef9c975 Merge branch 'selwin-async-2'
This fixes #114.
2012-08-23 09:51:18 +02:00
Vincent Driessen 83369f3b9b Prefer `result` over `return_value`.
`return_value` still is available as a backward-compatible accessor.

This fixes #116.
2012-08-23 09:27:27 +02:00
Selwin Ong 06d75630e0 Execute job immediately if Queue(async=False) 2012-08-22 17:21:22 +07:00
Donald Stufft a08c983efc Fix tests to use logging 2012-08-21 11:46:35 -04:00
Vincent Driessen 5fcedbcdad Change assertEqual to assertGreaterThan, to make the test a little less
brittle (on slow machines).
2012-08-07 11:05:50 +02:00
Selwin Ong a5e6765990 Added "result_ttl" property on jobs that determines how long job results are persisted in Redis. 2012-08-07 14:34:51 +07:00
Selwin Ong a4f1de358f Raise a StopException when Control+C is pressed. 2012-07-26 09:36:50 +07:00
Vincent Driessen d697ddb93a Resolve connections early.
Fixes #101.
2012-07-24 12:37:59 +02:00
Vincent Driessen c7225ba257 Minor bug in test case. 2012-07-24 12:30:37 +02:00
Vincent Driessen 35dedf3db4 Make test descriptions show up in short (oneliner) mode, as ./run_tests does. 2012-07-24 11:15:23 +02:00
Vincent Driessen ea19bdc910 Merge branch 'new-enqueue' into selwin-decorator 2012-07-24 11:13:44 +02:00
Selwin Ong 8c3292d35b Make "queue" argument in job decorator required.
job decorator now uses Queue's "enqueue_call" method.
2012-07-24 16:03:49 +07:00
Vincent Driessen d66939ff4a Don't use the (internal) .enqueue_call() in unit tests. 2012-07-24 10:51:58 +02:00
Selwin Ong ae97f862dc Merge branch 'master' into decorator 2012-07-24 15:34:03 +07:00
Vincent Driessen e6bb7de8c0 Get rid of the ambiguity when passing the timeout argument to .enqueue() calls. 2012-07-23 11:50:32 +02:00
Vincent Driessen f6e67431d7 Refactor the .enqueue() API to not gobble the timeout kwargs.
This fixes #98.
2012-07-23 11:39:22 +02:00
Selwin Ong bdc1af28d1 Added a job decorator. 2012-07-23 13:25:31 +07:00
Vincent Driessen 3a8f30a53e Add test. 2012-07-18 14:13:13 +02:00
Vincent Driessen 604fce99a1 Merge with master. 2012-07-17 22:37:03 +02:00
Selwin Ong 1fb0a1bfac Modified ``Job`` ``save`` and ``refresh`` methods to support persisting
additional ``Job`` attributes into Redis.
2012-07-17 20:23:01 +07:00
Vincent Driessen cfbbc3d0ea Merge remote-tracking branch 'omarkhan/instance_methods' 2012-07-17 14:09:45 +02:00
Omar Khan 03bd49511d Allow instance methods to be enqueued
Only works for picklable instances
2012-07-17 11:48:41 +01:00
Goran Peretin 34d161eb11 requeueing preserves job timeout 2012-07-17 08:41:24 +02:00
Goran Peretin 317a58a3b5 quarantine preserves job timeout 2012-07-17 08:39:20 +02:00
Vincent Driessen f5951900c8 Make unit tests compatible with Python < 2.7. 2012-05-18 08:35:23 +02:00
Vincent Driessen b45770cd3c Fix unit test expressions. 2012-05-18 08:35:02 +02:00
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())
2012-03-23 15:10:49 +01:00
Vincent Driessen c684949045 Don't expose the FailedQueue class at the top-level.
This fixes #36.
2012-03-21 15:25:03 +01:00
Vincent Driessen 98ea29b15a Don't expose the Job class at the top-level.
This partially fixes #37.
2012-03-21 15:05:58 +01:00
Vincent Driessen 2b6101d110 Move job from Worker to Job test suite. 2012-03-21 13:18:01 +01:00
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.
2012-03-21 13:09:52 +01:00
Vincent Driessen 14ecb8e956 Add specifics on the "ImportError" to the message in case of an attribute error. 2012-03-16 15:51:46 +01:00
Vincent Driessen be8f7684aa Fix accidentally passing unit test. 2012-03-16 14:21:00 +01:00