Reputation: 252
I'm trying to figure out rq queuing with redis. I have simple test_job function which I want to use in queue.
def test_job():
return "OK"
And the script taken mainly from rq documentation:
#!/usr/bin/env python
import redis.client
from rq import Queue
import time
from helpers import test_job
def main():
q = Queue(connection=redis.client.Redis('localhost',6379))
job = q.enqueue(test_job)
print job.result # => None
while not job.result:
time.sleep(2)
print job.result # => None
if __name__ == "__main__":
main()
The problem is that I'm not leaving while loop. job.result remains None. However, redis connection seems to work, according to log:
[1279] 30 Dec 12:08:20.041 - 0 clients connected (0 slaves), 612560 bytes in use
[1279] 30 Dec 12:08:21.371 - Accepted 127.0.0.1:58541
[1279] 30 Dec 12:08:25.337 - DB 0: 23 keys (0 volatile) in 32 slots HT.
[1279] 30 Dec 12:08:25.337 - 1 clients connected (0 slaves), 633664 bytes in use
Upvotes: 0
Views: 2072
Reputation: 55199
Did you start a worker to process the task?
It looks like no worker is running (as only your client connected to Redis). Run rqworker
from your project's root.
Upvotes: 3