Skip to content

Instantly share code, notes, and snippets.

@avelino
Created May 3, 2017 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avelino/3a3400b79c27be915c5bc10f66444733 to your computer and use it in GitHub Desktop.
Save avelino/3a3400b79c27be915c5bc10f66444733 to your computer and use it in GitHub Desktop.
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