code: def parallel_map_terminate_early(f, iterable, num_parallel):
      tasks = []
      with cf.ProcessPoolExecutor(num_parallel) as pool:
          for v in iterable:
              tasks.append(pool.submit(functools.partial(f, v)))
  
          for task in cf.as_completed(tasks):
              if task.exception() is not None:
                  e = task.exception()
                  for task in tasks:
                      task.cancel()
                  raise e
  
imports: import argparse
  import concurrent.futures
  import functools
  import json
  import os
  import random
  import re
  import subprocess
  import time
  import urllib.request
label_desc: Use image node_id 1 for calling a global function with example usage: parallel_map_terminate_early(f, iterable, num_parallel) without return types