Skip to content

Instantly share code, notes, and snippets.

@wrunk
Created August 15, 2014 00:00
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 wrunk/d1c13fd19b01a30107b6 to your computer and use it in GitHub Desktop.
Save wrunk/d1c13fd19b01a30107b6 to your computer and use it in GitHub Desktop.
def my_thread_func(comment_id):
# form url based on comment id so http://www.evite.com/services/<comment_id>/whatever
# send request
# check result, log error
from multiprocessing.pool import ThreadPool as Pool
def main():
# Read file into a list of IDs
list_of_ids = [read from file]
pool = Pool(processes=4) # start 4 worker threads in this case
print pool.map(my_thread_func, list_of_ids)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment