Fix build failure by adding example and include files (#10610)

Signed-off-by: June Yi <gochist@gmail.com>
This commit is contained in:
June Yi
2018-10-14 20:58:41 +09:00
committed by k8s-ci-robot
parent d14b898a91
commit 462f4553e2
7 changed files with 126 additions and 3 deletions
@@ -0,0 +1,23 @@
#!/usr/bin/env python
import time
import rediswq
host="redis"
# Uncomment next two lines if you do not have Kube-DNS working.
# import os
# host = os.getenv("REDIS_SERVICE_HOST")
q = rediswq.RedisWQ(name="job2", host="redis")
print("Worker with sessionID: " + q.sessionID())
print("Initial queue state: empty=" + str(q.empty()))
while not q.empty():
item = q.lease(lease_secs=10, block=True, timeout=2)
if item is not None:
itemstr = item.decode("utf=8")
print("Working on " + itemstr)
time.sleep(10) # Put your actual work here instead of sleep.
q.complete(item)
else:
print("Waiting for work")
print("Queue empty, exiting")