Commit Graph

1864 Commits

Author SHA1 Message Date
xzander bdbc9a4f9c
Scheduler should release and heartbeat only acquired locks (#1914)
* Scheduler should release and heartbeat only acquired locks.

* Added tests for heartbeat and release only acquired locks.

* Changed test description to correct one.
2023-05-18 06:59:51 +07:00
Rob Hudson ea063edf0a
Update linting configuration (#1915)
* Update linting configuration

This removes flake8 in favor of ruff, which also provides isort support, and
updates all files to be black, isort, and ruff compliant. This also adds black
and ruff checks to the tox and Github linting workflow.

* Tweak the code coverage config and calls
2023-05-17 23:19:14 +07:00
dependabot[bot] bbfeb8c8ed
Bump docker/build-push-action from 2 to 4 (#1913)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 4.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2...v4)

---
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>
2023-05-16 06:03:26 +07:00
Tom Hamilton Stubber edc93c380f
Stop calling deprecated function (#1908) 2023-05-14 07:48:36 +07:00
Cyril Chapellier 84833b9c5f
[Chore] Fix test suite (#1895)
* fix: tests suite

* chore: add SSL tests
2023-05-13 21:49:59 +07:00
Selwin Ong 46d0056a69 Bump version to 1.14.1 2023-05-05 21:00:49 +07:00
Cyril Chapellier a228b4838c
[Hotfix] Fix SSL connection for scheduler (#1894)
* fix: ssl

* fix: reinstate a test for parse_connection
2023-05-05 14:25:20 +07:00
gabriels1234 07fef85dd2
Catch serializer TypeError Exception (#1872)
* Catch serializer TypeError Exception

* Add test for unserializable job.meta
2023-05-03 14:27:31 +07:00
Selwin Ong af2dfb1446 Deleted redundant requirements from dev-requirements.txt 2023-05-03 06:52:56 +07:00
Selwin Ong 5787e8f4a0
Coverage fixes (#1890)
* Don't fail CI if codecov fails

* Remove codecov from dev-requirements.txt

* Pin packaging dependency to 21.3

* Pin coverage to 6.5.0

* Pin coverage to 6.2

* Downgrade packaging

* Drop Python 3.6 from test matrix

* Reenable Python 3.6 in tests

* Downgrade coverage req

* Make a different dev-requirements file for Python 3.6

* Moved dev-requirements-36 to root dir
2023-05-03 05:46:10 +07:00
Selwin Ong 5f883c6e1c Merge branch 'master' of github.com:rq/rq 2023-05-01 17:54:33 +07:00
Selwin Ong 5e70e523d3 Bump version to 0.14.0 2023-05-01 17:54:20 +07:00
Selwin Ong 64cb1a27b9
Worker pool (#1874)
* First stab at implementating worker pool

* Use process.is_alive() to check whether a process is still live

* Handle shutdown signal

* Check worker loop done

* First working version of `WorkerPool`.

* Added test for check_workers()

* Added test for pool.start()

* Better shutdown process

* Comment out test_start() to see if it fixes CI

* Make tests pass

* Make CI pass

* Comment out some tests

* Comment out more tests

* Re-enable a test

* Re-enable another test

* Uncomment check_workers test

* Added run_worker test

* Minor modification to dead worker detection

* More test cases

* Better process name for workers

* Added back pool.stop_workers() when signal is received

* Cleaned up cli.py

* WIP on worker-pool command

* Fix test

* Test that worker pool ignores consecutive shutdown signals

* Added test for worker-pool CLI command.

* Added timeout to CI jobs

* Fix worker pool test

* Comment out test_scheduler.py

* Fixed worker-pool in burst mode

* Increase test coverage

* Exclude tests directory from coverage.py

* Improve test coverage

* Renamed `Pool(num_workers=2) to `Pool(size=2)`

* Revert "Renamed `Pool(num_workers=2) to `Pool(size=2)`"

This reverts commit a1306f89ad.

* Renamed Pool to WorkerPool

* Added a new TestCase that doesn't use LocalStack

* Added job_class, worker_class and serializer arguments to WorkerPool

* Use parse_connection() in WorkerPool.__init__

* Added CLI arguments for worker-pool

* Minor WorkerPool and test fixes

* Fixed failing CLI test

* Document WorkerPool
2023-05-01 12:44:32 +07:00
Selwin Ong 8a9daecaf2 Added changelog 2023-05-01 12:43:45 +07:00
Cyril Chapellier 08cb311c55
[Results] Allow unserializable return values (#1888)
* fix: allow unserializable return values

* fix: review comments
2023-05-01 11:20:40 +07:00
Selwin Ong 36f5c88ca2
Added BaseWorker class (#1887)
* Added BaseWorker class

* Moved logging related functions to logutils

* Remove uneeded colorize function

* Updated worker.get_current_job_id() to not fail when job ID is None

* job.restore() shouldn't crash if  is not present

* Fix various as_text() related crashes
2023-04-26 09:16:37 +07:00
Rob Hudson 4073aa3642
Update `push_job_id` debug string when using pipelines (#1886) 2023-04-26 05:51:58 +07:00
Selwin Ong 77e926c424
Added parse_connection function (#1884)
* Added parse_connection function

* feat: allow custom connection pool class (#1885)

* Added test for SSL

---------

Co-authored-by: Cyril Chapellier <tchapi@users.noreply.github.com>
2023-04-25 19:38:44 +07:00
Selwin Ong 95983cfcac Exclude tests directory from coverage.py 2023-04-25 09:43:36 +07:00
Selwin Ong 60bed7d58c
Exclude tests dir from coverage.py (#1883) 2023-04-23 16:48:04 +07:00
nhairs 67b2c982f9
Add py.typed for PEP561 compliance (#1882) 2023-04-23 16:15:42 +07:00
dependabot[bot] 74746cc390
Bump actions/setup-python from 4.5.0 to 4.6.0 (#1880)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.5.0...v4.6.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>
2023-04-23 16:15:11 +07:00
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