Commit Graph

1552 Commits (59d1b40d142ac0d70e07d306f3aea3d7ebae9417)
 

Author SHA1 Message Date
skieffer 59d1b40d14
Multidependencies ()
* Also accept lists and tuples as value of `depends_on`.

* The elements of the lists/tuples may be either Jobs or Job IDs.
* A single Job / Job ID is still accepted as well.

* Represent _all_ job dependencies in `Job.to_dict()`.

We now represent the entire list, instead of just the first element.

* Fix some doctext regarding plurality of dependencies.

* Add unit tests for job dependencies.

* One unit test establishes a pattern for checking execution order as affected by dependencies.

* Another unit test applies this pattern to the new capability to name multiple dependencies.

* Add unit test for new `depends_on` input formats.

Also test that these are properly persisted.

* Repair `Job.restore()`.

Need to convert bytes back to strings when reloading `dependency_ids`.

* Maintain backwards compat. in `Job.to_dict()`.

Keep the old `dependency_id` (singular) key.

* Provide coverage for new test fixture.

* Simplify some code.

Cut some superfluous `as_text()` calls left over from an earlier commit.

* Check for `dependency_id` in `Job.restore()` for backwd. compat.

Also eliminate use of `as_text()` here, in favor of `.decode()`.

* Switch to snake case instead of camel case.

* Eliminate some usages of `as_text()`.

Also cut some `print` statements.

* Cleanup.

* Accept arbitrary iterables for `Job`'s `depends_on` kwarg.

Instead of requiring a list or tuple, we now make use of `ensure_list()`.

* Add test fixtures.

* Provide a system to get two workers working simultaneously, using `multiprocessing`.
* Define a simple job that just says whether its dependencies are met.
* In `rpush`, make an option to record the name of the worker.

* Improve unit tests on execution order with dependencies.

These now actually have two workers going, which makes a more thorough test.

* Add unit test examining `Job.dependencies_are_met()` at execution time.

* Redesign dependency execution order unit tests.

* Simplify assertions.

* Improve doctext and formatting.

* Move fixture tests to new, dedicated module `test_fixtures.py`.

* Use `enqueue` instead of `enqueue_call` in new unit tests.
Jochen Kupperschmidt 617b18a496
Change back `path` connection keyword argument to `unix_socket_path` ()
If a UNIX socket path is passed to the constructor of the Redis client,
`redis.client.Redis`, the value of keyword argument `unix_socket_path`
is passed to the constructor of `UnixDomainSocketConnection` with the
key `path`.

When RQ's scheduler creates its own Redis connection, it instantiates
class `redis.client.Redis` with keyword arguments obtained from the
connection pool. If the pooled connection is a
`UnixDomainSocketConnection`, its keyword arguments contain `path`, as
given on instantiation. This results in a `TypeError: __init__() got an
unexpected keyword argument 'path'`.

This change renames the key back to `unix_socket_path` before the
keyword arguments dictionary is used to instantiate
`redis.client.Redis`.
Selwin Ong aa5dbf4af3 Document that --serializer CLI argument is only available in 1.8.0
f0cker efe703214e
Added --serializer option to cli, finishing off PR and fix ()
* Added --serializer option to cli, finishing off PR  and fix 

* Update documentation

* Update documentation

* Modified help message

Co-authored-by: f0cker <dturner@trustwave.com>
Adda Satya Ram 11c8631921
Add exception to catch redis connection failure to retry after wait time ()
* add exception catch for redis connection failure

* Add test for connection recovery

* add exponential backoff

* limit worker max connection wait time to 60 seconds

* fix undefined class variable

* fix string formatting issue while printing error log

* cap max connection wait time:better code style

Co-authored-by: corynezin <cory.nezin@gmail.com>
AxeOfMen 709043989a
clean_worker_registry cleans in batches to prevent submitting too muc… ()
* clean_worker_registry cleans in batches to prevent submitting too much data to redis at once when there are a large number of invalid keys

* Address code review comments

Rename MAX_REMOVABLE_KEYS to MAX_KEYS

* Fix tests

Co-authored-by: Joel Harris <combolations@gmail.com>
Selwin Ong d3b07fba47 Bump version to 1.7.0
Selwin Ong ab19ad9798 Improve docs
JackBoreczky 016da14723
Fix custom serializer in job fetches ()
* Ensure that the custom serializer defined is passed into the job fetch calls

* add serializer as argument to fetch_many and dequeue_any methods

* add worker test for custom serializer

* move json serializer to serializers.py
C. Mangla 8b9e2188e4
Add `job.refresh()` to docs ()
Selwin Ong 81ea1d26d1
Add link to Github Actions badge in README
BobReid 75a610bd4d
Fix RQScheduler when run with SSL connection ()
* Quick and dirty set up of SSL

* copy connection kwargs in scheduler

* fix

* chmod the cert

* Skip SSL tests in CI
Kyle Verhoog 3aaa1c1209
fix snippet link in docs ()
The former link is broken since http://flask.pocoo.org/snippets has been
taken down. See https://github.com/pallets/website/issues/41 for more
info.
Arturo Bracero 2ece5d0fba
fixed typo in send_kill_horse_command() example ()
Selwin Ong 492e77d86d
send_stop_job_command ()
* Added send_stop_job_command().

* send_stop_job_command now accepts just connection and job_id

* Document send_job_job_command

* Updated test coverage
Selwin Ong f3e924cdd1
Added job.worker_name ()
* Added job.worker_name

* Fix compatibility with Redis server 3.x

* Document job.worker_name

* Removed some Python 2 compatibility stuff.

