1766 Commits (37ddcb51cdd5f158868d7b34dc0faf8687174f2f)
 

Author SHA1 Message Date
Rony Lutsky aedc9b9e06
Worker - max_idle_time feature (#1795)
* fix accessing None when dequeued result is None (burst=True, or timeout=None)

* add a test

* implement + tests

* fix if

* adjust test

* merge

* test

* test

* merge master

* take max_idle_time into account for dequeue_timeout

* refactor a bit

* potential bug fix

* tests

* math.ceil

* buffer tests
2 years ago
Rony Lutsky 41406db3eb
Configurable maintenance task interval (#1823)
* Configurable maintenance task interval

* pass to worker

* rename parameter

* rename

* rename

* test
2 years ago
Selwin Ong 42ac7d4150 Bump version to 1.13.0 2 years ago
Rony Lutsky bba781d288
Enhance worker termination logic (#1729)
* enhance worker termination logic and allow passing custom exc_info in failure callback

* handle ret_val None

* fix unbound variable

* typing

* docs

* Update exceptions.md

* rename

* typing

* rename

* Update exceptions.md

* revert test change
2 years ago
lowercase00 a985445486
refactor: new teardown worker method (#1820)
* refactor: new teardown worker method

* refactor: consistent worker_registration usage

* refactor: consistent utils import
2 years ago
dependabot[bot] 5192b1d2e4
Bump supercharge/redis-github-action from 1.4.0 to 1.5.0 (#1818)
Bumps [supercharge/redis-github-action](https://github.com/supercharge/redis-github-action) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/supercharge/redis-github-action/releases)
- [Changelog](https://github.com/supercharge/redis-github-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/supercharge/redis-github-action/compare/1.4.0...1.5.0)

---
updated-dependencies:
- dependency-name: supercharge/redis-github-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
lowercase00 fc6d69529f
feat: splits the work loop into a bootstrap method (#1816) 2 years ago
Simó Albert i Beltran 5798cddd04
fix: queue.result_ttl=-1 (#1819)
* test: queue.result_ttl=-1

Signed-off-by: Simó Albert i Beltran <sim6@bona.gent>

* test: queue.result_ttl=0

Signed-off-by: Simó Albert i Beltran <sim6@bona.gent>

* fix: queue.result_ttl=-1

Signed-off-by: Simó Albert i Beltran <sim6@bona.gent>

---------

Signed-off-by: Simó Albert i Beltran <sim6@bona.gent>
2 years ago
Selwin Ong 46b5cf64c3
Added black config (#1815) 2 years ago
lowercase00 9311eeba17
Worker docstrings (#1810)
* docs: worker docstrings

* docs: more type annotaions
2 years ago
lowercase00 eef6dbbb3c
docs: fix typos (#1813) 2 years ago
Daniel M 3d840a79ad
Add to worker redis record scheduler info (#1787)
* add scheduler_pid property to queue

* Update return type

* Reformat code
2 years ago
lowercase00 a02ad29cef
Docs: Updated testing instructions (#1812)
* docs: update rq repo address

* docs: detailed test instructions
2 years ago
Rony Lutsky b69ee10cbb
Fix - Use worker TTL for timeout (#1794)
* Use worker TTL for timeout

* add test

* renames

* test

* use dequeue_timeout
2 years ago
Selwin Ong acdeff385d
Use job.return_value() instead of job.result when processing callbacks (#1801)
* Use job.return_value() instead of job.result when processing callbacks

* job.return_value() should also support Redis server < 5.
2 years ago
Rony Lutsky 54db2fa8d1
Fix - TypeError - accessing None when dequeued result is None (when timeout=None, e.g. in burst mode) (#1793)
* fix accessing None when dequeued result is None (burst=True, or timeout=None)

* add a test

* pr fix

* fix tests
2 years ago
Selwin Ong 83fa0adf15
Sync jobs should save job exceptions and results (#1799)
* Sync jobs should save job exceptions and results

* Make job.handle_success() and job.handle_failure() private methods
2 years ago
lowercase00 27cbf48ad4
Debug mode log fixes (#1798)
Current worker on debug mode doesn't raises errors,
but does have some formatting issues.
2 years ago
Paul Spooren fdb14df181
Black style (#1292)
* treewide: apply black style

This PR applied the black code style, adds it to the CI and README. The
changes look big, however no functional changed are applied at all.

The line length is set to 120, which is different from black
recommendation of 88. I would suggest to stick to the 88 recommendation
and adapt the flake8 check.

Add the `-S` parameter to `black` to keep single quotes.

Signed-off-by: Paul Spooren <mail@aparcar.org>

* README: add black badge

Help people to find the used code style.

Signed-off-by: Paul Spooren <mail@aparcar.org>

* CI: check codestyle via black

Automatically run the CI and check that the code style is still black.

Signed-off-by: Paul Spooren <mail@aparcar.org>

---------

Signed-off-by: Paul Spooren <mail@aparcar.org>
2 years ago
lowercase00 cd62b4cb50
Fix bug when running worker on debug mode (#1785)
When running on debug mode, some debug logs were
using colorizers on lists, which would raise an unhandled exception
on the worker. The same happened for a debug log that was
using colors on a response from Redis (bytes).
2 years ago
lowercase00 c2e6d95338
Enhanced Redis Connection Reliability (#1753)
* Enhanced Redis Connection Reliability

The Redis connection may fail for several reasons. As the connection can be
(1) explicitly passed to the worker or (2) implicity set, this will improve the
Connection configuration by setting a timeout to the socket, and adding
an ExponentialBackoff Retry logic.

* Simpler Connection logic

* Add simple retry logic to Redis Connection Error

* Make retry exponential, add keepalive & socket_connect_timeout

* Handles configuration on Redis' connection pool

* Simplifies timeout exception logic

* Fix burst bug, add test

* Add docs related to `socket_timeout`, improve compatibility with older RedisPy versions

* Fixes

* New timeout private method

* Fix timeout
2 years ago
lowercase00 436250d36b
Queue Docstrings (#1782)
* Docstrings

* Add commands docstrings

* More docstrings

* Fix Result.Type error

* Remove unfinished docstrings
2 years ago
lowercase00 271e7a8727
Add 3.11 Support (#1780) 2 years ago
lowercase00 2c4c948207
Fix worker example (#1765)
* Fix worker example

* Clean worker example

* Improve docs
2 years ago
lowercase00 bd07310253
Job methods docstrings (#1772)
* Improve docstrings on `connections`

* Enhanced Job methods docstrings & Serialization Protocol

This adds docstrings to all Job methods in a standard format.
It also implements a `serializer` protocol.

* Excludes `Protocol` (keeping compatibility with < 3.8)

* Add docstrings & type annotation to the `job` decorator

* Docstrings for the `defaults` vars

* Add deprecation warning to Connection context manager

* Fix Types
2 years ago
lowercase00 398d5784db
Removes Python 3.5 from the classifiers (#1776) 2 years ago
Oleg 4bd0f12ec9
Restart scheduler process if the process is not alive (#1764) 2 years ago
lowercase00 55f833ab6f
Moves the `compact` helper to `utils` (#1769)
* Moves the `compact` helper to `utils`

There is a helper funcion that excludes `None` values
from a list. This was being declared both in the Queue
and in the worker. This centralizes this helper in the `utils`
Importing

* Fix Type Annotation
2 years ago
lowercase00 d90c00501e
Fix Scheduler Docstring (#1768) 2 years ago
Selwin Ong c5a7a6b670 Merge branch 'master' of github.com:rq/rq 2 years ago
lowercase00 6813e5a2ba
Remove compatibility layer for < 3.5 (#1761)
* Remove unused code from compat module

* Remove unused dictconfig

* Remove total_ordering compat layer

* Remove compatibility layer

This completely removes the compat module. It moves utilities
functions (`as_text` and `decode_redis_hash`) to the `utils`
module, is eliminates the use of the proxies `text_type` and
`string_types`, using the `str` construct directly.

* Remove compat module

Finishes the cleaning of the compatibility module.
The last function being the `is_python_version` function
which was being used internally.

* Fix old import

* Fix Imports

* Remove Dummy (Force GH Actions)

* Fix Imports

* Organize Imports
2 years ago
lowercase00 3be814c6d8
Enhance debug logs (#1752)
* Add debug logs to dequeue

There were reports where a worker wouldn't fetch new jobs.
Since one possible cause is the infinite hanging of the `BLPOP` command,
this adds a couple of logs surrounding the `dequeue_any` function,
that interacts with Redis using `BLPOP`,

* Update worker.py

Fix Typo

* More logs

* Logs

* Update worker.py

* Add debug logs to the queue

* Reviewed logs

* Remove queue count before job push

* New log wording

* Remove logs
2 years ago
lowercase00 0f5f18bec7
Allow for configurable scheduler fallback period (#1759)
* Allow for configurable scheduler fallback period

This adds a parameter to the Scheduler called
`fallback_period`, which determines the period
before work fallsback to a new scheduler.

* Update defaults.py

Reduce Scheduler Fallback Period to 120 seconds.

* Update scheduler.py

Remove fallback period parameter.
2 years ago
lowercase00 9c2d353640
Remove unused dummy tasks (#1760)
Dummy tasks were probably used for load testing
in the past, but currently are not being imported from anywhere.
Also, similar task utilities are already present on the tests fixtures,
making the `dummy` module irrelevant.
2 years ago
lowercase00 e163e224e2
Bugfix: Python & RQ Version (#1757)
* Fix min version on `setup.py`

* Fix rq version
2 years ago
Selwin Ong 8f4e51b7a4 Bump version to 1.12.0 2 years ago
dependabot[bot] fa7a635aa4
Bump actions/setup-python from 4.4.0 to 4.5.0 (#1750)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.4.0...v4.5.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
Selwin Ong d0e832181f
Don't log job exceptions twice (#1746)
* Don't log job exceptions twice

* Preserve traceback while encountering deserialization error
2 years ago
dependabot[bot] 62acd56c91
Bump actions/setup-python from 4.3.0 to 4.4.0 (#1745)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.3.0 to 4.4.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.3.0...v4.4.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
Oscar Arbeláez-Echeverri 9aaceb22e6
Cache redis version in the connection object (#1742) 2 years ago
gabriels1234 50d8d72928
Add at_front for scheduled/enqueue_at jobs (#1743)
* Add at_front for scheduled/enqueue_at jobs

* Add test to at_front
2 years ago
Ankush Menat 5f7ed6970d
Move lock aquire log from INFO to DEBUG level (#1737)
closes https://github.com/rq/rq/issues/1717
2 years ago
eswolinsky3241 5119716911
Persist worker_name after job is finished (#1730)
* Persist worker_name after job is finished

Persisting the worker_name on the job object in Redis would allow for debugging and
analyzing logs from the worker

* Remove redundent job.save() method call

* Remove check for null worker

Now that worker name is persisted after job finishes or fails,
no need to assert that worker name is None

* Change github runner to Ubuntu 20.04

* Change github runner to Ubuntu 20.04
2 years ago
Selwin Ong f39554dbe4
Make test_commands pass on MacOS (#1735) 2 years ago
Krzysztof Jeziorny d108eaf235
#1733 Typography (#1734)
html font size removed, body font size set in rem w/o weight;
font stacks defined;
code formatted
2 years ago
Selwin Ong 0691b4d46e
Multiple results using Redis Streams (#1725)
* WIP job results

* Result can now be saved

* Successfully saved and restored result

* result.save() should accept pipeline

* Successful results are saved

* Failures are now saved properly too.

* Added test for Result.get_latest()

* Checkpoint

* Got Result.all() to work

* Added Result.count(), Result.delete()

* Backward compatibility for job.result and job.exc_info

* Added some typing

* More typing stuff

* Fixed typing in job.py

* More typing updates

* Only keep the last 10 results

* Documented job.results()

* Got results test to pass

* Don't run test_results.py on Redis server < 5.0

* Fixed mock import on some Python versions

* Remove Redis 3 from test matrix

* Jobs should never use the new Result implementation if server is < 5.0

* Results should only be created is Redis stream is supported.

* Added back Redis 3 to test matrix

* Fixed job.supports_redis_streams

* Fixed worker test

* Updated docs.
2 years ago
Jan Rüegg 09856f9924
pre-warm redis server version cache of job from queue (#1727)
Co-authored-by: Jan Rüegg <jrueegg@apple.com>
2 years ago
dependabot[bot] 67432ec8be
Bump actions/setup-python from 4.2.0 to 4.3.0 (#1718)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.2.0...v4.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago
Jan Rüegg 4750eb4316
Fix broken pipeline / transaction (#1715)
Co-authored-by: Jan Rüegg <jrueegg@apple.com>
2 years ago
lowercase00 375ace1747
Typing (#1698)
* Gitignore Venv + VScode

* Add Typings, Add Test to Makefile

* Fix, More typing, Redis Pipeline specific type

* More types

* Fix 3.7- Typing Compat, Add Tox Envs, Tests Dockerfile

* fix listindex error (#1700)

* More docstrings

* More Types

* Fix Typo on Dependency

* Last Types

Co-authored-by: Burak Yılmaz <46003469+yilmaz-burak@users.noreply.github.com>
2 years ago