class_docstr: A wrapper for running tests in ray ci docker container
class_docstr_tok: ["A","wrapper","for","running","tests","in","ray","ci","docker","container"]
code: def _run_tests_in_docker(
      self,
      test_targets: List[str],
      gpu_ids: List[int],
      bazel_log_dir_host: str,
      test_envs: List[str],
      test_arg: Optional[str] = None,
  ) -> subprocess.Popen:
      logger.info("Running tests: %s", test_targets)
      commands = [
          f'cleanup() {{ chmod -R a+r "{self.bazel_log_dir}"; }}',
          "trap cleanup EXIT",
      ]
      if platform.system() == "Windows":
          # allow window tests to access aws services
          commands.append(
              "powershell ci/pipeline/fix-windows-container-networking.ps1"
          )
      if self.build_type == "ubsan":
          # clang currently runs into problems with ubsan builds, this will revert to
          # using GCC instead.
          commands.append("unset CC CXX")
      # note that we run tests serially within each docker, since we already use
      # multiple dockers to shard tests
      test_cmd = "bazel test --jobs=1 --config=ci $(./ci/run/bazel_export_options) "
      if self.build_type == "debug":
          test_cmd += "--config=ci-debug "
      if self.build_type == "asan":
          test_cmd += "--config=asan --config=asan-buildkite "
      if self.build_type == "clang":
          test_cmd += "--config=llvm "
      if self.build_type == "asan-clang":
          test_cmd += "--config=asan-clang "
      if self.build_type == "ubsan":
          test_cmd += "--config=ubsan "
      if self.build_type == "tsan-clang":
          test_cmd += "--config=tsan-clang "
      for env in test_envs:
          test_cmd += f"--test_env {env} "
      if test_arg:
          test_cmd += f"--test_arg {test_arg} "
      test_cmd += f"{' '.join(test_targets)}"
      commands.append(test_cmd)
      return subprocess.Popen(
          self.get_run_command(
              commands,
              network=self.network,
              gpu_ids=gpu_ids,
              volumes=[f"{bazel_log_dir_host}:{self.bazel_log_dir}"],
          )
      )
  
imports: import json
  import os
  import platform
  import random
  import shutil
  import string
  import subprocess
  from typing import List, Tuple, Optional
  from os import path, listdir
  from ci.ray_ci.utils import shard_tests, chunk_into_n
  from ci.ray_ci.utils import logger
  from ci.ray_ci.container import Container
  from ray_release.test import TestResult, Test
label_desc: Use image node_id 9 for calling the TesterContainer obj's underlying member method code with example usage: obj._run_tests_in_docker(test_targets, gpu_ids, bazel_log_dir_host, test_envs, test_arg) and returns: subprocess