code: def _run_tests_in_pool(
      tests_to_run: list[str],
      parallelism: int,
      shell_params: ShellParams,
      extra_pytest_args: tuple,
      test_timeout: int,
      db_reset: bool,
      include_success_outputs: bool,
      debug_resources: bool,
      skip_cleanup: bool,
      skip_docker_compose_down: bool,
  ):
      if not tests_to_run:
          return
      # this should be hard-coded as we want to have very specific sequence of tests
      # Heaviest tests go first and lightest tests go last. This way we can maximise parallelism as the
      # lightest tests will continue to complete and new light tests will get added while the heavy
      # tests are still running. We are only adding here test types that take more than 2 minutes to run
      # on a fast machine in parallel
      sorting_order = [
          "Providers",
          "Providers[-amazon,google]",
          "Core",
          "WWW",
          "CLI",
          "Other",
          "Serialization",
          "Always",
          "PythonVenv",
      ]
      sort_key = {item: i for i, item in enumerate(sorting_order)}
      # Put the test types in the order we want them to run
      tests_to_run = sorted(
          tests_to_run,
          key=lambda x: (sort_key.get(x, len(sorting_order)), x),
      )
      escaped_tests = [
          test.replace("[", "\\[") for test in tests_to_run
      ]
      with ci_group(f"Testing {' '.join(escaped_tests)}"):
          all_params = [f"{test_type}" for test_type in tests_to_run]
          with run_with_pool(
              parallelism=parallelism,
              all_params=all_params,
              debug_resources=debug_resources,
              progress_matcher=GenericRegexpProgressMatcher(
                  regexp=TEST_PROGRESS_REGEXP,
                  regexp_for_joined_line=PERCENT_TEST_PROGRESS_REGEXP,
                  lines_to_search=400,
              ),
          ) as (pool, outputs):
              results = [
                  pool.apply_async(
                      _run_test,
                      kwds={
                          "shell_params": shell_params.clone_with_test(
                              test_type=test_type
                          ),
                          "extra_pytest_args": extra_pytest_args,
                          "db_reset": db_reset,
                          "output": outputs[index],
                          "test_timeout": test_timeout,
                          "skip_docker_compose_down": skip_docker_compose_down,
                      },
                  )
                  for index, test_type in enumerate(tests_to_run)
              ]
      escaped_tests = [
          test.replace("[", "\\[") for test in tests_to_run
      ]
      check_async_run_results(
          results=results,
          success=f"Tests {' '.join(escaped_tests)} completed successfully",
          outputs=outputs,
          include_success_outputs=include_success_outputs,
          skip_cleanup=skip_cleanup,
          summarize_on_ci=SummarizeAfter.FAILURE,
          summary_start_regexp=r".*= FAILURES.*|.*= ERRORS.*",
      )
  
imports: from __future__ import annotations
  import os
  import sys
  from datetime import datetime
  from time import sleep
  import click
  from click import IntRange
  from airflow_breeze.commands.ci_image_commands import rebuild_or_pull_ci_image_if_needed
  from airflow_breeze.commands.common_options import option_backend, option_db_reset, option_debug_resources, option_downgrade_pendulum, option_downgrade_sqlalchemy, option_dry_run, option_forward_credentials, option_github_repository, option_image_name, option_image_tag_for_running, option_include_success_outputs, option_integration, option_mount_sources, option_mysql_version, option_parallelism, option_postgres_version, option_python, option_run_db_tests_only, option_run_in_parallel, option_skip_cleanup, option_skip_db_tests, option_upgrade_boto, option_use_airflow_version, option_verbose
  from airflow_breeze.global_constants import ALLOWED_HELM_TEST_PACKAGES, ALLOWED_PARALLEL_TEST_TYPE_CHOICES, ALLOWED_TEST_TYPE_CHOICES
  from airflow_breeze.params.build_prod_params import BuildProdParams
  from airflow_breeze.params.shell_params import ShellParams
  from airflow_breeze.utils.ci_group import ci_group
  from airflow_breeze.utils.click_utils import BreezeGroup
  from airflow_breeze.utils.console import Output, get_console
  from airflow_breeze.utils.custom_param_types import BetterChoice, NotVerifiedBetterChoice
  from airflow_breeze.utils.docker_command_utils import fix_ownership_using_docker, perform_environment_checks, remove_docker_networks
  from airflow_breeze.utils.parallel import GenericRegexpProgressMatcher, SummarizeAfter, check_async_run_results, run_with_pool
  from airflow_breeze.utils.path_utils import FILES_DIR, cleanup_python_generated_files
  from airflow_breeze.utils.run_tests import file_name_from_test_type, generate_args_for_pytest, run_docker_compose_tests
  from airflow_breeze.utils.run_utils import get_filesystem_type, run_command
  from airflow_breeze.utils.selective_checks import ALL_CI_SELECTIVE_TEST_TYPES
label_desc: Use image node_id 4 for calling a global function with example usage: _run_tests_in_pool(tests_to_run, parallelism, shell_params, extra_pytest_args, test_timeout, db_reset, include_success_outputs, debug_resources, skip_cleanup, skip_docker_compose_down) without return types