1128 Commits (af2dfb14460db9d0c7883c6b9381bd06e3ab607d)

Author SHA1 Message Date
thomas 01ebe25f56 Address Deleted Dependencies
1) Check if `created_at` when checking if dependencies are met.

   If `created_at` is `None` then the job has been deleted. This is sort of hack - we just need one of the fields on the job's hash that is ALWAYS populated. You can persist a job to redis without setting status...

2) Job#fetch_dependencies no longer raises NoSuchJob.

   If one of a job's dependencies has been deleted from Redis, it is not returned from `fetch_dependencies` and no exception is raised.
5 years ago
thomas 83fa6b2386 Revert move of status update in `Worker#handle_job_success`
When a job with dependents is _successful_ it's dependents are enqueued. Only if the FINISHing job's `result_ttl` is non-zero is the change in status persisted in Redis - that is, when each dependent job is enqueued, the _FINISHing_ job (,triggering the enqueueing,) has an _outdated_ status in redis. This avoids redundant call because if `result_ttl=0` then the job is deleted then deleted in `Job#cleanup`.

In order to enqueue the dependents, we therefore _exclude_ the FINISHing job from the check if each dependents' dependencies have been met.
5 years ago
thomas 9f15df2d55 rename dependencies_finished to dependencies_are_met 5 years ago
Thomas Matecki d5921814e4 Change get_dependency_statuses to dependencies_finished
Convert method on Job to return a boolean and rename. Also use
fetch_many in Queue#enqueue_dependents.
5 years ago
Thomas Matecki a69d91d2b2 Do not watch dependency key set 5 years ago
thomas 540be93401 Undo extra formatting changes 5 years ago
thomas 7ea5a32a55 Alway set status 'FINISHED' when job is Successful
Method Queue#enqueue_dependents checks the status of all dependencies of all dependents, and enqueues those dependents for which all dependencies are FINISHED.

The enqueue_dependents method WAS called from Worker#handle_job_success called BEFORE the status of the successful job was set in Redis, so enqueue_dependents explicitly excluded the _successful_ job from interrogation of dependency statuses as the it would never be true in the existing code path, but it was assumed that this would be final status after the current pipeline was executed.

This commit changes Worker#handle_job_success so that it persists the status of the successful job to Redis, everytime a job completes(not only if it has a ttl) and does so before enqueue_dependents is called. This allows for enqueue_dependents to be less reliant on the out of band state of the current _successful job being handled_.
5 years ago
thomas 4a64244f40 Only enqueue dependents for all dependencies are FINISHED 5 years ago
Thomas Matecki ee215a1853 Create get_dependencies_statuses method on Job
This method shall be used in Queue#enqueue_dependendents to determine if all of a dependents' dependencies have been _FINISHED_.
5 years ago
Pierre Mdawar 0dd9ff0ec9
Accept lowercase logging level names and accept tuples when setting exception handlers (#1233)
* Accept lowercase logging level names

* Accept both lists and tuples when setting Worker exception_handlers
5 years ago
Babatunde Olusola e1cbc3736c
Implement Customizable Serializer Support (#1219)
* Implement Customizable Serializer Support

* Refractor serializer instance methods

* Update tests with other serializers

* Edit function description

* Edit function description

* Raise appropriate exception

* Update tests for better code coverage

* Remove un-used imports and un-necessary code

* Refractor resolve_serializer

* Remove un-necessary alias from imports

* Add documentation

* Refractor tests, improve documentation
5 years ago
Paweł Bąk d914343e7c
Add sentry_debug and sentry_ca_certs params (#1229)
Co-authored-by: pawel bak <p.bak@inteliclinic.com>
5 years ago
Selwin Ong cfe389bd65
FailedJobRegistry.requeue() resets job.started_at and job.ended_at (#1227) 5 years ago
Selwin Ong 636d6d2f54
registry.cleanup() now writes information to job.exc_info (#1226) 5 years ago
Selwin Ong a090e9e840
Remove unused code (#1214) 5 years ago
Selwin Ong add0b171ec Bump version to 1.3.0 5 years ago
Samuel Colvin 4036471203
fixing HerokuWorkerShutdownTestCase after #1194 (#1213) 5 years ago
Selwin Ong 8a0153efc8 Properly decode hostname in job.refresh() 5 years ago
Selwin Ong d8bd455c12
enqueue_at should support explicit args and kwargs (#1211) 5 years ago
Seamus Mac Conaonaigh 8f7dbf1b1d
Pass job ID to error handlers (#1201)
The worker handles exceptions in the job outside of the job's own context, so an exception handler / logger cannot call `get_current_job()` to obtain the job ID. The job ID can be used to locate the job in the failed job registry, which allows useful behaviors such as linking to a failed job on a dashboard in an error report.

Closes #1192.
5 years ago
wevsty dc299bc7ec
fix kill_horse will cause zombie processes (#1194)
* fix kill_horse will cause zombie processes

fix issue #1193

* Update tips message
5 years ago
Bo Bayles 42457eed9b
Add rq.cli.__main__ (#1196) 5 years ago
Tim Gates a49680f789
Fix simple typo: constrast -> contrast (#1200)
Closes #1199
5 years ago
Zach Kanzler 2e245a7b4e
Respect timeout -1 in worker hard kill (#1187) 5 years ago
Selwin Ong f18a951eec Bump version to 1.2.2 5 years ago
Selwin Ong fda4b35f46
Fixes Job.fetch when return value is unpickleable (#1184)
* Fixes Job.fetch when return value is unpickleable

* Fixed connection test in newer versions of Redis
5 years ago
Selwin Ong 90e032cd64 Bump version to 1.2.1 5 years ago
Ivan Kiryanov ed67de22c6 Add job status setting in enqueue_at (and in enqueue_in) methods (#1181)
* Add job status setting in enqueue_at (and in enqueue_in) methods

Update tests for this change
Closes: #1179

* Add status param to create_job func, rework enqueue_at status setting
5 years ago
Selwin Ong ccfd4a02cb
Failed jobs will now auto expire (#1182) 5 years ago
Selwin Ong 927fb5a3ed Bump version to 1.2.0 5 years ago
mr-trouble 5f949f4cef Add a hard kill from the parent process with a 10% increased timeout … (#1169)
* Add a hard kill from the parent process with a 10% increased timeout in case the forked process gets stuck and cannot stop itself.

* Added test for the force kill of the parent process.

* Changed 10% to +1 second, and other misc changes based on review comments.
5 years ago
Florian Perucki 37a6304a4f fix: use correct logging handler for scheduler (#1178) 5 years ago
Selwin Ong baa0cc268a
Job scheduling (#1163)
* First RQScheduler prototype

* WIP job scheduling

* Fixed Python 2.7 tests

* Added ScheduledJobRegistry.get_scheduled_time(job)

* WIP on scheduler's threading mechanism

* Fixed test errors

* Changed scheduler.acquire_locks() to instance method

* Added scheduler.prepare_registries()

* Somewhat working implementation of RQ scheduler

* Only call stop_scheduler if there's a scheduler present

* Use OSError rather than ProcessLookupError for PyPy compatibility

* Added `auto_start` argument to scheduler.acquire_locks()

* Make RQScheduler play better with timezone

* Fixed test error

* Added --with-scheduler flag to rq worker CLI

* Fix tests on Python 2.x

* More Python 2 fixes

* Only call `scheduler.start` if worker is run in non burst mode

* Fixed an issue where running worker with scheduler would fail sometimes

* Make `worker.stop_scheduler()` more resilient to errors

* worker.dequeue_job_and_maintain_ttl() should also periodically run maintenance tasks

* Scheduler can now work with worker in both burst and non burst mode

* Fixed scheduler logging message

* Always log scheduler errors when running

* Improve scheduler error logging message

* Removed testing code

* Scheduler should periodically try to acquire locks for other queues it doesn't have

* Added tests for scheduler.should_reacquire_locks

* Added queue.enqueue_in()

* Fixes queue.enqueue_in() in Python 2.7

* First stab at documenting job scheduling

* Remove unused methods

* Remove Python 2.6 logging compatibility code

* Remove more unused imports

* Added convenience methods to access job registries from queue

* Added test for worker.run_maintenance_tasks()

* Simplify worker.queue_names() and worker.queue_keys()

* Updated changelog to mention RQ's new job scheduling mechanism.
5 years ago
Yongtao Zhang 5bb5fda1a6 fix log level parameter override, Fixes #1166 (#1167) 5 years ago
Thomas Matecki 80c82f731f Multi Dependency Support - Registration & Enqueue Call (#1155)
* Multi Dependency Support - Registration & Enqueue Call

Internal API changes to support multiple dependencies.
* Store all of a job's _dependencies_ in a redis set. Delete that set when a job is deleted.
* Add Job#fetch_dependencies method - which return all jobs a job is dependent upon and optionally _WATCHES_ all dependency ids.
* Use Job#fetch_dependencies in Queue#call_enqueue. `fetch_dependencies` now sets WATCH and raises InvalidJobDependency, rather than call_enqueue.

`Queue` and `Job` public APIs still expect single ids of jobs for `depends_on` but internally register them in a way that could support multiple jobs being passed as dependencies.

Next up: need to update Queue#enqueue_dependents

* Use existing fetch_many method to get dependencies.

Modify fetch_dependencies to use fetch_many.

* Remove default value for fetch_many's connection parameter

* PR review housekeeping

* Remove a duplicate test
* Oneline something
* Fix missing colon in dependencies key
* Delete job key, dependents and dependencies at once

* More Fixes From Code Review

Updates to Job, Queue and associated tests.

* When Checking dependencies Avoid, trip to Redis

* When checking the status of a job, we have a 'clean' status of all dependencies(returned from Job#fetch_dependencies) and the job keys are WATCHed, so there's no reason to go back to Redis to get the status _again_.
* Looks as though, the `_status` set in `Job#restore` was bytes while it was converted to text(`as_text`) in `Job#get_status` - for consistency(and tests) converting to text in `restore` as well.
* In `Queue#enqueue_call`, moved WATCH of dependencies_key to before fetching dependencies. This doesn't really matter but seems more _correct_ - one can imagine some rogue API adding a dependency after they've been fetched but before they've been WATCHEed.

* Update Job#get_status to get _local_ status

* If refresh=False is passed, don't get status from Redis; return the value of _status. This is to avoid a trip to Redis if the caller can guarantee that the value of `_status` is _clean_.

* More Fixups

* Expire dependency keys in Job#cleanup
* Consistency in Job#fetch_dependencies
5 years ago
Selwin Ong af678243e1
Added `delete_job` argument to registry.remove()` (#1161) 5 years ago
Yongtao Zhang 5bb03b9c2c Fix rq info not found workers information error, Fixes #1139 (#1149)
* Fix rq info not found workers information error, Fixes #1139

* Add test(#1149)
5 years ago
Thomas Matecki 75644ba948 Multi Dependency Support [Internal API Changes] (#1147)
* Convert `_dependency_id` to `_dependency_ids`

Change `Job`s tracking from a single id of it's dependencies from a single _id_ to a list of _id_s. This change should be private to `Job` - especially leaving `Job#to_dict` and `Job#restore`s treatment of a single 'dependency_id' intact.

This change modifies existing tests.

* Remove reliance upon dependency property in tests

... use dependency.id not  `_dependency_id`

* Re-add assertions for Falsey Values

* Add _dependency_id property

For backwards compatibility with other libs such as django-rq and rq-scheduler
5 years ago
Ivan Piskunov cfc02816ea Fix dependent jobs enqueueing (#1145)
If Queue was subclassed and enqueue_job changed, these changes should affect on dependent jobs' enqueueing too.
5 years ago
Selwin Ong e43bce4467 worker.register_birth() should use hmset 5 years ago
Vladimir Protasov 8c34e2b353 Store worker's RQ and Python versions (#1125)
* Store worker version to Redis

* Store worker's Python version to Redis

* Store worker version in __init__ body as suggested in review
5 years ago
Andy Lulham 1a382e761f Fix where -> were typo (#1121) 5 years ago
Bartłomiej Biernacki 51efc20371 Add failure_ttl on job decorator (#1130)
Without it you cannot specify custom timeout for failed jobs created using decorator
5 years ago
Selwin Ong dc63b362e2 Bump version to 1.1.0 6 years ago
Chyroc d0884be929 otp: reuse utcnow (#1115) 6 years ago
Selwin Ong f9d42e8a17
Added logging statements to handle_job_success and handle_job_failure (#1112) 6 years ago
Selwin Ong b14c4e288d
Added checks for 0 ttl (#1110) 6 years ago
Joe b52bad3ad0 Replace procname with setproctitle (#1108) 6 years ago
Selwin Ong 549648bd1b
rq info management command now cleans up registries when first run (#1107)
* rq info management command now cleans up registries when first run

* Deleted print statement

* Improve CLI test coverage

* Fixed CLI test on Linux
6 years ago
Selwin Ong 905824e8d8
Improve worker start/stop logging messages (#1105) 6 years ago
Paul Robertson e1c135d4de add the ability to have the worker stop executing after a max amount of jobs (#1094)
* add the ability to have the worker stop executing after a max amount of jobs

* rename to max-jobs

* updated logging messages
6 years ago
janierdavila d191adbeb9 Fixes disable-job-desc-logging flag on CLI (#1096)
PR #991 introduced this useful flag but it seems to have missed
passing this flag to the worker. This simple commit fixes that
issue.
6 years ago
秋葉 e40fc393b2 remove unused code (#1092) 6 years ago
Ted Summer 79a6fd7999 Fix timeout adding job to StartedJobRegistry (#1086)
* Fix timeout adding job to StartedJobRegistry

* Fix prepare_job_execution handling neg timeout

* Add test for inf job timeout in StartedJobRegistry

* refactor(worker): simplify checking neg timeout
6 years ago
Selwin Ong 7021cedaf9
Implemented Job.fetch_many (#1072) 6 years ago
Selwin Ong c4cbb3af2f
RQ v1.0! (#1059)
* Added FailedJobRegistry.

* Added job.failure_ttl.

* queue.enqueue() now supports failure_ttl

* Added registry.get_queue().

* FailedJobRegistry.add() now assigns DEFAULT_FAILURE_TTL.

* StartedJobRegistry.cleanup() now moves expired jobs to FailedJobRegistry.

* Failed jobs are now added to FailedJobRegistry.

* Added FailedJobRegistry.requeue()

* Document the new `FailedJobRegistry` and changes in custom exception handler behavior.

* Added worker.disable_default_exception_handler.

* Document --disable-default-exception-handler option.

* Deleted worker.failed_queue.

* Deleted "move_to_failed_queue" exception handler.

* StartedJobRegistry should no longer move jobs to FailedQueue.

* Deleted requeue_job

* Fixed test error.

* Make requeue cli command work with FailedJobRegistry

* Added .pytest_cache to gitignore.

* Custom exception handlers are no longer run in reverse

* Restored requeue_job function

* Removed get_failed_queue

* Deleted FailedQueue

* Updated changelog.

* Document `failure_ttl`

* Updated docs.

* Remove job.status

* Fixed typo in test_registry.py

* Replaced _pipeline() with pipeline()

* FailedJobRegistry no longer fails on redis-py>=3

* Fixes test_clean_registries

* Worker names are now randomized

* Added a note about random worker names in CHANGES.md

* Worker will now stop working when encountering an unhandled exception.

* Worker should reraise SystemExit on cold shutdowns

* Added anchor.js to docs

* Support for Sentry-SDK (#1045)

* Updated RQ to support sentry-sdk

* Document Sentry integration

* Install sentry-sdk before running tests

* Improved rq info CLI command to be more efficient when displaying lar… (#1046)

* Improved rq info CLI command to be more efficient when displaying large number of workers

* Fixed an rq info --by-queue bug

* Fixed worker.total_working_time bug (#1047)

* queue.enqueue() no longer accepts `timeout` argument (#1055)

* Clean worker registry (#1056)

* queue.enqueue() no longer accepts `timeout` argument

* Added clean_worker_registry()

* Show worker hostname and PID on cli (#1058)

* Show worker hostname and PID on cli

* Improve test coverage

* Remove Redis version check when SSL is used

* Bump version to 1.0

* Removed pytest_cache/README.md

* Changed worker logging to use exc_info=True

* Removed unused queue.dequeue()

* Fixed typo in CHANGES.md

* setup_loghandlers() should always call logger.setLevel() if specified
6 years ago
Wolfgang Langner abf6881114 Fix #1040 queue default timeout bug. (#1042)
Add test for queue default_timeout.
6 years ago
Wolfgang Langner 8fc987dc68 Make logging in worker consitent. (#1030)
Switch some messages from warn to info because it is normal requested bahavior.
6 years ago
Chyroc d9798fd64f refactor: job status check (#1035) 6 years ago
Chyroc 7eb95bf405 refactor: use try ImportError instead of py-version check (#1034) 6 years ago
Wolfgang Langner 7a6abb4738 Fix collections abc import deprecation warning. (#1032)
* Fix collections abc import.
Prepare for 3.8 when it is deprecated.

* Fix Pyton 2.7 build.
6 years ago
Finnci 14db0ecd26 Update/add flag for description logging (#991)
* test workers

* indent

* add docs and add option to the cli

* rename flag for cli

* logging
6 years ago
Selwin Ong bf0b4308fd Bump version to 0.13.0 6 years ago
Darshan Rai ada2ad03ca modify zadd calls for redis-py 3.0 (#1016)
* modify zadd calls for redis-py 3.0

redis-py 3.0 changes the zadd interface that accepts a single
mapping argument that is expected to be a dict.
https://github.com/andymccurdy/redis-py#mset-msetnx-and-zadd

* change FailedQueue.push_job_id to always push a str

redis-py 3.0 does not attempt to cast values to str and is left
to the user.

* remove Redis connection patching

Since in redis-py 3.0, Redis == StrictRedis class, we no longer
need to patch _zadd and other methods.
Ref: https://github.com/rq/rq/pull/1016#issuecomment-441010847
6 years ago
Selwin Ong 6559b0ffd7
Replace "timeout" argument in queue.enqueue() with "job_timeout" (#1010) 6 years ago
John Stowers eaf598d73c Pass job_id to death penalty class (#936)
This allows custom workers to use associated
custom Timeout classes and apply custom timeouts
or less messy death methods
6 years ago
Selwin Ong 47d291771f
SimpleWorker's ttl must always be longer than jobs. (#1002) 6 years ago
Qingping Hou 051104b0ff support workder name override from config file (#947)
* support workder name override from config file

* update docs for NAME config

* Update workers.md
6 years ago
Selwin Ong e00ff97867
Fix heroku worker (#993)
* Attempt to fix HerokuWorker test.

* Fixed test_shutdown_double_sigrtmin

* Another attempt to fix test

* Another attempt to fix test

* Another attempt to fix test

* When work horse runs into an exception, raise that exception before calling os._exit()
6 years ago
Selwin Ong 25f2b75b1f Horse should exit with return code 1 if it raises an exception 6 years ago
Selwin Ong 4759c43067 horse should always call os._exit(0) 6 years ago
shikharsg cc19d1a89e added logging formatting options (#979)
* added logging formatting options

* added docs for log formatting options

* fixed naming format
6 years ago
Paul Robertson e86fb57366 add is_async property to queue (#982) 6 years ago
Selwin Ong 6a376191d9 Bump version to 0.12.0 7 years ago
chevell c2b939d2df Replace 'async' keyword with 'is_async' for Queue objects (#977)
* Replaced async keyword with is_async in the Queue class to fix reserved keyword syntax errors in Python 3.7

* Updated tests to use is_async keyword when instantiating Queue objects

* Updated docs to reference is_async keyword for Queue objects

* Updated tox.ini, setup.py and .travis.yml with references to Python 3.7
7 years ago
Selwin Ong a5596caf42 Bump version to 0.11.0 7 years ago
Theofanis Despoudis 875cc27c2f #908 Using a timeout string value for job works (#955)
Fixes https://github.com/rq/rq/issues/908
7 years ago
Theofanis Despoudis d6b12c2402 Issue 872 (#954)
* Fixes #872 - Use -1 to indicate infinite ttl

* Fixes #872 Restored comma

* #872 Code review fix
7 years ago
Selwin Ong 531fde8e3c worker.main_work_horse should always return 0 7 years ago
Thomas Kriechbaumer 3133d94b58 add periodic worker heartbeats (#945)
* add periodic worker heartbeats

fixes #944

* improve worker default option handling
7 years ago
Selwin Ong c639018fb9 Registry objects can be instantiated by passing a queue object. 7 years ago
stj 487ef72f21 Define redis key prefix as class variable (#939)
* Define redis key prefix as class variable

Some prefixes were hardcoded in several places. This made it hard to
use custom prefixes via subclasses.

Resolves #920

* fixup! Define redis key prefix as class variable
7 years ago
Christophe Olinger a6eb5d37ee Delete dependents of job explicitely (#916)
* Initial take on delete_dependents

* Add tests including corner cases

* No need to canel dependents since they are not in a queue yet anyway

* The dependents keys can be deleted in all cases

* Update tests to included saved jobs in the deletion tests

* Correctly use pipeline in cancel method

* Unused connection

* Include dependents into dict format of job

* Add TODO

* Address comments from selwin

* Delete dependents key in redis if delete_dependents is called on its own

* Address recent comments from selwin

* Small change to trigger travis

* Remove TODO referring to canceled job state

* Remove dependent_ids from to_dict

* Address recent comments from selwin
7 years ago
Selwin Ong ca0d7ef9f1 Bump version to 0.10.0 7 years ago
Nikita Lyubchich a3eb6475dc Add description param to @job decorator (#912)
After using `@job` decorator for a function that takes a long string, in RQ worker I got printed all the args/kwargs via `job.get_call_string()`.

To get this overridden, I added `description` argument to the decorator.

I decided not to put this in `delay` method because it's may be currently be used by end user.
7 years ago
Selwin Ong 7a3c85f185
Added the ability to fetch workers by queue (#911)
* job.exc_info is now compressed.

* job.data is now stored in compressed format.

* Added worker_registration.unregister.

* Added worker_registration.get_keys().

* Modified Worker.all(), Worker.all_keys() and Worker.count() to accept "connection" and "queue" arguments.
7 years ago
John Lucas 34c403ec8d Add meta to decorator, move depends_on + at_front to decorator (#892) 7 years ago
Samuel Colvin df571e14fd improve logging in worker.py (#902)
* improve logging in worker

* tests for log_result_lifespan
7 years ago
Selwin Ong f500186f3d
Job compression (#907)
job.exc_info and job.data is now stored in compressed format in Redis.

* job.data is now stored in compressed format.
7 years ago
Selwin Ong 44a0a7b972 Bump version to 0.9.2. 7 years ago
vanife ff36e0656e Fixed an issue where `birth` not present in Redis (#901)
* Fixed an issue where `birth` not present in Redis

Fixed an issue where worker.refresh() may fail if `birth` is not present in Redis

* added test coverage
7 years ago
Selwin Ong e5de3dfbb5 Bump version to 0.9.1. 7 years ago
Selwin Ong 7b9c3b6b66 Fixed an issue where worker.refresh() may fail if last_heartbeat is not present in Redis. 7 years ago
Selwin Ong 25ced943e1 Merge branch 'master' of github.com:nvie/rq 7 years ago
Selwin Ong 1d7b5e834b
Worker statistics (#897)
* First stab at implementing worker statistics.

* Moved worker data restoration logic to worker.refresh().

* Failed and successfull job counts are now properly incremented.

* Worker now keeps track of total_working_time

* Ensure job.ended_at is set in the case of unhandled job failure.

* handle_job_failure shouldn't crash if job.started_at is not present.
7 years ago
Selwin Ong 3c98175a4a Bump version to 0.9.0 7 years ago
Theo f226d38603 Fixed #812 - Send heartbeat during suspension check 7 years ago
Selwin Ong 92c88d3f4d Merge pull request #878 from theodesp/Issue-731
Fixed #731 - Support for deleting Queues
7 years ago
Selwin Ong a4be98dc87 Merge pull request #895 from stylight/master
try latin-1 if utf-8 doesn't work, when decoding exception strings
7 years ago
ndparker 911c5e0ca3 try latin-1 if utf-8 doesn't work, when decoding exception strings 7 years ago
Dmitriy Sorokin d6e875119a Add at_front option for decorated functions 7 years ago
Theo c095fe1825 Fixed #731 - Code review issues. Added delete_jobs parameter and pipelining. 7 years ago
Selwin Ong 43c9279c8d Merge pull request #882 from jiajunhuang/specify_logging_level
expose set logging level in cmd
7 years ago
Jiajun Huang 7408c23bc5 expose set logging level in cmd 7 years ago
Samuel Colvin 260fd84f51 add milliseconds into timestamps, fix #721 7 years ago
Theo 160fe99323 Fixed #731 - Support for deleting Queues 7 years ago
Theo 096c5ad3c2 Fixed #866 - Flak8 errors 7 years ago
Samuel Colvin 423da3683c remove python 2.6 support 7 years ago
Selwin Ong cc41bdfa65 Bump version to 0.8.2. 7 years ago
Selwin Ong 801b3b7293 Added non zero check for Queue class. 7 years ago
Selwin Ong 4a9bc6e76a Merge branch 'master' of github.com:nvie/rq 8 years ago
Selwin Ong 03c3f66ca7 Bump version to 0.8.1. 8 years ago
Selwin Ong 54bc04bb45 job.save() shouldn't crash on unpickleable return value. 8 years ago
Simon Thompson fab545c193 path option needs to be a shared command to ensure that settings file can be loaded from subcommands such as requeue, resume etc otherwise sentinel config cannot be passed 8 years ago
Selwin Ong 2bc2f447d3 Merge pull request #841 from strawposter/master
accept multiple path
8 years ago
Selwin Ong 3666f4987e Merge pull request #855 from floqqi/master
Windows: Use SIGTERM instead of SIGKILL
8 years ago
Selwin Ong 5f5e113790 Merge pull request #831 from katichev/explicit_cleanup
Replace job id with job instance in the job stack. Remove implicit "cleanup" call from "job.save"
8 years ago
Selwin Ong 165b7ae6b9 Merge pull request #845 from liangsijian/master
use enum WorkerStatus instead of str
8 years ago
Florian 61f27215b3 Windows: Use SIGTERM instead of SIGKILL 8 years ago
Amjith Ramanujam 3cf5850afc Honor the job_class for failed_queue. 8 years ago
liangsijian 4556f39c34 use enum WorkerStatus instead of str 8 years ago
liangsijian 4875331b60 Optimize job.dependency
job.refresh has been call in job.fetch
8 years ago
Alexey Katichev 09697e567f revert back job.cleanup changes 8 years ago
kirill f2ff1b05f7 accept multiple path 8 years ago
Selwin Ong 8ebebc9f7c Merge pull request #833 from yaniv-g/extract_move_to_failed_queue
Expose move_to_failed_queue from Worker
8 years ago
Yaniv Greenberg 7dc5d4a936 local commit to avoid circular imports. 8 years ago
Yaniv Greenberg 2da4ccd48d Moved move_to_failed_queue to separate file. 8 years ago
Selwin Ong d71a6c2ece Merge pull request #832 from yaniv-g/master
Expand timeout string feature to both result_ttl and ttl, and add days possibility.
8 years ago
fate0 1ebf880402 fix uncaught StopRequested during send heartbeat 8 years ago
Yaniv Greenberg b49e039d63 Separate move_to_failed_queue from the worker to allow it's use in cli exception handler. 8 years ago
Yaniv Greenberg 39e43207a6 * Added support to use strings to specify both result_ttl and ttl.
* Added Days as possible timeout string (as 'd')
8 years ago
Alexey Katichev b7d50cedc4 replace job.id with job instance in local _job_stack 8 years ago
Alexey Katichev 3596449cc0 remove implicit cleanup call from job.save 8 years ago
Alexey Katichev a0113c83cf introduce job.update_meta() to store updated meta to Redis (#823)
* introduce job.update_meta() to store updated meta to Redis

This closes nvie/rq#811

* rename update_meta to save_meta
8 years ago
Selwin Ong fe84828d72 Bump up version to 0.8.0 and updated changelog. 8 years ago
Selwin Ong dc45ab8799 Worker.find_by_key should use hmget instead of repeated hget calls. (#826) 8 years ago
luojiebin cd529d0ce1 Fixed issue#72 (#818)
* Added a custom exception for timeout transfer

* Added a util to transfer timeout to a united format

* Transfer timeout format when creating a queue or enqueue jobs

* Fixed typos

* Fixed bug in transfer_timeout function

* Added test for function transfer_timeout

* Updated transfer_timeout to allow uppercase unit

* Renamed function in utils
8 years ago
Aarni Koskela 92cf6f4696 Add waitpid() return value to workhorse error/log messages (#819)
* Refactor the inner part of the monitor_work_horse loop into a separate function

* Add waitpid() return value to workhorse error/log messages
8 years ago
Peng Liu b7d4b4ec1b Solve the UnicodeDecodeError while decode literal things. (#817)
* Solve the UnicodeDecodeError while decode literal things.

* Add test case for when worker result is a unicode or str object that other than
pure ascii content.
8 years ago
Felipe Lacerda cab89254b5 Make `Queue.enqueue_job()` execute immediately if `async=False` (#798)
Currently, the job is being performed inside `enqueue_call()`, which
means that `async=False` has no effect if `enqueue_job()` is called
directly. This commit fixes that.
8 years ago
strawposter 1029adaf1b add sentinel support (#808)
* add sentinel support

* add sentinel support

* add comment
8 years ago
Peter Featherstone a99d79187b Minor spelling mistake
Minor spelling update of `proccess` to `process`
8 years ago
Selwin Ong 5660f925ae Merge pull request #788 from friedcell/master
Better support for async job payloads
8 years ago
Selwin Ong f6b4c286c9 Merge pull request #757 from jaywink/fix-unicode-decode-error
Fix UnicodeDecodeError when failing jobs
8 years ago
Selwin Ong f760fcb20f job.delete() should cleans itself from FailedQueue and various registries. 8 years ago
Samuel Colvin fd9babe8ce correct heroku worker exit logic
as per @Chronial's comment on b4b99f3
8 years ago
Marko Mrdjenovic c8a955fbb1 Merge commit '83007b20740a97f085a14d3840d1e434350c6600'
# Conflicts:
#	rq/queue.py
8 years ago
Jason Robinson 213969742e Fix UnicodeDecodeError when failing jobs
Worker handle_exception and move_to_failed_queue couldn't handle a situation where the exception raised had non-ascii characters. This caused a UnicodeDecodeError when trying to format the exception strings.

If on Python 2, ensure strings get decoded before building the exception string.

Closes #482
8 years ago
Selwin Ong 83007b2074 Merge pull request #786 from jezdez/backend-class-overrides
Allow passing backend classes from CLI and other APIs
8 years ago
Marko Mrdjenovic 35fb6b0b9a move actual execute to a separate method to make it easier to run async jobs 8 years ago
Marko Mrdjenovic 3da3eab11d moved job run to separate method to make async jobs easier 8 years ago
Benjamin Root efb30b45a3 Take a different tack, and enable the exclusion of meta from saves 8 years ago
Benjamin Root 56c89c1334 Trigger a refresh after job execution
* Prevents clobbering of user-supplied metadata
  modified during the job execution
8 years ago
Jannis Leidel c019662430
Allow passing backend classes (job, queue, worker, connection) from CLI and other APIs
This includes:

- a partial refactor of the CLI to organize the shared options
- extends the tests in areas where passing custom backend classes makes sense
- allow setting the core CLI options as env vars
- minor cosmetic changes here and there
8 years ago
Jannis Leidel 27e4f3a768
Small refactor to simplify registry key setup. 8 years ago
Selwin Ong b241d50c10 Merge pull request #774 from samuelcolvin/heroku-warm-shutdown-fix
allow for already dead horse on heroku worker termination
8 years ago
Atala 544f985d41 fix: set HTTP transport as default for sentry 8 years ago
Samuel Colvin b4b99f30b0 allow for already dead horse on heroku worker termination 8 years ago
Michael DeWulf 9e8922a099 Don't run lrem directly if we have a pipeline 8 years ago
Selwin Ong 6721463fdf queue.enqueue_call should call Job.exists with connection parameters. 8 years ago
Selwin Ong 1ae10dd529 Bump version to 0.7.1. 8 years ago
Julien Surloppe dc3bba9362 Another check on failed status and test 8 years ago
Julien Surloppe 88a3c60177 Fix get job on failed queue 8 years ago
Stefan Hammer f9bff3d12b Merge branch 'master' into 739_fix_race_condition 8 years ago
Michael DeWulf f3f61bbc15 Pass pipeline to push_job_id from enqueue_job 8 years ago
Vincent Driessen 20e258f610 Bump to 0.7.0 8 years ago
Vincent Driessen af6ce54ea4 Fix PEP8 complaints 8 years ago
Vincent Driessen 5945c28ce3 Remove legacy script 8 years ago
Stefan Hammer a0cee2d2a0 refactored worker code
Moved code into a new handle_job_success() method and reduced context of used
pipelines.
8 years ago
Samuel Colvin afc7469c27 fetch_job - check correct queue, fix #728 8 years ago
Selwin Ong e9a6c2e329 Merge pull request #747 from th3hamm0r/handle_missing_dependency
Raise an exception if a given dependency does not exist
8 years ago
Stefan Hammer 301e5c927b Raise an exception if a given dependency does not exist
Adapted some tests to the change: the dependency has to be saved first.
8 years ago
Stefan Hammer 67ae9277e5 completely pipelined enqueue_dependents 8 years ago
Stefan Hammer 7d267cf7ef implemented correct watch/multi/exec 8 years ago
任晓磊 ee4cf6e3ee fix get_redis_from_config() 8 years ago
任晓磊 83f81b351d fix default argument 8 years ago
任晓磊 191cc28543 custom connection class 8 years ago
Stefan Hammer 7b8d4e075e protecting dependency enqueuing with redis WATCH 8 years ago
Samuel Colvin bbf50f4893 use compat for PY2 test and add tests 9 years ago
Selwin Ong a0497a2bfb Merge pull request #727 from spiliopoulos/fix_failing_heroku_signal_handler
Fix request_force_stop_sigrtmin failing for python3
9 years ago
Yannis Spiliopoulos 7d0895ecf3 Small bugfix when checking python version 9 years ago
Yannis Spiliopoulos 2e30c4016b Fix request_force_stop_sigrtmin failing for python3
request_force_stop_sigrtmin would fail for python3 because it would
try to read frame attributes that have been removed in python3

This patch fixes that by reading more fram attributes only for
python2
9 years ago
Yannis Spiliopoulos 1a9b36b19e Merge remote-tracking branch 'upstream/master' into fix_issue_702 9 years ago
Yannis Spiliopoulos b38aaab8a7 Inline unhandled failure handler 9 years ago
Yannis Spiliopoulos 14d8783212 Rename function 9 years ago
Yannis Spiliopoulos 9b774771db Fix style of conditional 9 years ago
Tom Wallis 89a380ef4b Added better signal name lookup 9 years ago
Yannis Spiliopoulos 08de4190e7 Dry the code. Export handling failed current job to a method 9 years ago
Yannis Spiliopoulos c4fd1659ea Fix docstring for monitor_work_horse 9 years ago
Yannis Spiliopoulos f9d5897922 Solves issue 702
In order to solve issue 702 we have to check whether a work-horse
terminated unexpectedly (by inspecting the exit code of the work-horse
process). If it exited unexpectedly we check if the job has either been
marked as finished, failed or other valid states. If it's not in any
valid state we mark it as failed and move it to the failed queue.
Since the process was terminated unexpectedly (think OOM) we do not
have any exception context and we can't run any custom exception handlers.

There is still a chance that the job will finish successfully but the
work-horse process will be killed before the job is marked as finished
and we will erroneously mark it as failed. The users should take care
to write idempotent jobs.
9 years ago
Yannis Spiliopoulos 93d286a6c7 Split execute job to expose issue 702
In order to create a test for issue 702 we had to split execute_job
to a fork_work_horse function and a monitor_work_horse function.
9 years ago
Vincent Driessen 07adca6ca3 Bump dev version 9 years ago
Vincent Driessen 46c39654d0 Merge old tag 0.6.0 so it becomes part of master again
Otherwise, there's no linear history between this old tag and any new,
future, tags.  This is likely been a manual mistake when I released
0.6.0, so this is corrected now.
9 years ago
Samuel Colvin 7efd036a2c move ShutDownImminentException into exceptions.py 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
Samuel Colvin e2f89b3171 fix for python 2.6 9 years ago
Samuel Colvin 18ba4658a4 adding heroku worker as per #584 9 years ago
Arnold Krille acbcea0c66 Add the workers connection to _connection_stack
This allows jobs to use get_current_connection() with a resolvable connection.
And then these jobs can schedule new jobs for example (my use-case). Or attach
information to their job-object.

Also pop the pushed connection after running the jobs. This is needed for some
tests that check the _connection_stack afterwards;-) And also for use-cases
where the workers are used multiple times.

fixes nvie/rq#479
9 years ago
Javier Lopez 8e24d3a92d job.py: Fix cancel failure on failed queue 9 years ago
Vincent Driessen 6a57d321f2 Ignore flake8 checks in local.py 9 years ago
Selwin Ong 7b1df1e878 Bump version to 0.6.0. 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
Selwin Ong 8b7b0e5584 Merge pull request #701 from jlopex/javi/fix_issue_700
Fixes issue #700
9 years ago
Javier Lopez c5e62c70bb job.py: Use fetch to get a complete Job instance 9 years ago
amyangfei 724c844378 Don't call job.cancel if job has finished 9 years ago
Javier Lopez 3668c6f5d5 worker.py: Fix default logging_level 9 years ago
Selwin Ong 94dfb943b1 Merge pull request #690 from liorsbg/master
Fix for Issue #644
9 years ago
liorsbg 4c5d04105a Fix for #644 9 years ago
Selwin Ong cd0414361c Merge pull request #687 from jlopex/javi/allow_quiet_worker_class
Allow Worker work method to specify the log verbosity
9 years ago
Javier Lopez 43cb51064a Allow Worker work method to specify the log verbosity 9 years ago
Chris Curvey 4326e19140 have worker use the passed-in connection if provided 9 years ago
zfz c2374c8035 Correct the comment of job's requeue function. 9 years ago
zfz 0492eaef01 Fix the mistypo of logger str for procline. 9 years ago
Selwin Ong 8158a180f3 Merge pull request #666 from redbaron4/python_2_6_log
Fix logging regression for Python-2.6
9 years ago
Selwin Ong af0b19e707 Merge pull request #642 from butla/master
Worker only creates log handlers if there aren't any.
9 years ago
Dheeraj 0a49e247ea Fix logging regression for Python-2.6
logger.setLevel() doesn't work when a string is passed in Python-2.6.
This patch checks if the level has been set and if not (in Python-2.6),
tries to set it again using appropriate level constants
Also unused dictConfig import is removed
9 years ago
Selwin Ong e1e4c00a67 Merge pull request #659 from javimb/javimb/decorator-ttl
Add ttl argument to decorator
9 years ago
Antoine Leclair 81679a35d9 Merge branch 'master' into custom-queue-class
Conflicts:
	tests/test_worker.py
9 years ago
VicarEscaped 01bd0cebd6 Update job status with set_status 9 years ago
Javi Imbernon 1d6c2b98b7 Add ttl argument to decorator 9 years ago
Antoine Leclair 05ed85804c Worker accepts custom queue class 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
Michal Bultrowicz fe122ac799 Worker only creates log handlers if there aren't any. 9 years ago
Eduard Carreras c27a6434a8 Set job as finished when not working in async mode 9 years ago
Nick Snell 0e532f3ec4 Correction to worker command, cast results-ttl to int 9 years ago
Christophe Olinger 2be468a404 - Rename paramter both in redis and python to shutdown_requested_date
- Use connection instead of pipeline
9 years ago
Christophe Olinger ae27ce9871 Merge branch 'master' into warmshutdown 9 years ago
Christophe Olinger 3e586bd6d6 Add remove current_job based on the correct upstream master branch 9 years ago
Christophe Olinger d622f47aff Save date in redis on which worker receives a warm shutdown request while busy 9 years ago
Selwin Ong 2485334100 Merge pull request #609 from tornstrom/master
Allow meta when enqueing
9 years ago
SkyLothar 70b5554566 make sure exc_info is text type 9 years ago
SkyLothar f9978bc27c make sure state text_type 9 years ago
Tornstrom 50a114a0a8 Allow meta when enqueing 9 years ago
Selwin Ong 45addbcaf2 Deleted job.set_started_at_now. 9 years ago
Selwin Ong 364919c7c8 Moved job.hset_value to connection._hset. 9 years ago
Selwin Ong 961e443611 Merge pull request #619 from foxx/patch-1
Fixes #613
9 years ago
Selwin Ong 5afd1a90e5 Merge pull request #589 from samuelcolvin/job-started_at
add job.started_at
9 years ago
Samuel Colvin 6fc34dc6a6 moving started_at to prepare_job_execution 9 years ago
Cal Leeming d80f9f8ba0 Fixes #613
This has been discussed in #514, #282 and #88.

Using an explicit type check via `isinstance`, rather than duck typing, is typically considered unpythonic and breaks compatibility with mock objects such as FakeRedis. This patches removes the type check, and instead looks for a common method that should be present on the object as a hint on whether it's compatible or not.
9 years ago
Selwin Ong 8bbd833855 Merge pull request #600 from glaslos/cancel_remove
Cancel and Delete differences
9 years ago
Selwin Ong 702dfd2c31 Merge pull request #611 from ahxxm/delay-task
depreciation fixes
9 years ago
Michael Keirnan 14723ecc1f Merge remote-tracking branch 'upstream/master' 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
Selwin Ong 91177b7317 Merge pull request #601 from glaslos/registry_cleanup_log_msg
log.info added when cleaning registries
9 years ago
glaslos a424d320a8 log.info added when cleaning registries 9 years ago
Karoly Frendrich ca069e5112 rqinfo config parameter 9 years ago