168 Commits (7bf100ebe794179847b774f458857fb3bc6234c2)

Author SHA1 Message Date
Stefan Hammer a0cee2d2a0 refactored worker code
Moved code into a new handle_job_success() method and reduced context of used
pipelines.
8 years ago
Stefan Hammer 44f98693c7 added a test for the race condition 8 years ago
Samuel Colvin bbf50f4893 use compat for PY2 test and add tests 9 years ago
Yannis Spiliopoulos 4a8aa0921f Set test timeout to original value 9 years ago
Yannis Spiliopoulos fbb29ec333 Investigating timeouts 9 years ago
Yannis Spiliopoulos 94d5caed15 Make clearer the puprose of test 9 years ago
Yannis Spiliopoulos 3362fe2ba5 Test killing work_horse after we start monitoring 9 years ago
Yannis Spiliopoulos c00d3681f9 Failing test to demonstrate issue #702
Test that demonstrates that if a work-horse process is terminated unexpectedly
the job being processed could be stuck at the "Started" state
(https://github.com/nvie/rq/issues/702)
9 years ago
Samuel Colvin 0e26db9e08 correct wording in docstring and tests 9 years ago
Samuel Colvin 9f9c887645 better function names and process double SIGRTMIN 9 years ago
Samuel Colvin 2b544e5b17 add tests to HerokuWorker 9 years ago
Arnold Krille 8e99706b16 run python 3.5 on travis, adopt timeouts
Also
- Report the five slowest tests to watch for risk of timeout
- Double timeouts.
  Maybe that helps pypy on travis to finish successfully.
9 years ago
Arnold Krille df22f127eb Test the worker in its own subprocess
- run with an empty queue
- schedule one job (which uses get_current_connection and get_current_job) and
run `rqworker`
- schedule a job that itself schedules `access_self` and run `rqworker`
- Make sure the job didn't fail by assuring the failed queue is still empty
  afterwards.
- Install this package locally when running in travis.
  This actually unifies the behaviour of tox and travis as tox also builds the
  package and then installs it into each test environment.
- fix flake8 (as run by tox)
9 years ago
Selwin Ong 766bb60006 Merge branch 'dependent-jobs-with-result-ttl' 9 years ago
Selwin Ong e9d227c3df Dependent jobs are now correctly enqueued even if their parent jobs have result_ttl=0. 9 years ago
amyangfei 724c844378 Don't call job.cancel if job has finished 9 years ago
Arnold Krille 9df0a853d8 Fix indentation and newlines according to flake8 9 years ago
Antoine Leclair 81679a35d9 Merge branch 'master' into custom-queue-class
Conflicts:
	tests/test_worker.py
9 years ago
Antoine Leclair cc1eb9c52b Remove test that failed on Travis CI 9 years ago
Antoine Leclair 173417f337 Remove test that failed on Travis CI 9 years ago
Antoine Leclair 05ed85804c Worker accepts custom queue class 9 years ago
Antoine Leclair 7275f62737 Add tests for custom job class in worker 9 years ago
Antoine Leclair 5c72417cda Do not use deprecated assertEquals 9 years ago
Selwin Ong 640b2e31a0 Merge pull request #633 from olingerc/warmshutdown
Save date on which a busy worker receives a warm shutdown request
9 years ago
orangain e8165fdddf Accept byte strings as the first argument of Worker() in Python 2
This make it easy to write Python 2/3 compatible code.
e.g.

    Worker(sys.argv[1:])

    # Without from __future__ import unicode_literals
    Worker(['high', 'normal', 'low'])
9 years ago
Christophe Olinger b47c8efe27 Add test cases for shutdown_requested_date 9 years ago
Christophe Olinger 3e586bd6d6 Add remove current_job based on the correct upstream master branch 9 years ago
Selwin Ong 5afd1a90e5 Merge pull request #589 from samuelcolvin/job-started_at
add job.started_at
9 years ago
ahxxm b06f112cb0 fix tests
syntax: assertEquals -> assertEqual, assertNotEquals -> assertNotEqual
usage: status of worker and job now will use get/set method instead of property method
9 years ago
Samuel Colvin 3aa7aebf87 remove assert_dt_between from worker tests 9 years ago
Samuel Colvin 1349e90ba2 test docstrings, and sentinel test 9 years ago
Samuel Colvin 082e61a212 add job.started_at 9 years ago
Samuel Colvin aada162a4d worker shutdown tests 9 years ago
Selwin Ong 3c3646cf91 Merge branch 'master' into exception_handling
Conflicts:
	tests/fixtures.py
10 years ago
Vincent Driessen ec0e04727b Rename `maintenance_date` -> `last_cleaned_at` 10 years ago
Vincent Driessen 4d0ae5da98 Clean up type checking of Worker constructor 10 years ago
Selwin Ong f370f79819 Merge pull request #534 from selwin/registry-maintenance
Worker automatically cleans job registries every hour
10 years ago
Selwin Ong c3767e28e2 Worker now runs maintenance tasks every hour and on startup. 10 years ago
Selwin Ong 5782ac10c4 Added worker.clean_registries(). 10 years ago
RyanMTB 9a00b0eca6 Updated Worker API 10 years ago
Mark LaPerriere 636a537fa7 updates addressing @selwin comments for PR #465 10 years ago
Bradley Young d56b5424c8 merging master and fixing conflicts 10 years ago
Mark LaPerriere 450c5969aa call register birth in the register birth test 10 years ago
Mark LaPerriere af5a8624a6 add tests for birth and death worker methods 10 years ago
Vincent Driessen b8d425b318 Various PEP8 fixes. 10 years ago
Vincent Driessen fac2b10309 Auto-sort imports using isort. 10 years ago
Bradley Young d3e4fb567b merge && updates to add multiple exception handlers. 10 years ago
Jonathan Tushman 60c27d5a27 fixing xrange for python3 compatability 10 years ago
Jonathan Tushman 1ae5a12a81 merging master 10 years ago
Jonathan Tushman ccd41396f6 adding suspend with duration test 10 years ago
Jonathan Tushman 82333d2ad5 triggering shutdown by setting a redis flag 10 years ago
Travis Johnson 6ef9177a7d 2.6 compatible set syntax 10 years ago
Travis Johnson de72f98fbe test for workers equality 10 years ago
Adam Wen cd0230cae3 make job description unicode friendly 10 years ago
Vincent Driessen 7686785d61 Merge branch 'selwin-working-queue'
Conflicts:
	tests/test_worker.py
10 years ago
Vincent Driessen 4b7c59d68d Fix PEP8 complaints. 10 years ago
Selwin Ong 9341a4a33d Renamed WorkingQueue to StartedJobRegistry. 10 years ago
Selwin Ong 4d90cc062e Add job to WorkingQueue before execution and remove from WorkingQueue after. 10 years ago
foxx 52c3ad0fbf Renamed to SimpleWorker 10 years ago
foxx 23cae3a420 Fixed bug caused by broken merge, my bad 10 years ago
foxx 16ee71f26d Use class for test worker, and performs PID check in unit tests, #412 10 years ago
Vincent Driessen 12932a433b Merge pull request #382 from selwin/cancel-should-remove-from-queue
job.cancel() should remove itself from queue
11 years ago
Selwin Ong 638211df20 job.cancel() should remove itself from queue. 11 years ago
Selwin Ong 7ac1c3500a Worker.__init__ should accept custom job class. 11 years ago
Vincent Driessen ab9e6b852e Fix PEP8 complaints. 11 years ago
Vincent Driessen 38ec259b6e Enable the most modern Python syntax. 11 years ago
Selwin Ong f5c3c9a6dd Deprecate job.status. 11 years ago
Selwin Ong 2fe5d9e25e Python 3 compatibility with worker.get_current_job(). 11 years ago
Selwin Ong 802ecb5ccb Renamed worker.set_job_id() and worker.get_job_id() for consistency. 11 years ago
Selwin Ong 93bb9ec5f4 Added tests for worker.get_current_job(). 11 years ago
Vincent Driessen 85a7a14a4c Replace substring in Pickle string differently.
Pickle uses a new format since Python 3, which is incompatible with
Python 2.  This problem now pops up because the replacement string had
a different length, so we broke the pickle protocol with this test.
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
Joshua Chia ef2bbe762b Minor cleanup: Use Status enums instead of strings 11 years ago
Vincent Driessen bb3dc5b0b2 Terminology change: waitlist -> dependents. 11 years ago
Selwin Ong 93e5e552b7 Replaced "after" kwarg with "depends_on". 11 years ago
Selwin Ong fcfe55fe13 Merge branch 'master' into job_dependency
Conflicts:
	rq/job.py
	rq/queue.py
11 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
Selwin Ong 18ff57ef35 Avoid race conditions when enqueueing job with dependency. 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
Vincent Driessen 640195d5e4 Merge branch 'master' into yaniv-aknin-worker_ttl 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 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.
12 years ago
Vincent Driessen 781f3e0460 Add test for custom exc handling. 12 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 83369f3b9b Prefer `result` over `return_value`.
`return_value` still is available as a backward-compatible accessor.

This fixes #116.
13 years ago
Vincent Driessen 5fcedbcdad Change assertEqual to assertGreaterThan, to make the test a little less
brittle (on slow machines).
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 d66939ff4a Don't use the (internal) .enqueue_call() in unit tests. 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 3a8f30a53e Add test. 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 98ea29b15a Don't expose the Job class at the top-level.
This partially fixes #37.
13 years ago
Vincent Driessen 2b6101d110 Move job from Worker to Job test suite. 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