Created
May 3, 2017 19:32
-
-
Save avelino/3a3400b79c27be915c5bc10f66444733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import beanstalkc | |
beanstalk = beanstalkc.Connection(host='127.0.0.1', port=11300) | |
if sys.argv[1] == "fill": | |
print "Filling" | |
for i in range(100): | |
beanstalk.put("hello") | |
elif sys.argv[1] == "list": | |
run = True | |
while run: | |
job = beanstalk.reserve(timeout=0) | |
if job is None: | |
run = False | |
print(job) | |
elif sys.argv[1] == "clear": | |
run = True | |
while run: | |
job = beanstalk.reserve(timeout=0) | |
if job is None: | |
run = False | |
else: | |
job.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment