MCPcopy
hub / github.com/rq/django-rq / get_worker_class

Function get_worker_class

django_rq/workers.py:24–39  ·  view source on GitHub ↗

Return worker class from RQ settings, otherwise return Worker. If `worker_class` is not None, it is used as an override (can be python import path as string).

(worker_class=None)

Source from the content-addressed store, hash-verified

22
23
24def get_worker_class(worker_class=None):
25 """
26 Return worker class from RQ settings, otherwise return Worker.
27 If `worker_class` is not None, it is used as an override (can be
28 python import path as string).
29 """
30 RQ = getattr(settings, 'RQ', {})
31
32 if worker_class is None:
33 worker_class = Worker
34 if 'WORKER_CLASS' in RQ:
35 worker_class = RQ.get('WORKER_CLASS')
36
37 if isinstance(worker_class, str):
38 worker_class = import_attribute(worker_class)
39 return worker_class
40
41
42def get_worker(

Callers 4

test_local_overrideMethod · 0.90
get_workerFunction · 0.85
collectMethod · 0.85
handleMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_local_overrideMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…