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)
| 22 | |
| 23 | |
| 24 | def 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 | |
| 42 | def get_worker( |
no outgoing calls
searching dependent graphs…