Reputation: 21
I have a function named spider
which takes seed
as an argument. seed
is the name of the URL I send to the spider function. Now my question is how do I use beanstalkc in Python to queue the URLs and perform the jobs.
Upvotes: 1
Views: 2309
Reputation: 449
According to the tutorial you would need:
Connect:
import beanstalkc
beanstalk = beanstalkc.Connection(host='localhost', port=14711)
Add jobs using:
beanstalk.put('seed url')
Get job via:
job = beanstalk.reserve()
spider(job.body)
Mark job as completed:
job.delete()
Upvotes: 1