Commit Graph

1905 Commits

Author SHA1 Message Date
Nguyễn Hồng Quân 26a3577443
Replace Black with Ruff as formatter tool (#2152) 2024-11-20 15:34:27 +07:00
Ethan Wolinsky fb017d2c29
Delete expired groups from registry (#2150) 2024-11-20 08:08:33 +07:00
Selwin Ong a07b23b821
Ruff and typing improvements (#2148)
* Ruff and typing improvements

* Add `kill_horse()` method to BaseWorker

* Add Python 3.13 to test matrix
2024-11-16 15:54:32 +07:00
Selwin Ong aa5c58f222 Update docs 2024-11-16 15:06:55 +07:00
Alex Prabhat Bara dbbbd09463
Set ended_at for a job when using is_async=False (#2142)
* set ended_at for is_async=False job

* added test to check ended_at is set for is_async=False job
2024-11-16 14:56:51 +07:00
dependabot[bot] faa7b024d6
Bump codecov/codecov-action from 4 to 5 (#2145)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-16 14:55:39 +07:00
Rob Hudson 52c8a2ac4e
Update CHANGES.md to add release date (#2147) 2024-11-16 14:55:15 +07:00
Terence Honles cf39441f47
use `Serializer` Protocol instead of concrete `DefaultSerializer` (#2136)
* WorkerPool should accept `Serializer` instead of `DefaultSerializer`

* always use type Protocol Serializer instead of DefaultSerializer

---------

Co-authored-by: Selwin Ong <selwin.ong@gmail.com>
2024-11-09 14:04:24 +07:00
Uriel Sandoval b44ae85a8d
Adds validation to avoid ":" when user pass job_id (#2138) 2024-11-09 14:03:55 +07:00
Selwin Ong bb7f340537 Fix typing 2024-10-28 22:57:02 +07:00
Selwin Ong 03a08e1c79 Mypy should also use Python 3.8 2024-10-28 22:44:09 +07:00
Selwin Ong e7c5fe2176 Drop Python 3.7 from test matrix 2024-10-28 22:42:27 +07:00
Selwin Ong 3545ff3bf0 Bump to version 2.0 2024-10-28 21:57:51 +07:00
Selwin Ong b145f12fff
Prepare v2 docs (#1998)
* Prepare docs for release

* Blackify executions.py

* Added a high level overview of RQ concepts
2024-10-28 21:55:42 +07:00
Selwin Ong 899e2ec196 Updated changelog 2024-10-27 19:34:07 +07:00
dependabot[bot] 3810cc36d7
Bump actions/setup-python from 5.2.0 to 5.3.0 (#2134)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.2.0...v5.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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-27 19:16:23 +07:00
François Charlier 3e2e26e702
Add an exception handler for the pubsub thread (#2132)
* Add an exception handler for the pubsub thread

After a connection error to Redis the pubsub thread was stopped and the
worker could not receive commands anymore.

This commit adds an exception handler for the thread that adds a log
message and ignores `redis.exceptions.ConnectionError`. Any other
exception is re-raised.

redis-py internal mechanism allows the pubsub thread to recover its
connection and reinstall the pubsub channel subscription to allow the
worker to receive commands again after connection errors.

It tries to behave the same as the main worker loop retry mechanism but
without the backoff wait factor.

Fixes #1836
Fixes #2070

* Add test for untested line, improve logging and comments

Add *args & **kwargs to tests.fixtures.raise_exc to pass tests with Python 3.7
2024-10-17 11:15:47 +07:00
Anton Daneyko f4283afe68
Allow to get job count and job IDs without cleanup (#2133)
Prior to this commit it was not possible to get a number of jobs in a
registry or list job IDs without triggering a cleanup.
Calling cleanup caused issues for:
 * Monitoring tools (see https://github.com/rq/rq/pull/2104) and
 * Cases with high number of jobs in the registries (see
   https://github.com/rq/rq/pull/2003).
 * Cases where a failure callback is registered and but the
   `get_job_ids` is called not from the main thread.

In this commit:
 1. A new `BaseRegistry.get_job_count` method is added. It is a side
    effect free version of `BaseRegistry.count` and runs in O(1).
 2. A `cleanup` parameter added to `get_job_ids` that allows to avoid
    clean up if it is set to `False`.

Resolves https://github.com/rq/rq/pull/2104.
Resolves https://github.com/rq/rq/pull/2003.
2024-10-17 11:14:54 +07:00
Selwin Ong b1620da009 Updated the docstring of registry.get_job_ids() 2024-10-13 09:24:53 +07:00
Selwin Ong ba5c338441 Fix flaky tests 2024-10-13 07:27:23 +07:00
Bobby Watson 809a20a8cc
[AWS Elasticache Serverless Redis] Handle redis servers that return non-string versions (#2131)
* Handle redis servers that return non-string versions

* Add tests for AWS elasticache redis version output
2024-10-13 07:09:13 +07:00
Selwin Ong fc9610ae53
Added `desc` argument to registry.get_job_ids() (#2129)
* Added `desc` argument to registry.get_job_ids()

* Added argument description to registry.get_job_ids()
2024-10-13 07:08:54 +07:00
Selwin Ong fda862e600
RQ execution fixes (#2128)
* Execution objects now return UTC timestamps

* execution.job should return a full Job instance

* worker.maintain_heartbeats() should extend execution TTL

* Don't use cached_property since it's not supported on Python 3.7

* Fixed type hint of execution._job
2024-10-02 09:13:13 +07:00
Selwin Ong 9d35ed106d
Worker ttl clarifications (#2126)
* add info about running docs in README

* update jekyll config to fix error

* update docs to clarify misc timeout values

* update readme

* update argument from default_worker_ttl -> worker_ttl

* Fix black formatting

* argument should still be respected until it's deprecated

* Updated CHANGES.md

* Updated CHANGES.md

---------

Co-authored-by: Sean Villars <sean@setpoint.io>
2024-09-16 11:37:00 +07:00
dependabot[bot] 5c849b86ff
Bump actions/setup-python from 5.1.1 to 5.2.0 (#2122)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.1.1 to 5.2.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.1.1...v5.2.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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-16 10:10:47 +07:00
Terence Honles 58bfccf66d
test type annotations with mypy (#2123)
* test type annotations with mypy

* update timing test
2024-09-14 05:38:58 +07:00
Terence Honles ccdff1f003
Ensure the Redis socket timeout is long enough for blocking operations (#2120)
This change checks for Redis connection socket timeouts that are too
short for operations such as BLPOP, and adjusts them to at least be the
expected timeout.
2024-09-07 08:53:55 +07:00
Jack Kinsella d5e55ab95a
Log job success (#2118)
* Log job success

* Format with black
2024-08-25 20:39:29 +07:00
Harm Berntsen 193de26cff
Implement TTL for deferred jobs (#2111)
* Add new deferred_ttl attribute to jobs

* Add DeferredJobRegistry to cleanup

* Use normal ttl for deferred jobs as well

* Test that jobs landing in deferred queue get a TTL

* Pass pipeline in job cleanup

* Remove cleanup call

We pass a ttl of -1 which does not do anything

* Pass exc_info to add

The add implementation overwrites it so it won't get lost this way

* Remove extraneous save call

The add function already saves the job for us. So no need to save it
twice.

* Tune cleanup function description

* Test cleanup also works for deleted jobs

* Replace testconn with connection

---------

Co-authored-by: Raymond Guo <raymond.guo@databricks.com>
2024-08-11 19:23:28 +07:00
Selwin Ong e80d4009ff Updated changelog. 2024-08-04 19:51:45 +07:00
Nguyễn Hồng Quân 91fff77009
Make Retry type hint more exact (#2097) 2024-08-04 10:26:49 +07:00
Selwin Ong e21d1ae133
Remove RQTestCase.testconn (#2109)
* Remove self.testconn from RQTestCase

* Minor cleanup

* Remove the use of self.testconn.
2024-08-04 10:11:47 +07:00
Maria Khrustaleva 5cfd853546
Enqueue dependents when job is abandoned and moved to FailedJobRegistry (#2008)
* Enqueue dependents when job is abandoned

* Add test

* Run CI
2024-07-18 10:16:09 +07:00
dependabot[bot] c7bc4f61c6
Bump actions/setup-python from 5.1.0 to 5.1.1 (#2106)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.1.0 to 5.1.1.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.1.0...v5.1.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-18 10:13:36 +07:00
dependabot[bot] e95cfbba20
Bump docker/build-push-action from 4 to 6 (#2100)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v4...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-18 10:13:20 +07:00
Roman Bange d7503e6253
More verbose AbandonedJobError warning (#2101) 2024-07-18 10:09:25 +07:00
Wei-Chun Kao 458a2ff228
fix case when client does not have a name (#2103)
* fix case when client does not have a name

* lint using black
2024-07-18 09:45:37 +07:00
Simó Albert i Beltran df5e99ba0b
Register queue also for deferred job (#2108)
* Add test to list queue with only deferred jobs

Signed-off-by: Simó Albert i Beltran <sim6@probeta.net>

* Register queue also for deferred job

Without this change queues initialized with only deferred jobs are not
listed by `rq.Queue.all()`.

Signed-off-by: Simó Albert i Beltran <sim6@probeta.net>

---------

Signed-off-by: Simó Albert i Beltran <sim6@probeta.net>
2024-07-18 09:42:21 +07:00
Joe Carey 180c9afba0
Update Job.get_status and Job.restore to consistently return JobStatus Enum (#2039)
* fix #2038

* raise exception if there is no status in redis

* add get_status failure test
2024-05-26 09:37:55 +07:00
Mehdi Nassim KHODJA fc4884a0f2
fix docs: use delay when using @job decorator (#2088)
* fix docs: use delay to enqueue and use declared in separate file

Signed-off-by: Mehdi Nassim KHODJA <18899702+naskio@users.noreply.github.com>

* fix docs: use delay only

Signed-off-by: Mehdi Nassim KHODJA <18899702+naskio@users.noreply.github.com>

---------

Signed-off-by: Mehdi Nassim KHODJA <18899702+naskio@users.noreply.github.com>
2024-05-12 07:27:21 +07:00
Roman Donchenko f31afdbfdf
Fix the "Fork me on GitHub" ribbon (#2085)
* Fix the "Fork me on GitHub" ribbon

The image URL is broken. Replace it with the "official" URL found in
<https://github.blog/2008-12-19-github-ribbons/>.

* Replace the orange ribbon with a red one
2024-05-12 07:25:09 +07:00
Selwin Ong 4c28ec617a
Delete legacy.py (#2083)
* Delete legacy.py

* Deleted Sentry's built in integration.

* Fixed ruff warnings.
2024-05-02 08:20:41 +07:00
Alpha 87af9b51e9
doc: Job statuses descriptions (#2075)
* doc: Job statuses descriptions

* Applied review suggestions
2024-05-01 14:25:26 +07:00
Selwin Ong 4efd81e648 Merge branch 'master' of github.com:rq/rq 2024-05-01 14:20:44 +07:00
Selwin Ong b52457afb6 Merge branch 'v1' 2024-05-01 14:20:29 +07:00
Jack Kinsella 0b31edc6da
Document suspend and resume commands (#2068)
* Document suspend and resume commands

* Title case title

* Modify docs
2024-05-01 14:18:02 +07:00
Harm Berntsen fbd9858f3c
Fix fetch_many method type (#2082)
The type introduced in #1772 does not match the method description and
behaviour. None is part of the returned list.
2024-05-01 14:17:19 +07:00
Selwin Ong 0e15b2a942 Bump version to 1.16.2 2024-05-01 14:12:08 +07:00
Selwin Ong 00adbc08c6 Use sentry-sdk<2 for tests 2024-04-28 20:50:26 +07:00
Selwin Ong e2d144d772 Moved intermediate queue cleaning functionality to intermediate_queue.cleanup() 2024-04-28 20:48:07 +07:00