* Remove unused codes
Selwin Ong 3ead30a34e Bump version to 1.6.1
Selwin Ong 6fab48845f Merge branch 'master' of github.com:rq/rq
Selwin Ong b3703b5357 Bump to version 1.6.0
Selwin Ong d1528d776d
Release scheduler lock when running in burst mode ()
* Fixed an issue where scheduler lock is not release when running worker in burst mode

* Remove unused import
Selwin Ong b50f1e2121
Redis does not accept `parser_class` argument ()
Chris de Graaf 5988889e57
Propagate logging settings from worker to scheduler ()
Ruslan Mullakhmetov 676ec9b0ea
tests: updated github worklow for tests to use requirements.txt and d… ()
* tests: updated github worklow for tests to use requirements.txt and dev-requirements.txt

* build: updated dev-requirements.txt

Co-authored-by: Ruslan Mullakhmetov <ruslan@twentythree.net>
Ruslan Mullakhmetov ed264f08bb
feat: added job heartbeat to track whether job is actually executing ()
* feat: added job heartbeat to track whether job is actually executing

heartbeat might be needed in cases when worker was hardkilled or the whole VM/docker was forcibly rebooted.

* fixed tests

* fixed test coverage issue

* chore: renamed job.heartbeat stuff according to review feedback

* chore: pipelined worker heartbeat and job heartbeat

* docs: documented job.heartbeat property

* fixes after review

* docs: updated last_heartbeat description

* chore: review

Co-authored-by: Ruslan Mullakhmetov <ruslan@twentythree.net>
Selwin Ong a721db34b1
Workers can listen to external commands via pubsub ()
* Added a way to send shutdown command via pubsub

* Added kill-horse command

* Added kill horse command

* Added send_kill_horse_command() and send_shutdown_command()

* Document worker commands
Ruslan Mullakhmetov 0e65bab10b
tests: added ability to run tests in Docker ()
* tests: added ability to run tests in Docker

useful to run full test suit on Mac

* tests: minor improvement in dockerfile for tests

* tests: typo in Dockerfile

* tests: updated dev requirements

Co-authored-by: Ruslan Mullakhmetov <ruslan@twentythree.net>
Selwin Ong f5ce159b60 Remove alpha warning from scheduler docs
Selwin Ong df14acaf02
Increase scheduler lock TTL to 60 ()
Nikita Romaniuk 2da957a68d
scheduler: now operates with chunks of jobs ()
* scheduler: now operates with chunks of jobs

* scheduler: set default chunk_size for ScheduledJobRegistry.get_jobs_to_schedule

* scheduler: fixed missing indent

* scheduler: added test for get_jobs_to_schedule() with chunk_size parameter

* scheduler: fixed test for passing python 3.5 (no f-strings)

* scheduler: fixed chunk_size in test make it lighter to run
Ruslan Mullakhmetov 9adcd7e50c
feat: avoided "zombie" processes after killing work horse ()
* feat: avoided "zombie" processes after killing work horse by setting work horse process group and killing this group

* fixed tests

* tests: added test to check that all workhorse subprocesses are killed

* tests: updated guthub run tests dependencies since they are not using (dev-)requirements.txt

Co-authored-by: Ruslan Mullakhmetov <ruslan@twentythree.net>
Orkhan 55dce19a95
Fix ()
* docker folder along with Dockerfile has been added

* fix 

Co-authored-by: orkhan.mamedov <orkhan.mamedov@sravni.ru>
Qiming Sun 4e4afefd18
Add entry ssl_ca_certs in worker config settings ()
Vladimir Ulupov 237e69123a
pass retry param to enqueue_at func ()
Selwin Ong a31d37f1ea Exclude tests directory from wheel builds
Selwin Ong e6f153ee86 Bump version to 1.5.2
Selwin Ong 01d71c8984
Fixes an issue where retried jobs should not be put in FailedJobRegistry ()
Evgeni Golov 99f7dc8722
include requirements.txt in sdist ()
Fixes: 
Ahmed Elmaghallawy 0779605173
fix deprecated Iterable import ()
maces 48f5a68013
fixed minor import error in jobs docs ()
Sergei Zherevchuk 56e756f512
fix(scheduler): correctly restore ssl connection after forking ()
* fix(scheduler): restore ssl connection after forking

* fix(scheduler): custom redis client support
Selwin Ong 08379fc571
Codecov ()
* Try codecov

* Modify codecov steps

* Strip out unused actions variables

* Remove coverage.yml

* Renamed test.yml to workflow.yml

* Minor styling fix
Selwin Ong a09a2ab3b4 Merge branch 'master' of github.com:rq/rq
Selwin Ong 20248cf268 Bump version to 1.5.1
Selwin Ong 6028a63607
Restores compatibility with fakeredis ()
Selwin Ong f0afcd3cb3
Create coverage.yml
Selwin Ong 39fb709c10
get_redis_server_version() should handle 4 digit version numbers ()
nerok 7bf100ebe7
Allow retries to be set through decorator ()
Co-authored-by: Didrik Koren <didrik.koren@uninett.no>
Ruslan Mullakhmetov c2931b45b6
handled unhandled exceptions in horse ()
* handled unhandled exceptions in horse to prevent a job from being silently dropped without going into FailedRegistry

* changes after review

* made sure that work_horse always terminates in a proper way with tests

* minor refactoring

* fix for failing test

* fixes for the other tests

- removed exception handling (done in monitor_work_horse)
- adjusted some tests for the checks that are not relevant anymore

* review suggested changes

* cleanup

Co-authored-by: Ruslan Mullakhmetov <ruslan@twentythree.net>
Selwin Ong 57f286eac4 Minor doc fix
Selwin Ong 265e4b76ab
log messages < error is now output to stdout instead of stderr ()