Commit Graph

1887 Commits

Author SHA1 Message Date
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
Selwin Ong a7f19d966f Done implementing clean_intermediate_queue() 2024-04-28 20:32:30 +07:00
Selwin Ong aae428500c Skip intermediate queue tests if Redis < 6.2.0 2024-04-28 19:51:21 +07:00
Selwin Ong 3ca348049f Ensure intermediate_queue is empty before running tests 2024-04-28 19:37:53 +07:00
Selwin Ong 7d4c7eee30 Added intermediate_queue.get_job_ids() 2024-04-28 19:24:24 +07:00
Selwin Ong 50467b4d58 Made IntermediateQueue class 2024-04-27 19:54:20 +07:00
Selwin Ong 1068956bad Use sentry-sdk<2 for tests 2024-04-27 15:24:50 +07:00
Selwin Ong 673b70dad0 Fix test_clean_large_registry 2024-04-27 15:00:42 +07:00
Andrey Nehaychik 7be63fb468
Always remove fetched job_ids for scheduler queue (#2077)
* Always remove fetched job_ids for scheduler queue

* Correct fix job removing
2024-04-20 13:47:39 +07:00
Selwin Ong caf6af9df7 Updated docs 2024-04-13 14:45:34 +07:00
Selwin Ong fd261d5d8f Fix test_clean_large_registry 2024-04-13 14:38:53 +07:00
Selwin Ong 7fa34246f6 Merge branch 'master' of github.com:rq/rq 2024-04-13 07:17:56 +07:00
dependabot[bot] 233f56d382
Bump actions/setup-python from 5.0.0 to 5.1.0 (#2065)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.0.0 to 5.1.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.0.0...v5.1.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-04-13 06:52:15 +07:00
Stanislav Khlud e21ce4e255
Extend ssl config options (#2066) 2024-04-13 06:43:55 +07:00
Ethan Wolinsky 2fc5484852
Execute custom handlers when abandoned job is found (#2057)
* Execute custom handlers when abandoned job is found

* Make exception_handlers optional

* Run exception handlers before checking retry

* Test abandoned job handler is called

* Improve test coverage

* Fix handler order
2024-03-23 16:46:07 +07:00
Selwin Ong bab0061da1
Removed utils.utcnow() (#2056)
* Bump version to 1.16.1

* Partially replaced utcnow() with now()

* Removed utils.utcnow

* Fix lint
2024-03-11 19:44:12 +07:00
Ethan Wolinsky 3a3787dcc3
Group jobs into batches and retrieve by batch name (#1945)
* Batch.py initial commit

* Add method to refresh batch status

* Clean up Redis key properties

* Remove persist_job method

* Execute refresh method when fetching batch

* Add batch_id to job

* Add option to batch jobs with enqueue_many

* Add set_batch_id method

* Handle batch_ttl when job is started

* Renew ttl on all jobs in batch when a job finishes

* Use fetch_jobs method in refresh()

* Remove batch TTL

During worker maintenance task, worker will loop through batches and
delete expired jobs.
When all jobs are expired, the batch is deleted.

* Fix buggy connection

* Raise batch error in fetch method

* Fix fetch connection arg

* Add testing for batch

* Remove unused import

* Update batch documentation

* Add batch ID to job persistence test

* Test that empty batch is removed from batch list

* Make default batch ID full uuid4 to match Job

* Add method to return batch key

* Add all method to return iterable of batches

* Revert changes to queue.py

* Separate batch creating from job enqueueing.

Batches can be created by passing an array of jobs.

* Fix bug with stopped callback in enqueue_many

* Rename delete_expired_jobs batch method

* Use exists to identify expired jobs

* Remove jobs attribute from batch

Jobs have to be explicitly fetched using the get_jobs method

* Don't add batch_id to job in _add_jobs method

This should be done when the job is created before it is saved to redis.

* Use cleanup method to determine if batch should be deleted

* Add get_jobs method

This method will return an array of jobs belonging to the batch.

* Update create method to not allow jobs arg

Jobs should be added to batches in the Queue.enqueue_many
function

* Add batch_id to job create method

* Delete set_batch_id method

The batch ID should be set atomically when the job is created

* Add batch argument to queue.enqueue_many

This will be how jobs can be batched. The batch ID is added to each job
created by enqueue_many, and then those jobs are all added to the batch
in Redis using the batch's _add_jobs method

* Update batch tests to use new enqueue_many arg

* Fix batch_id for non_batched jobs

* Use different pipeline name

* Don't use fetch method when enqueuing jobs

If the batch is empty, fetch will delete it from Redis

* Test enqueuing batched jobs with string ID

* Update batch documentation

* Remove unused variables

* Fix expired job tracking bug

* Add delete_job method

* Use delete_job method on batch

* Pass multiple jobs into srem command

* Add multiple keys to exists call

* Pipeline _add_jobs call

* Fix missing job_id arg

* Move clean_batch_registry to Batch class

* Remove unused variables

* Fix missing dependency deletion

I accidentally deleted this earlier

* Move batch enqueueing to batch class

* Update batch docs

* Add test for batched jobs with str queue arg

* Don't delete batch in cleanup

* Change Batch to Group

* Import EnqueueData for type hint

* Sort imports

* Remove local config file

* Rename clean_group_registries method

* Update feature version

* Fix group constant names

* Only allow Queue in enqueue many

* Move cleanup logic to classmethod

* Remove str group test

* Remove unused import

* Make pipeline mandatory in _add_jobs method

* Rename expired job ids array

* Add slow decorator

* Assert job 1 data in group

* Rename id arg to name

* Only run cleanup when jobs are retrieved

* Remove job_ids variable

* Fix group name arg

* Fix group name arg

* Clean groups before fetching

* Use uuid4().hex for shorter id

* Move cleanup logic to instance method

* Use all method when cleaning group registry

* Check if group exists instead of catching error

* Cleanup expired jobs

* Apply black formatting

* Fix black formatting

* Pipeline group cleanup

* Fix pipeline call to exists

* Add pyenv version file

* Remove group cleanup after job completes

* Use existing pipeline

* Remove unneeded pipeline check

* Fix empty call

* Test group __repr__ method

* Remove unnecessary pipeline assignment

* Remove unused delete method

* Fix pipeline name

* Remove unnecessary conditional block
2024-03-11 15:08:53 +07:00
Selwin Ong 7189771c23 Merge branch 'master' of github.com:rq/rq 2024-03-11 08:02:27 +07:00
dewalujjwal cdf5cfcd3d
Replace deprecated utcnow() with timezone aware now() (#2055)
* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()
2024-03-11 08:00:46 +07:00