def CreateTestProcesses(parallel_tests, test_index, process_list, process_done,
                        max_parallel_tests, root_coverage_file=None):
  orig_test_index = test_index
  executable_prefix = [sys.executable] if sys.executable and IS_WINDOWS else []
  s3_argument = ['-s'] if tests.util.RUN_S3_TESTS else []

  process_create_start_time = time.time()
  last_log_time = process_create_start_time
  while (CountFalseInList(process_done) < max_parallel_tests and
         test_index < len(parallel_tests)):
    env = os.environ.copy()
    if root_coverage_file:
      env['GSUTIL_COVERAGE_OUTPUT_FILE'] = root_coverage_file
    process_list.append(subprocess.Popen(
        executable_prefix + [gslib.GSUTIL_PATH] +
        ['-o', 'GSUtil:default_project_id=' + PopulateProjectId()] +
        ['test'] + s3_argument +
        ['--' + _SEQUENTIAL_ISOLATION_FLAG] +
        [parallel_tests[test_index][len('gslib.tests.test_'):]],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env))
    test_index += 1
    process_done.append(False)
    if time.time() - last_log_time > 5:
      print ('Created %d new processes (total %d/%d created)' %
             (test_index - orig_test_index, len(process_list),
              len(parallel_tests)))
      last_log_time = time.time()
  if test_index == len(parallel_tests):
    print ('Test process creation finished (%d/%d created)' %
           (len(process_list), len(parallel_tests)))
  return test_index
Convert the Batch object into the format required for Layer1.
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/test.py/CreateTestProcesses--crossover with--dataset/ETHPy150Open darcyliu/storyboard/boto/dynamodb/batch.py/BatchWrite.to_dict