1772 Commits (933860ee8cab780df406e53e412bbe306a9b0255)
 

Author SHA1 Message Date
rpkak d42947fb75
add `/` (#1475) 4 years ago
rpkak 49b489a880
Display ip address of worker in `rq info` (#1463)
* `rq info` displays id address

add feature of #1386

* making redis < 5.0.0 compatible

* address -> ip_address

https://github.com/rq/rq/pull/1463#discussion_r633264327
4 years ago
Selwin Ong ef4f0611a7 Added Python 3.9 to test matrix 4 years ago
Selwin Ong ba276c274e Updated changelog 4 years ago
Selwin Ong 5b5cfdf9ab
Jobs that get cleaned up should also be retried (#1467) 4 years ago
Ashoka Lella d333d20914
Make RQScheduler work with a serializer (#1455)
* Scheduler with a serializer

* test with metadata

Co-authored-by: alella <ashoka.lella@factset.com>
4 years ago
rpkak 428d75b9b6
Support for Click 8.0.0 (#1465)
* `'.'` to `['.']` as path default(s)

view https://github.com/rq/rq/issues/1464#issuecomment-839649116, #1464

* DefaultSerializer class object to `rq.serializers.DefaultSerializer` in shared options

in defaults.py

#1464

* remove unused import

* make rq python 3.5 compatible
4 years ago
dependabot-preview[bot] b84b39f75f
Upgrade to GitHub-native Dependabot (#1454)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
4 years ago
MyrikLD efb24161ab
Replace enum function with internal Enum class (#1459)
* Removed deprecated (object) inheritance
Add new py38,py39 versions to tox, removed deprecated py27,py34
Replace enum internal function with Enum class

* fix
4 years ago
pwws 40b90946a7
bugfix: Allow using staticmethods as jobs (#1458) 4 years ago
Omer Lachish 76ac0afbcd
Cleanup zombie worker leftovers as part of StartedJobRegistry's cleanup() (#1372)
* cleanup jobs that are not really running due to zombie workers

* remove registry entries for zombie jobs

* return only the job ids on cleanup

* test zombie job cleanup

* format code

* rename variable to explain that second element in tuple is expiry, not score

* remove worker_key

* detect zombie jobs using old heartbeats

* reuse get_expired_job_ids

* set score using current_timestamp

* test idle jobs using stale heartbeats

* extract timeout into variable

* move heartbeats into StartedJobRegistry

* use registry.heartbeat in tests

* remove heartbeats when job removed from StartedJobRegistry

* remove idle and expired jobs from both wip and heartbeats set

* send heartbeat_ttl to registry.add

* typo

* revert everything 😶

* only keep job heartbeats as score (and get rid of job timeouts as scores

* calculate heartbeat_ttl in an overrideable function + override it in SimpleWorker + move storing StartedJobRegistry scores to job.heartbeat()

* set heartbeat to monitoring interval for infinite timeouts

* track elapsed_execution_time as part of worker

* reset current job working time when work on a job is done

* persisting the job working time as part of monitoring
4 years ago
rpkak a3ed2db4ea
Changed docker CMD to ENTRYPOINT (#1449)
fix #1448
4 years ago
Antonino Sabetta 1680f49264
Fix mistake in doc of Random dequeuing strategy (#1443) 4 years ago
PetreM 8415ea7eb4
prevent job exception being logged twice (#1440) 4 years ago
James Cobb 6bfd47f735
Newer pip install command from git (#1439)
* Newer pip install command from git

Updated cutting edge pip install command to use HTTPS rather than insecure git+git protocol, as recommended by pip documentation. This allows the command to work with pip >= 21.0.1

* Updated pip command in README
4 years ago
Selwin Ong 42ca608d96 Bump version to 1.8.0 4 years ago
Biel Cardona 08ef54dcf4
Workers dequeuing jobs from queues using both Round-Robin and Random strategies (#1425)
* implemented round-robin and random access to queues

* added tests for RoundRobinQueue

* reverted change in gitignore

* removed linebreak

* added tests for random queues

* added documentation for round robin and random queues

* moved round robin strategy to worker

* reverted changes to queue.py

* reverted changes to workers.md

* reverted changes to test_queue

* added tests for RoundRobinWorker and RandomWorker

* added doc for round robin and random workers

* removed f-strings for backward compatibility

* corrected a mistake

* minor changes (code style)

* now using _ordered_queues instead of queues for reordering queues
4 years ago
Jahn Thomas Fidje dcbbd067f0
bugfix: Add self.serializer when calling self.fetch_many in Job.fetch_dependencies (#1411)
Co-authored-by: Jahn Thomas Fidje <jahn-thomas.fidje@telenor.com>
4 years ago
Daniel Alley fc7940c77b
Add a "stopped" JobStatus and the machinery to properly handle it (#1394)
* Add a "stopped" JobStatus and the machinery to properly handle it

fixes #1389

* Apply requested changes
4 years ago
MyrikLD 14ca7881e4
Add runner for asyncio tasks (#1405)
* add asyncio runner

* add asyncio runner

* fix for old version

* fix tests
4 years ago
skieffer 59d1b40d14
Multidependencies (#1397)
* 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.
4 years ago
Jochen Kupperschmidt 617b18a496
Change back `path` connection keyword argument to `unix_socket_path` (#1403)
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`.
4 years ago
Selwin Ong aa5dbf4af3 Document that --serializer CLI argument is only available in 1.8.0 4 years ago
f0cker efe703214e
Added --serializer option to cli, finishing off PR #1381 and fix #1357 (#1395)
* Added --serializer option to cli, finishing off PR #1381 and fix #1357

* Update documentation

* Update documentation

* Modified help message

Co-authored-by: f0cker <dturner@trustwave.com>
4 years ago
Adda Satya Ram 11c8631921
Add exception to catch redis connection failure to retry after wait time (#1387)
* 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>
4 years ago
AxeOfMen 709043989a
clean_worker_registry cleans in batches to prevent submitting too muc… (#1390)
* 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>
4 years ago
Selwin Ong d3b07fba47 Bump version to 1.7.0 4 years ago
Selwin Ong ab19ad9798 Improve docs 4 years ago
JackBoreczky 016da14723
Fix custom serializer in job fetches (#1381)
* 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
4 years ago
C. Mangla 8b9e2188e4
Add `job.refresh()` to docs (#1384) 4 years ago
Selwin Ong 81ea1d26d1
Add link to Github Actions badge in README 4 years ago
BobReid 75a610bd4d
Fix RQScheduler when run with SSL connection (#1383)
* Quick and dirty set up of SSL

* copy connection kwargs in scheduler

* fix

* chmod the cert

* Skip SSL tests in CI
4 years ago
Kyle Verhoog 3aaa1c1209
fix snippet link in docs (#1380)
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.
4 years ago
Arturo Bracero 2ece5d0fba
fixed typo in send_kill_horse_command() example (#1378) 4 years ago
Selwin Ong 492e77d86d
send_stop_job_command (#1376)
* Added send_stop_job_command().

* send_stop_job_command now accepts just connection and job_id

* Document send_job_job_command

* Updated test coverage
4 years ago
Selwin Ong f3e924cdd1
Added job.worker_name (#1375)
* Added job.worker_name

* Fix compatibility with Redis server 3.x

* Document job.worker_name

* Removed some Python 2 compatibility stuff.

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

* Remove unused import
4 years ago
Selwin Ong b50f1e2121
Redis does not accept `parser_class` argument (#1373) 4 years ago
Chris de Graaf 5988889e57
Propagate logging settings from worker to scheduler (#1366) 4 years ago
Ruslan Mullakhmetov 676ec9b0ea
tests: updated github worklow for tests to use requirements.txt and d… (#1364)
* 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>
4 years ago
Ruslan Mullakhmetov ed264f08bb
feat: added job heartbeat to track whether job is actually executing (#1349)
* 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>
4 years ago
Selwin Ong a721db34b1
Workers can listen to external commands via pubsub (#1363)
* 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
4 years ago
Ruslan Mullakhmetov 0e65bab10b
tests: added ability to run tests in Docker (#1361)
* 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>
4 years ago
Selwin Ong f5ce159b60 Remove alpha warning from scheduler docs 4 years ago
Selwin Ong df14acaf02
Increase scheduler lock TTL to 60 (#1362) 4 years ago
Nikita Romaniuk 2da957a68d
scheduler: now operates with chunks of jobs (#1355)
* 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
4 years ago
Ruslan Mullakhmetov 9adcd7e50c
feat: avoided "zombie" processes after killing work horse (#1348)
* 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>
4 years ago