|
|
@ -116,18 +116,14 @@ A simple implementation example:
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
```python
|
|
|
|
#!/usr/bin/env python
|
|
|
|
#!/usr/bin/env python
|
|
|
|
import sys
|
|
|
|
from redis import Redis
|
|
|
|
from rq import Connection, Worker
|
|
|
|
from rq import Worker
|
|
|
|
|
|
|
|
|
|
|
|
# Preload libraries
|
|
|
|
# Preload libraries
|
|
|
|
import library_that_you_want_preloaded
|
|
|
|
import library_that_you_want_preloaded
|
|
|
|
|
|
|
|
|
|
|
|
# Provide queue names to listen to as arguments to this script,
|
|
|
|
# Provide the worker with the list of queues (str) to listen to.
|
|
|
|
# similar to rq worker
|
|
|
|
w = Worker(['default'], connection=Redis())
|
|
|
|
with Connection():
|
|
|
|
|
|
|
|
qs = sys.argv[1:] or ['default']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
w = Worker(qs)
|
|
|
|
|
|
|
|
w.work()
|
|
|
|
w.work()
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|