Files
website/content/ko/examples/application/job/redis/worker.py
T
Jerry Park 9cb997ab15 Second Korean l10n work for release-1.19
- Fix issue with links to already translated documents (#23829)
- Update outdated files in the dev-1.19-ko.2 branch (#23827)
- Fix issue with links to already translated documents (#23999)
- Translate tasks/configure-pod-container/configure-persistent-volume-storage in Korean (#23867)
- Translate reference/access-authn-authz/service-accounts-admin/ into Korean (#23974)
- Translate reference/access-authn-authz/controlling-access/ into Korean (#23955)
- Translate tasks/job/automated-tasks-with-cron-jobs.md into Korean (#23543)
- Translate reference/access-authn-authz/authorization/ into Korean (#23989)
- Update Ko localization guide (#24023)
- Translate tasks/job/fine-parallel-processing-work-queue/ into Korean (#23841)
- Translate setup/production-environment/windows/intro-windows-in-kubernetes and reflect reviews (#23879)
- Translate tasks/debug-application-cluster/debug-pod-replication-controller in Korean (#23896)

Co-authored-by: seokho-son <shsongist@gmail.com>
Co-authored-by: jmyung <jesang.myung@gmail.com>
Co-authored-by: Jerry Park <jaehwa@gmail.com>
Co-authored-by: markruler <csu0414@gmail.com>
Co-authored-by: bluefriday <bluefriday86@gmail.com>
2020-09-25 13:58:55 +09:00

24 lines
657 B
Python

#!/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")