I am using Python v 2.2.1 and trying to write a code which needs to perform some tasks in parallel inside a for loop. The number of iterations is not fixed and depends on the list (serverList
, in this case). How can I achieve this through multithreading or multiprocessing. I read through some examples but they were calling different functions in parallel. Here I need to call the same function (shutdownTask
), but with different arguments. Part of the code is given below:
try:
<some code>
for server in serverList:
print ('Shutting down server: '+server+'...')
shutdownTask(server, serverType)
finally:
verifyStatus()