Commit Graph

23 Commits

Author SHA1 Message Date
Yang Yang 9db728921d
Improve the lint situation (#1688)
* Move common flake8 options into config file

Currently --max-line-length being specified in two places. Just use the
existing value in the config file as the source of truth.

Move --count and --statistics to config file as well.

* Fix some lints
2022-08-07 06:48:00 +07:00
Hugo d5175c38da
Drop python2-specific syntax (#1674)
* Drop syntax required only for Python 2

* Drop python2-style super() calls

Co-authored-by: Selwin Ong <selwin.ong@gmail.com>
2022-07-24 08:17:07 +07:00
Hugo 61a4a1720b
Use unittest.mock instead of mock (#1673)
This module has been included in Python itself since 3.3.

Fixes: https://github.com/rq/rq/issues/1646
2022-07-24 07:12:40 +07:00
Neptalí Piña 34e2427f67
job decorator allow on_failure and on_success parameters (#1626) (#1628)
Co-authored-by: neptali <neptali@plerk.io>
2022-03-02 08:20:30 +07:00
nerok 7bf100ebe7
Allow retries to be set through decorator (#1319)
Co-authored-by: Didrik Koren <didrik.koren@uninett.no>
2020-08-14 07:17:03 +07:00
Thomas Matecki 75644ba948 Multi Dependency Support [Internal API Changes] (#1147)
* Convert `_dependency_id` to `_dependency_ids`

Change `Job`s tracking from a single id of it's dependencies from a single _id_ to a list of _id_s. This change should be private to `Job` - especially leaving `Job#to_dict` and `Job#restore`s treatment of a single 'dependency_id' intact.

This change modifies existing tests.

* Remove reliance upon dependency property in tests

... use dependency.id not  `_dependency_id`

* Re-add assertions for Falsey Values

* Add _dependency_id property

For backwards compatibility with other libs such as django-rq and rq-scheduler
2019-10-22 08:34:47 +07:00
Bartłomiej Biernacki 51efc20371 Add failure_ttl on job decorator (#1130)
Without it you cannot specify custom timeout for failed jobs created using decorator
2019-09-08 18:04:43 +07:00
Darshan Rai ada2ad03ca modify zadd calls for redis-py 3.0 (#1016)
* modify zadd calls for redis-py 3.0

redis-py 3.0 changes the zadd interface that accepts a single
mapping argument that is expected to be a dict.
https://github.com/andymccurdy/redis-py#mset-msetnx-and-zadd

* change FailedQueue.push_job_id to always push a str

redis-py 3.0 does not attempt to cast values to str and is left
to the user.

* remove Redis connection patching

Since in redis-py 3.0, Redis == StrictRedis class, we no longer
need to patch _zadd and other methods.
Ref: https://github.com/rq/rq/pull/1016#issuecomment-441010847
2018-12-03 07:28:36 +07:00
John Lucas 34c403ec8d Add meta to decorator, move depends_on + at_front to decorator (#892) 2017-12-06 21:34:26 +07:00
Jannis Leidel c019662430
Allow passing backend classes (job, queue, worker, connection) from CLI and other APIs
This includes:

- a partial refactor of the CLI to organize the shared options
- extends the tests in areas where passing custom backend classes makes sense
- allow setting the core CLI options as env vars
- minor cosmetic changes here and there
2017-01-25 09:43:36 +01:00
Javi Imbernon 1d6c2b98b7 Add ttl argument to decorator 2016-02-16 15:15:49 +01:00
Vincent Driessen da70ba580b Fix broken import. 2014-05-06 15:56:09 +02:00
Vincent Driessen c5939479b5 Merge remote-tracking branch 'origin/master' into SanyerMyasoedov-master
Conflicts:
	rq/decorators.py
	tests/__init__.py
	tests/test_decorator.py
2014-05-06 15:52:35 +02:00
Vincent Driessen ab9e6b852e Fix PEP8 complaints. 2014-05-05 10:50:02 +02:00
Vincent Driessen 38ec259b6e Enable the most modern Python syntax. 2014-05-05 10:50:02 +02:00
msoedov e76020d894 Removed @resolve_connection from job decorator.
-- resolve_connection already presence inside Queue __init__.
2014-05-04 15:42:19 +03:00
msoedov dd994142b3 Added tests and updated requirements with mock lib. 2014-05-04 15:35:39 +03:00
msoedov 46c96f9481 Added depends_on to job decorator 2014-04-27 20:02:33 +03:00
Vincent Driessen 5e59c6e28e Rename the const. 2012-09-14 09:56:10 +02:00
Scott Burns 538bbb1b55 Decorator accepts result_ttl argument 2012-09-13 11:07:52 -05:00
Vincent Driessen 35dedf3db4 Make test descriptions show up in short (oneliner) mode, as ./run_tests does. 2012-07-24 11:15:23 +02:00
Selwin Ong 8c3292d35b Make "queue" argument in job decorator required.
job decorator now uses Queue's "enqueue_call" method.
2012-07-24 16:03:49 +07:00
Selwin Ong bdc1af28d1 Added a job decorator. 2012-07-23 13:25:31 +07:00