def __init__(self, build_image, suite_names, name, cleanup_containers, cleanup_image, ccache_dir, test_mode, suite_concurrency, parallel_test_concurrency, impalad_mem_limit_bytes, tail): self.build_image = build_image self.name = name self.containers = [] self.git_root = _check_output(["git", "rev-parse", "--show-toplevel"]).strip() # If using worktrees, we need to find $GIT_COMMON_DIR; rev-parse # supports finding it as of vesion 2.5.0; for older versions, we # use $GIT_DIR. git_common_dir = _check_output( ["git", "rev-parse", "--git-common-dir"]).strip() if git_common_dir == "--git-common-dir": git_common_dir = _check_output(["git", "rev-parse", "--git-dir"]).strip() self.git_common_dir = os.path.realpath(git_common_dir) assert os.path.exists(self.git_common_dir) self.git_head_rev = _check_output( ["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip() assert self.git_head_rev, \ "Could not get reference to HEAD using git rev-parse --abbrev-ref HEAD." self.cleanup_containers = cleanup_containers self.cleanup_image = cleanup_image self.image = None if build_image and cleanup_image: # Refuse to clean up external image. raise Exception( "cleanup_image and build_image cannot be both specified") self.ccache_dir = ccache_dir self.log_dir = os.path.join(self.git_root, "logs", "docker", self.name) self.monitoring_output_file = os.path.join(self.log_dir, "metrics.txt") self.monitor = monitor.ContainerMonitor(self.monitoring_output_file) self.test_mode = test_mode self.suite_concurrency = suite_concurrency self.parallel_test_concurrency = parallel_test_concurrency self.impalad_mem_limit_bytes = impalad_mem_limit_bytes self.tail = tail # Map suites back into objects; we ignore case for this mapping. suites = [] suites_by_name = {} for suite in ALL_SUITES: suites_by_name[suite.name.lower()] = suite for suite_name in suite_names: suites.append(suites_by_name[suite_name.lower()]) # If we have enough concurrency, shard some suites into two halves. suites2 = [] for suite in suites: if suite.shard_at_concurrency is not None and \ suite_concurrency >= suite.shard_at_concurrency: suites2.extend(suite.sharded(2)) else: suites2.append(suite) suites = suites2 self.suite_runners = [TestSuiteRunner(self, suite) for suite in suites]
def __init__(self, build_image, suites, name, timeout, cleanup_containers, cleanup_image, ccache_dir, test_mode, suite_concurrency, parallel_test_concurrency, impalad_mem_limit_bytes): self.build_image = build_image self.suites = [TestSuiteRunner(self, suite) for suite in suites] self.name = name self.containers = [] self.timeout_minutes = timeout self.git_root = _check_output(["git", "rev-parse", "--show-toplevel"]).strip() self.cleanup_containers = cleanup_containers self.cleanup_image = cleanup_image self.image = None if build_image and cleanup_image: # Refuse to clean up external image. raise Exception( "cleanup_image and build_image cannot be both specified") self.ccache_dir = ccache_dir self.log_dir = os.path.join(self.git_root, "logs", "docker", self.name) self.monitoring_output_file = os.path.join(self.log_dir, "metrics.txt") self.monitor = monitor.ContainerMonitor(self.monitoring_output_file) self.test_mode = test_mode self.suite_concurrency = suite_concurrency self.parallel_test_concurrency = parallel_test_concurrency self.impalad_mem_limit_bytes = impalad_mem_limit_bytes
def __init__(self, build_image, suite_names, name, cleanup_containers, cleanup_image, ccache_dir, test_mode, suite_concurrency, parallel_test_concurrency, impalad_mem_limit_bytes): self.build_image = build_image self.name = name self.containers = [] self.git_root = _check_output(["git", "rev-parse", "--show-toplevel"]).strip() self.cleanup_containers = cleanup_containers self.cleanup_image = cleanup_image self.image = None if build_image and cleanup_image: # Refuse to clean up external image. raise Exception( "cleanup_image and build_image cannot be both specified") self.ccache_dir = ccache_dir self.log_dir = os.path.join(self.git_root, "logs", "docker", self.name) self.monitoring_output_file = os.path.join(self.log_dir, "metrics.txt") self.monitor = monitor.ContainerMonitor(self.monitoring_output_file) self.test_mode = test_mode self.suite_concurrency = suite_concurrency self.parallel_test_concurrency = parallel_test_concurrency self.impalad_mem_limit_bytes = impalad_mem_limit_bytes # Map suites back into objects; we ignore case for this mapping. suites = [] suites_by_name = {} for suite in ALL_SUITES: suites_by_name[suite.name.lower()] = suite for suite_name in suite_names: suites.append(suites_by_name[suite_name.lower()]) # If we have enough concurrency, shard some suites into two halves. suites2 = [] for suite in suites: if suite.shard_at_concurrency is not None and \ suite_concurrency >= suite.shard_at_concurrency: suites2.extend(suite.sharded(2)) else: suites2.append(suite) suites = suites2 self.suite_runners = [TestSuiteRunner(self, suite) for suite in suites]