Commit Graph

1905 Commits

Author SHA1 Message Date
luto 9c3afb87e4
Fix link Round Robin / Random worker classes (#1561) 2021-09-13 18:48:17 +07:00
Selwin Ong 08a4315e8d Bump version to 1.10.0 2021-09-09 18:31:21 +07:00
Selwin Ong cc70cacc1b
Add more tolerance to scheduler heartbeat (#1555) 2021-09-07 13:03:22 +07:00
Selwin Ong c556106a38
Main worker should use zadd(xx=True) to update heartbeat. (#1550) 2021-08-26 19:16:52 +07:00
Josh Cohen bac58f24ca
Add option to enqueue a job's dependents when canceling (#1549)
* Add option to enqueue a jobs dependents when canceling

* Address @selwin's review
2021-08-26 19:16:12 +07:00
Josh Cohen b80045d615
Respect serializer (#1538)
* Add serializer where missing in code

* Fix cli

* Pass option to command

* Add tests for serializer option

* Merge branch 'master' into respect-serializer
- Update enqueue cli to resp. serializer

* Address @selwin's review
2021-08-24 07:40:29 +07:00
Selwin Ong 246d52b977
job.cancel() puts job into CanceledJobRegistry. (#1546)
* job.cancel() puts job into CanceledJobRegistry.

* Improve test coverage
2021-08-22 07:19:15 +07:00
waldner 31dafb9e5c
Fix repo url for git intallation (#1545) 2021-08-21 20:01:51 +07:00
Selwin Ong e8ec07ed61
Minor changes (#1544)
* Added test for job timeout

* Added more debugging statements
2021-08-21 18:09:04 +07:00
Selwin Ong 1352465ad1 Fixed SENTINEL docs 2021-08-21 17:09:31 +07:00
Selwin Ong f9ddf7dca5
Requeueing job should clear job.exc_info (#1543) 2021-08-21 17:07:29 +07:00
Paul Spooren 63abea1522
job: add get_meta() function (#1536)
* job: add get_meta() function

The newly introduced function returns meta data stored for the job. This
is required since job.meta stays an empty dict until the job is
finished or failed.

With the new function it's possible to store arbiatraty states/stages of
the job and allow the user to track progress. A long running job may
return custom stages like `downloading_data`, `unpacking_data`,
`processing_data`, etc.

This may allow better interfaces since users can track progress.

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

* docs: add missing `refresh` arg to get_status()

This was previously missing.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-08-21 16:17:47 +07:00
rpkak d41f60b906
Allows enqueueing by the cli (#1466)
* Allows enqueueing by the cli

#372

* schedule support

* `_` to `-`

* fix flake8

* echo job-id

* Some improvements

 - Description as in python jobs
 - return result
 - quiet mode
 - allows `--boolean` and `--integer`
 - raises errors if not used correctly

* added tests

* add schedule tests

* add retry test

* use click exceptions

* add error test

* add job_func test

* change messages

https://github.com/rq/rq/pull/1466#discussion_r640211128
https://github.com/rq/rq/pull/1466#discussion_r640210850

* Use different format for arguments

View https://github.com/rq/rq/pull/1466#discussion_r650510889

* Add file support

Usage: @filename

* ast.literal_eval support with `#` instead of `:`

* func -> function

Makes error messages more readable

* click Error

* print function string

* add docs

* increase seconds in test

* Update `parse_function_arg`

Add `ParsingMode` enum (https://github.com/rq/rq/pull/1466#discussion_r656676114)
Change error messages (https://github.com/rq/rq/pull/1466#discussion_r656676800, https://github.com/rq/rq/pull/1466#discussion_r656677082)

* `#` to `%`

`#` is the letter for a comment in bash

* Add some tests

(https://github.com/rq/rq/pull/1466#discussion_r656674539, https://github.com/rq/rq/pull/1466#discussion_r656676543)

* Add some tests

* docs: Add some examples

* catch all literal_eval exceptions

There are some edge cases with other exceptions

* remove job_func
(https://github.com/rq/rq/pull/1466#pullrequestreview-690110118)

* edit docs

https://github.com/rq/rq/pull/1466#pullrequestreview-695758691

* format examples

* format examples

`queue.enqueue(path.to.func, args=['abc'])` to `queue.enqueue(path.to.func, 'abc')`

https://github.com/rq/rq/pull/1466#discussion_r673615464

* add examples

https://github.com/rq/rq/pull/1466#discussion_r673658933

* add doc test

https://github.com/rq/rq/pull/1466#discussion_r673659124

* Update index.md

* Update test_cli.py

* Update test_cli.py

* Add version info

Co-authored-by: rpkak <rpkak@users.noreply.github.com>
2021-08-20 13:43:06 +07:00
César Ferradas 794556c74b
add None check before dependencies_are_met (#1532) 2021-08-20 08:21:34 +07:00
Stanley Ruheza 5dab16d9e9
fix: typo on readme file - enqueue_in() (#1534) 2021-08-20 08:19:31 +07:00
rpkak 9737ffa95f
Make unstable tests more stable (#1523)
Co-authored-by: rpkak <rpkak@users.noreply.github.com>
2021-08-03 08:00:49 +07:00
rpkak 643a26b991
fix query request of issue listing (#1519)
Co-authored-by: rpkak <rpkak@users.noreply.github.com>
2021-07-28 08:34:37 +07:00
Bo Bayles adc03e8119
Use result_ttl for synchronous queues (#1510) 2021-07-19 16:21:27 +07:00
rpkak bc0b55fd92
Daily workflow for dependency testing (#1470)
* Make new workflow

Descriped in https://github.com/rq/rq/pull/1465#issuecomment-842464560

* For testing

* failing tests

For testing

* log file

For testing

* log

For testing

* no newlines

For testing

* no "

For testing

* no only one issue

For testing

* as job

For testing

* use artifacts

For testing

* use artifacts2

For testing

* use artifacts3

For testing

* use artifacts4

For testing

* finish

* name

* only if "normal" workflow doesn't fail

https://github.com/rq/rq/pull/1470#discussion_r641343532
2021-07-19 16:17:46 +07:00
César Ferradas 77e7ef6983
Handle ResponseError when CLIENT command is not supported (#1514)
* catch redis ResponseError if CLIENT command not supported

* use Warning instead of UserWarning
2021-07-15 09:09:25 +07:00
Selwin Ong 653d4917e7 Updated changelog 2021-06-30 14:08:23 +07:00
Adrian Sadłocha caa4efc35b
Extract `Job.get_call_string` logic to `utils.get_call_string` (#1499)
* Extract `Job.get_call_string` logic to `utils.get_call_string`

* Remove an outdaded comment

* Move `truncate_long_string` to `utils`

* Remove `truncate` parameter in `get_call_string`

* Add a test for `get_call_string`

* Move `truncate_long_string` to module's top level

* Add a test case for `truncate_long_string` suite
2021-06-23 21:12:39 +07:00
Selwin Ong 5590aab458
Success and failure callbacks (#1480)
* Support enqueueing with on_success_callback

* Got success callback to execute properly

* Added on_failure callback

* Document success and failure callbacks

* More Flake8 fixes

* Mention that options can also be passed in via environment variables

* Increase coverage on test_callbacks.py
2021-06-22 10:30:46 +07:00
Josh Cohen 591f11bcc3
Ensure pipeline in multi mode after dep setup (#1498) 2021-06-22 10:30:33 +07:00
Josh Cohen 456743b225
Make `Queue.enqueue`, `Queue.enqueue_call`, `Queue.enqueue_at``Queue.parse_args` accept `pipeline` arg, add `Queue.enqueue_many` method (#1485)
* Make `enqueue_*` and `Queue.parse_args` accept `pipeline` arg

* undo bad docs

* Fix lints in new code

* Implement enqueue_many, refactor dependency setup out to method

* Make name consistant

* Refactor enqueue_many, update tests,  add docs

* Refactor out enqueueing from dependency setup

* Move new docs to queue page

* Fix section header

* Fix section header again

* Update rq version to 1.9.0
2021-06-20 17:18:00 +07:00
Natalino Busa 35604f9bb1
Added logging trace for failed import for user-level debugging (#1494)
* Added logging trace for failed import for user-level debugging

* one logging statement is enough
2021-06-17 07:39:49 +07:00
rpkak 29d02c0798
Docs: Add scheduled to job.get_status() (#1493) 2021-06-16 17:26:16 +07:00
rpkak 819d0498c7
Quickfix: Change Dockerhub Username (#1491)
I forgot to change this in #1471 by mistake.
2021-06-12 22:38:29 +07:00
rpkak d0cea42fbb
Docker (#1471)
* rqtest -> tests folder

* worker Dockerfile to repo folder

* Dockerfile: install rq from file next to it

* add docker workflow
2021-06-12 11:51:11 +07:00
rpkak 28e7ab10df
Add chat page (#1474)
* Add chat page

* no js / iframe
2021-06-12 11:46:44 +07:00
Cyrille Lavigne 6fc9454675
Handle deserializing failures gracefully (#1428)
* adds unit test for a deserialization error

This tests that deserialization exceptions are properly logged, and fails in
the manner described in #1422 .

* Catch deserializing errors in Worker.handle_exception()

This fixes #1422 , and makes

tests/test_worker.py::TestWorker::test_deserializing_failure_is_handled

pass.

* made unit test less specific

This is required to get the test to pass under other serializers / other
python versions.

* Added generic DeserializationError

* switched ValueError to DeserializationError in a test

The changed test is creating an invalid job, which now raises
DeserializationError when data is accessed, as opposed to ValueError.
2021-06-12 11:45:03 +07:00
rpkak 73d0210d65
Add environment variables for connection (#1472)
* Add environment variables for connection

Use same args as in config file

#1342

* add test

* add suggestions

https://github.com/rq/rq/pull/1472#discussion_r640205865
https://github.com/rq/rq/pull/1472#discussion_r640206565

* remove unused import
2021-05-30 18:49:28 +07:00
Joseph ba915508a3
Typo: Than -> Then (#1479)
Co-authored-by: mgjo5899 <mgjo5899@gmail.com>
2021-05-30 18:12:46 +07:00
rpkak d42947fb75
add `/` (#1475) 2021-05-27 07:25:42 +07:00
rpkak 49b489a880
Display ip address of worker in `rq info` (#1463)
* `rq info` displays id address

add feature of #1386

* making redis < 5.0.0 compatible

* address -> ip_address

https://github.com/rq/rq/pull/1463#discussion_r633264327
2021-05-18 08:41:59 +07:00
Selwin Ong ef4f0611a7 Added Python 3.9 to test matrix 2021-05-17 14:00:00 +07:00
Selwin Ong ba276c274e Updated changelog 2021-05-17 13:58:08 +07:00
Selwin Ong 5b5cfdf9ab
Jobs that get cleaned up should also be retried (#1467) 2021-05-15 20:04:52 +07:00
Ashoka Lella d333d20914
Make RQScheduler work with a serializer (#1455)
* Scheduler with a serializer

* test with metadata

Co-authored-by: alella <ashoka.lella@factset.com>
2021-05-14 17:57:09 +07:00
rpkak 428d75b9b6
Support for Click 8.0.0 (#1465)
* `'.'` to `['.']` as path default(s)

view https://github.com/rq/rq/issues/1464#issuecomment-839649116, #1464

* DefaultSerializer class object to `rq.serializers.DefaultSerializer` in shared options

in defaults.py

#1464

* remove unused import

* make rq python 3.5 compatible
2021-05-14 17:43:08 +07:00
dependabot-preview[bot] b84b39f75f
Upgrade to GitHub-native Dependabot (#1454)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-05-07 11:11:11 +07:00
MyrikLD efb24161ab
Replace enum function with internal Enum class (#1459)
* Removed deprecated (object) inheritance
Add new py38,py39 versions to tox, removed deprecated py27,py34
Replace enum internal function with Enum class

* fix
2021-05-07 11:10:46 +07:00
pwws 40b90946a7
bugfix: Allow using staticmethods as jobs (#1458) 2021-05-07 11:07:31 +07:00
Omer Lachish 76ac0afbcd
Cleanup zombie worker leftovers as part of StartedJobRegistry's cleanup() (#1372)
* cleanup jobs that are not really running due to zombie workers

* remove registry entries for zombie jobs

* return only the job ids on cleanup

* test zombie job cleanup

* format code

* rename variable to explain that second element in tuple is expiry, not score

* remove worker_key

* detect zombie jobs using old heartbeats

* reuse get_expired_job_ids

* set score using current_timestamp

* test idle jobs using stale heartbeats

* extract timeout into variable

* move heartbeats into StartedJobRegistry

* use registry.heartbeat in tests

* remove heartbeats when job removed from StartedJobRegistry

* remove idle and expired jobs from both wip and heartbeats set

* send heartbeat_ttl to registry.add

* typo

* revert everything 😶

* only keep job heartbeats as score (and get rid of job timeouts as scores

* calculate heartbeat_ttl in an overrideable function + override it in SimpleWorker + move storing StartedJobRegistry scores to job.heartbeat()

* set heartbeat to monitoring interval for infinite timeouts

* track elapsed_execution_time as part of worker

* reset current job working time when work on a job is done

* persisting the job working time as part of monitoring
2021-04-20 16:05:26 +07:00
rpkak a3ed2db4ea
Changed docker CMD to ENTRYPOINT (#1449)
fix #1448
2021-04-20 07:37:51 +07:00
Antonino Sabetta 1680f49264
Fix mistake in doc of Random dequeuing strategy (#1443) 2021-04-20 07:37:21 +07:00
PetreM 8415ea7eb4
prevent job exception being logged twice (#1440) 2021-04-20 07:37:08 +07:00
James Cobb 6bfd47f735
Newer pip install command from git (#1439)
* Newer pip install command from git

Updated cutting edge pip install command to use HTTPS rather than insecure git+git protocol, as recommended by pip documentation. This allows the command to work with pip >= 21.0.1

* Updated pip command in README
2021-04-01 13:23:18 +07:00
Selwin Ong 42ca608d96 Bump version to 1.8.0 2021-03-31 08:45:17 +07:00
Biel Cardona 08ef54dcf4
Workers dequeuing jobs from queues using both Round-Robin and Random strategies (#1425)
* implemented round-robin and random access to queues

* added tests for RoundRobinQueue

* reverted change in gitignore

* removed linebreak

* added tests for random queues

* added documentation for round robin and random queues

* moved round robin strategy to worker

* reverted changes to queue.py

* reverted changes to workers.md

* reverted changes to test_queue

* added tests for RoundRobinWorker and RandomWorker

* added doc for round robin and random workers

* removed f-strings for backward compatibility

* corrected a mistake

* minor changes (code style)

* now using _ordered_queues instead of queues for reordering queues
2021-03-31 08:15:34 +07:00