title: How to put executor.map() in a loop and separate each iteration?
body: <p>I want to send HTTP requests to 10,000 hosts, and I have 5 different header values. I want to send 10,000 requests with the 1st header value attached, wait it to finish, and then start the second 10,000 request with the 2nd header value attached, within each 10,000 request I want to use multipthread  to fasten the process. </p>
  
  <p>To send just requests to 10,000 hosts with mutilpthread, I can do with the following code: </p>
  
  <pre><code>with concurrent.futures.ThreadPoolExecutor(max_workers = CONNECTIONS) as executor:
    args = ((url, header) for url in urls)
    executor.map(lambda p: send_request(*p), args) 
  </code></pre>
  
  <p>To implement what I eventually want, I am thinking to wrap the above code this way: </p>
  
  <pre><code>for header in headers:
    with concurrent.futures.ThreadPoolExecutor(max_workers = CONNECTIONS) as executor:
      args = ((url, header) for url in urls)
      executor.map(lambda p: send_request(*p), args) 
  </code></pre>
  
  <p>But it does not seem to work. It runs the loop but seems skipped the whole loop body. I wonder where I did it wrong, and what is the correct way to do it.</p>