diff options
author | f0cker <f0cker@users.noreply.github.com> | 2021-01-19 01:19:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-19 08:19:31 +0700 |
commit | efe703214e1015db53d4942398435a8c597d7a2d (patch) | |
tree | 111c2f7c6d356373aecdd9786ee03560d8beeafe /docs | |
parent | 11c8631921cd9738b94c17937315ec9dba0041b7 (diff) | |
download | rq-efe703214e1015db53d4942398435a8c597d7a2d.tar.gz |
Added --serializer option to cli, finishing off PR #1381 and fix #1357 (#1395)
* Added --serializer option to cli, finishing off PR #1381 and fix #1357
* Update documentation
* Update documentation
* Modified help message
Co-authored-by: f0cker <dturner@trustwave.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/docs/workers.md | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/docs/docs/workers.md b/docs/docs/workers.md index 9d2f134..ae89b4a 100644 --- a/docs/docs/workers.md +++ b/docs/docs/workers.md @@ -69,6 +69,7 @@ In addition to `--burst`, `rq worker` also accepts these arguments: * `--date-format`: Datetime format for the worker logs, defaults to `'%H:%M:%S'` * `--disable-job-desc-logging`: Turn off job description logging. * `--max-jobs`: Maximum number of jobs to execute. +* `--serializer`: Path to serializer object (e.g "rq.serializers.DefaultSerializer" or "rq.serializers.JSONSerializer") ## Inside the worker @@ -205,23 +206,24 @@ workers = Worker.all(queue=queue) ## Worker with Custom Serializer When creating a worker, you can pass in a custom serializer that will be implicitly passed to the queue. -Serializers used should have at least `loads` and `dumps` method. +Serializers used should have at least `loads` and `dumps` method. An example of creating a custom serializer +class can be found in serializers.py (rq.serializers.JSONSerializer). The default serializer used is `pickle` ```python -import json from rq import Worker +from rq.serialzers import JSONSerializer -job = Worker('foo', serializer=json) +job = Worker('foo', serializer=JSONSerializer) ``` or when creating from a queue ```python -import json from rq import Queue, Worker +from rq.serialzers import JSONSerializer -w = Worker(Queue('foo'), serializer=json) +w = Queue('foo', serializer=JSONSerializer) ``` Queues will now use custom serializer |