title: limit number of threads working in parallel
body: <p>am making a function to copy file from local machine to remote creating thread to do sftp in parallel</p>
  
  <pre><code>def copyToServer():
      //does  copy file given host name and credentials
  
  for i in hostsList:
      hostname = i
      username = defaultLogin
      password = defaultPassword
      thread = threading.Thread(target=copyToServer, args=(hostname, username, password, destPath, localPath))
      threadsArray.append(thread)
      thread.start()
  </code></pre>
  
  <p>this creates thread and does start copying in parallel but i want to limit it to process like 50 threads at a time as total number of servers could be too many</p>