MCPcopy Create free account
hub / github.com/apache/impala / __init__

Method __init__

docker/test-with-docker.py:442–503  ·  view source on GitHub ↗
(self, build_image, suite_names, name, cleanup_containers,
               cleanup_image, ccache_dir, test_mode,
               suite_concurrency, parallel_test_concurrency,
               impalad_mem_limit_bytes, tail,
               env, base_image)

Source from the content-addressed store, hash-verified

440 """Tests Impala using Docker containers for parallelism."""
441
442 def __init__(self, build_image, suite_names, name, cleanup_containers,
443 cleanup_image, ccache_dir, test_mode,
444 suite_concurrency, parallel_test_concurrency,
445 impalad_mem_limit_bytes, tail,
446 env, base_image):
447 self.build_image = build_image
448 self.name = name
449 self.containers = []
450 self.git_root = _check_output(["git", "rev-parse", "--show-toplevel"]).strip()
451 # Protects multiple concurrent calls to "docker create"
452 self.docker_lock = threading.Lock()
453
454 # If using worktrees, we need to find $GIT_COMMON_DIR; rev-parse
455 # supports finding it as of vesion 2.5.0; for older versions, we
456 # use $GIT_DIR.
457 git_common_dir = _check_output(["git", "rev-parse", "--git-common-dir"]).strip()
458 if git_common_dir == "--git-common-dir":
459 git_common_dir = _check_output(["git", "rev-parse", "--git-dir"]).strip()
460 self.git_common_dir = os.path.realpath(git_common_dir)
461 assert os.path.exists(self.git_common_dir)
462
463 self.git_head_rev = _check_output(
464 ["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip()
465 assert self.git_head_rev, \
466 "Could not get reference to HEAD using git rev-parse --abbrev-ref HEAD."
467 self.cleanup_containers = cleanup_containers
468 self.cleanup_image = cleanup_image
469 self.image = None
470 if build_image and cleanup_image:
471 # Refuse to clean up external image.
472 raise Exception("cleanup_image and build_image cannot be both specified")
473 self.ccache_dir = ccache_dir
474 self.log_dir = os.path.join(self.git_root, "logs", "docker", self.name)
475 self.monitoring_output_file = os.path.join(self.log_dir, "metrics.txt")
476 self.monitor = monitor.ContainerMonitor(self.monitoring_output_file)
477 self.test_mode = test_mode
478 self.suite_concurrency = suite_concurrency
479 self.parallel_test_concurrency = parallel_test_concurrency
480 self.impalad_mem_limit_bytes = impalad_mem_limit_bytes
481 self.tail = tail
482 self.env = env
483 self.base_image = base_image
484
485 # Map suites back into objects; we ignore case for this mapping.
486 suites = []
487 suites_by_name = {}
488 for suite in ALL_SUITES:
489 suites_by_name[suite.name.lower()] = suite
490 for suite_name in suite_names:
491 suites.append(suites_by_name[suite_name.lower()])
492
493 # If we have enough concurrency, shard some suites into two halves.
494 suites2 = []
495 for suite in suites:
496 if suite.shard_at_concurrency is not None and \
497 suite_concurrency >= suite.shard_at_concurrency:
498 suites2.extend(suite.sharded(2))
499 else:

Callers

nothing calls this directly

Calls 7

_check_outputFunction · 0.85
TestSuiteRunnerClass · 0.85
shardedMethod · 0.80
LockMethod · 0.45
existsMethod · 0.45
joinMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected