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"]
docstr: Run tests parallelly in docker.  Return whether all tests pass.
docstr_tok: ["Run","tests","parallelly","in","docker",".","Return","whether","all","tests","pass","."]
code: def run_tests(
      self,
      team: str,
      test_targets: List[str],
      test_arg: Optional[str] = None,
  ) -> bool:
      """
      Run tests parallelly in docker.  Return whether all tests pass.
      """
      # shard tests and remove empty chunks
      chunks = list(
          filter(
              len,
              [
                  shard_tests(test_targets, self.shard_count, i)
                  for i in self.shard_ids
              ],
          )
      )
      if not chunks:
          # no tests to run
          return True
  
      # divide gpus evenly among chunks
      gpu_ids = chunk_into_n(list(range(self.gpus)), len(chunks))
      (
          bazel_log_dir_host,
          bazel_log_dir_container,
      ) = self._create_bazel_log_mount()
      runs = [
          self._run_tests_in_docker(
              chunks[i],
              gpu_ids[i],
              bazel_log_dir_host,
              self.test_envs,
              test_arg,
          )
          for i in range(len(chunks))
      ]
      exits = [run.wait() for run in runs]
      self._persist_test_results(team, bazel_log_dir_container)
      self._cleanup_bazel_log_mount(bazel_log_dir_container)
  
      return all(exit == 0 for exit in exits)
  
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 3 for calling the TesterContainer obj's underlying member method code with example usage: obj.run_tests(team, test_targets, test_arg) and returns: all, True