code: def _get_test_targets(
      container: TesterContainer,
      targets: str,
      team: str,
      operating_system: str,
      except_tags: Optional[str] = "",
      only_tags: Optional[str] = "",
      yaml_dir: Optional[str] = None,
      get_flaky_tests: bool = False,
  ) -> List[str]:
      """
      Get test targets that are owned by a particular team
      """
      query = _get_all_test_query(targets, team, except_tags, only_tags)
      test_targets = set(
          container.run_script_with_output(
              [
                  f'bazel query "{query}"',
              ]
          )
          .decode("utf-8")
          # CUDA image comes with a license header that we need to remove
          .replace(CUDA_COPYRIGHT, "")
          .strip()
          .split(os.linesep)
      )
      flaky_tests = set(
          _get_flaky_test_targets(team, operating_system, yaml_dir)
      )
  
      if get_flaky_tests:
          return list(flaky_tests.intersection(test_targets))
      return list(test_targets.difference(flaky_tests))
  
file_path: ray/ci/ray_ci/tester.py
imports: import os
  import sys
  from typing import List, Tuple, Optional
  import yaml
  import click
  from ci.ray_ci.container import _DOCKER_ECR_REPO
  from ci.ray_ci.builder_container import BuilderContainer, DEFAULT_BUILD_TYPE, DEFAULT_PYTHON_VERSION, DEFAULT_ARCHITECTURE, PYTHON_VERSIONS
  from ci.ray_ci.linux_tester_container import LinuxTesterContainer
  from ci.ray_ci.windows_tester_container import WindowsTesterContainer
  from ci.ray_ci.tester_container import TesterContainer
  from ci.ray_ci.utils import docker_login
  from ray_release.configs.global_config import init_global_config
  from ray_release.bazel import bazel_runfile
label_desc: Use image node_id 6 for calling a global function with example usage: _get_test_targets(container, targets, team, operating_system, except_tags, only_tags, yaml_dir, get_flaky_tests) and returns: list, list