Commit Graph

1792 Commits

Author SHA1 Message Date
Selwin Ong b639ee6406
Cleaned up cli.py (#1876) 2023-04-08 18:55:28 +07:00
Selwin Ong ed7a171460
Ignore `if TYPE_CHECKING:` when measuring test coverage (#1875)
* Ignore `if TYPE_CHECKING:` when measuring test coverage

* Update codecov.yml instead

* Added "[report]" to coveragerc

* Revert "Update codecov.yml instead"

This reverts commit f68a905de4.
2023-04-08 09:46:29 +07:00
Selwin Ong 7c1f96fafa Better process name for workers 2023-04-07 09:22:05 +07:00
luto 4f3670b024
improve the docs on in-flight jobs of killed/lost workers (#1840)
* improve the docs on in-flight jobs of killed/lost workers

* improve the docs on in-flight jobs of killed/lost workers

* document abandoned job behavior before 0.14
2023-04-01 19:50:39 +07:00
Tianci Hu Marrero eadabc036b
Added job details to "rq info" command (#1869)
* Update index.md

fixed minor duplicate article ("the its config var")

* added job details to rq info cli
2023-04-01 19:49:45 +07:00
Joris a9fae76e88
Fix error in example in the documentation (#1870)
The solution that @rpkak proposes works. Closes #1524
2023-04-01 19:43:47 +07:00
Rony Lutsky 04722339d7
Consolidate job callbacks execution (#1851)
* consolidate job failure callback execution

* fix

* success callback as well

* merge fix

* create Callback class and change how callbacks serde

* deprecation

* add tests

* string format

* pr fix

* revert serialization changes

* fix timeout typing

* add documentation

* add test

* fix a bug

* fix tests

* move job heartbeat call to worker and make sure there is always a callback timeout

* fix test

* fix test
2023-03-21 06:44:41 +07:00
Jochen Kupperschmidt 60164c5107
Fix typo in deprecation warning (#1866)
Help when grepping through warnings.
2023-03-12 09:42:14 +07:00
Simó Albert i Beltran 64e202ea19
Check dependencies when enqueue via Queue.enqueue_job() (#1837)
* test: check dependencies when enqueue via Queue.enqueue_job()

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

* fix: check dependencies when enqueue via Queue.enqueue_job()

Signed-off-by: Simó Albert i Beltran <sim6@bona.gent>
Co-authored-by: Selwin Ong <selwin.ong@gmail.com>

---------

Signed-off-by: Simó Albert i Beltran <sim6@bona.gent>
Co-authored-by: Selwin Ong <selwin.ong@gmail.com>
2023-03-09 06:15:57 +07:00
Jesse P. Johnson 5a1c0a09f4
fix: remove unsafe formating and standardize qoutes (#1857)
* test: resolve merge issues

* test: resolve merge issues
2023-03-08 09:41:03 +07:00
lowercase00 ec0b08ebf0
bugfix: type annotations as str to allow Windows usage (#1852) 2023-03-08 09:39:04 +07:00
Jesse P. Johnson a21768ad90
refactor: remove python2 cruft (#1863) 2023-03-08 09:38:28 +07:00
lowercase00 c12561db0a
docs: add deprecation warnings to connection functions (#1860) 2023-03-08 09:37:39 +07:00
lowercase00 d5bde117c2
Remove `use_connection` (#1859)
* feat: remove use_connection

* fix: clear old test
2023-03-07 10:54:47 +07:00
Joachim Burket 7f9f0f72ba
Update arguments passed to the Sentinel Object when created from the settings (#1850)
* Updated arguments passed to the Sentinel Object when created from the settings

- added `USERNAME` key
- added `CONNECTION_KWARGS` key to allow passing additionals arguments to the Redis connections
- updated the documentation

* added missing comma

* tests(helpers): Added tests for Sentinel

---------

Co-authored-by: Joachim Burket <joachim.burket@hopitalvs.ch>
2023-03-07 10:03:31 +07:00
lowercase00 82a59e9791
feat: move `reorder_queues` to `dequeue_job` (#1853)
* feat: move `reorder_queues` to `dequeue_job`

* Update worker.py
2023-03-07 07:44:47 +07:00
Tianci Hu Marrero 5de8cda1f9
Update index.md (#1858)
fixed minor duplicate article ("the its config var")
2023-03-07 06:55:08 +07:00
lowercase00 654649743c
New dequeue strategy (#1806)
* New dequeue strategy

This implements a new parameter `dequeue_strategy` that
should replace the `RoundRobinWorker` and `RandomWorker`.
Changes includes: feature, docs, tests, deprecation warning.

* Fix dequeue strategy name

* Black & Fix warning

* feat: tests, warnings, refactor naming

* feat: improve worker check

* fix: revert to str subclass

* fix: dequeue strategy into bootstrap

* org: move DequeueStrategy to worker

* refactor: round robin naming

* fix: naming

* fix: type annotation

* fix: typo

* refactor: remove kwarg from worker's init

* fix: typo

* move `dequeue_strategy` from `bootstrap()` into `work()`
2023-03-05 06:23:00 +07:00
Rony Lutsky 0ba3971d55
Add failure callback call to started job registry cleanup (#1824)
* Add started job registry cleanup job failure callback call

* WIP - need to fix test

* fix test

* rename, tests and docs

* better log message

* use class name

* Update registry.py
2023-03-04 08:02:13 +07:00
lowercase00 95558fcc1d
docs: scheduler safe import (#1835)
* docs: scheduler safe import

* docs: rollback main block
2023-03-03 07:46:07 +07:00
Marcus Ong e92682c83a
Fix TimerDeathPenalty not properly handling negative/infinite timeout (#1845)
* Fix TimerDeathPenalty not properly handling negative/infinite timeout

* revert back to using exc_info

---------

Co-authored-by: Marcus <marcus@us2.ai>
2023-03-03 06:02:07 +07:00
Simó Albert i Beltran ed59b9248a
fix: Dependency list in depends_on (#1843)
* test: Dependency list in depends_on

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

* fix: Dependency list in depends_on

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

---------

Signed-off-by: Simó Albert i Beltran <sim6@bona.gent>
2023-02-28 06:03:47 +07:00
Tianci Hu Marrero 1fa6ec1055
(Docs) Updated patterns - heroku (#1841)
* Update index.md

* Update index.md

* Update index.md

import herokuWorker instead.
2023-02-27 16:10:39 +07:00
amks1 08d8f7c30c
removed import error warning and changed function doc (#1839) 2023-02-26 21:03:30 +07:00
lowercase00 7bbef7e05a
docs: add warning of `decode_responses` (#1833) 2023-02-26 07:53:25 +07:00
Selwin Ong 2c6c7ae586
Don't fail CI if codecov fails (#1838) 2023-02-26 07:46:08 +07:00
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
2023-02-22 06:35:43 +07:00
Rony Lutsky 41406db3eb
Configurable maintenance task interval (#1823)
* Configurable maintenance task interval

* pass to worker

* rename parameter

* rename

* rename

* test
2023-02-22 06:14:32 +07:00
Selwin Ong 42ac7d4150 Bump version to 1.13.0 2023-02-19 16:30:07 +07:00
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
2023-02-17 06:42:41 +07:00
lowercase00 a985445486
refactor: new teardown worker method (#1820)
* refactor: new teardown worker method

* refactor: consistent worker_registration usage

* refactor: consistent utils import
2023-02-17 06:33:48 +07:00
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>
2023-02-16 10:09:18 +07:00
lowercase00 fc6d69529f
feat: splits the work loop into a bootstrap method (#1816) 2023-02-15 17:20:11 +07:00
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>
2023-02-15 17:17:09 +07:00
Selwin Ong 46b5cf64c3
Added black config (#1815) 2023-02-14 07:47:52 +07:00
lowercase00 9311eeba17
Worker docstrings (#1810)
* docs: worker docstrings

* docs: more type annotaions
2023-02-13 23:04:01 +07:00
lowercase00 eef6dbbb3c
docs: fix typos (#1813) 2023-02-13 11:16:34 +07:00
Daniel M 3d840a79ad
Add to worker redis record scheduler info (#1787)
* add scheduler_pid property to queue

* Update return type

* Reformat code
2023-02-13 09:05:12 +07:00
lowercase00 a02ad29cef
Docs: Updated testing instructions (#1812)
* docs: update rq repo address

* docs: detailed test instructions
2023-02-13 08:44:04 +07:00
Rony Lutsky b69ee10cbb
Fix - Use worker TTL for timeout (#1794)
* Use worker TTL for timeout

* add test

* renames

* test

* use dequeue_timeout
2023-02-10 07:26:03 +07:00
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.
2023-02-05 19:24:15 +07:00
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
2023-02-05 17:41:56 +07:00
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
2023-02-05 16:38:29 +07:00
lowercase00 27cbf48ad4
Debug mode log fixes (#1798)
Current worker on debug mode doesn't raises errors,
but does have some formatting issues.
2023-02-05 09:32:41 +07:00
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>
2023-02-04 07:42:51 +07:00
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).
2023-02-02 10:54:09 +07:00
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
2023-02-02 10:53:19 +07:00
lowercase00 436250d36b
Queue Docstrings (#1782)
* Docstrings

* Add commands docstrings

* More docstrings

* Fix Result.Type error

* Remove unfinished docstrings
2023-02-01 06:03:47 +07:00
lowercase00 271e7a8727
Add 3.11 Support (#1780) 2023-01-30 11:49:40 +07:00
lowercase00 2c4c948207
Fix worker example (#1765)
* Fix worker example

* Clean worker example

* Improve docs
2023-01-30 11:49:14 +07:00