I have a function that effectively does this ->
for each content :
wkhtmlcreatepdf(content)
content can be 10 big records for example .
I need to parellize this process instaed of waiting for each to complete . Is it possible ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Of course it is possible. You just need to use this:
http://docs.python.org/library/multiprocessing.html
or this:
http://docs.python.org/library/threading.html
Note that if the number of jobs is really big, then creating thread/process for each may even crash your OS (and at least there will be no advantage in using like 100 threads). Thus additionally you should use thread/process pools. For example see this:
http://docs.python.org/library/multiprocessing.html#using-a-pool-of-workers