2

I am a new to python and having some issues with threading and queues.

Basically i have a file of URL's, and would like to create a queue of 10 workers which sequentially work down through the file and perform a urllib2 request.

I just cant get my head around it! Could anyone help please with some simple links or code?

Thanks, Matt

1
  • i think you need to show first what you already have. Commented Apr 23, 2012 at 20:01

2 Answers 2

5

The built in "Queue" module would make a good underlying queue for your app. It handles all multi-threaded locking semantics for you.

http://docs.python.org/library/queue.html

You can load your file, populate your Queue, spin up your worker threads, and have them pull from the Queue and do their work.

Sign up to request clarification or add additional context in comments.

1 Comment

I used this link and example to help build out what i wanted in the end. Thank you.
0

This python threadpool module is very helpful for what you describe. The author has a few examples for how to use it on the main page and in the docs.

http://www.chrisarndt.de/projects/threadpool/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.