Repository: ambari Updated Branches: refs/heads/branch-2.5 b5e917930 -> 03518b055
AMBARI-19058. Perf: Deploy 3000 Agent cluster and find perf bugs. Part 3.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/03518b05 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/03518b05 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/03518b05 Branch: refs/heads/branch-2.5 Commit: 03518b055c6d42bd3b103db89fddbdfd3e2f590e Parents: b5e9179 Author: Vitaly Brodetskyi <[email protected]> Authored: Tue Dec 13 13:27:12 2016 +0200 Committer: Vitaly Brodetskyi <[email protected]> Committed: Tue Dec 13 13:27:12 2016 +0200 ---------------------------------------------------------------------- ambari-agent/conf/unix/agent-multiplier.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/03518b05/ambari-agent/conf/unix/agent-multiplier.py ---------------------------------------------------------------------- diff --git a/ambari-agent/conf/unix/agent-multiplier.py b/ambari-agent/conf/unix/agent-multiplier.py index 7c0774c..5abae58 100644 --- a/ambari-agent/conf/unix/agent-multiplier.py +++ b/ambari-agent/conf/unix/agent-multiplier.py @@ -60,6 +60,7 @@ class Multiplier: self.config_dir = "/etc/ambari-agent/conf" self.pid_file = "/var/run/ambari-agent/ambari-agent.pid" self.prefix_dir = "/var/lib/ambari-agent/data" + self.cache_dir = "/var/lib/ambari-agent/cache" # Ambari Agent config file to use as a template # Will change hostname and port after copying @@ -162,11 +163,12 @@ class Multiplier: host_pid_file = host_home_dir + self.pid_file host_pid_dir = os.path.dirname(host_pid_file) host_prefix = host_home_dir + self.prefix_dir + host_cache_dir = host_home_dir + self.cache_dir if self.verbose: print "Analyzing host %s with port %d" % (host_name, host.ping_port) - for dir in [host_home_dir, host_log_dir, host_config_dir, host_pid_dir, host_prefix]: + for dir in [host_home_dir, host_log_dir, host_config_dir, host_pid_dir, host_prefix, host_cache_dir]: if not os.path.isdir(dir): print "Creating dir %s" % (dir) os.makedirs(dir) @@ -183,6 +185,11 @@ class Multiplier: print "Copying version file %s" % str(version_file) shutil.copyfile(self.source_version_file, version_file) + # Copy cache dir content + if not os.path.isdir(os.path.join(host_cache_dir, "stacks")): + print "Copying cache directory content %s" % str(host_cache_dir) + self.copytree(self.cache_dir, host_cache_dir) + # Create hostname.sh script to use custom FQDN for each agent. host_name_script = os.path.join(host_config_dir, "hostname.sh") self.create_host_name_script(host_name, host_name_script) @@ -193,12 +200,22 @@ class Multiplier: "public_hostname_script": host_name_script, "logdir": host_log_dir, "piddir": host_pid_dir, - "prefix": host_prefix} + "prefix": host_prefix, + "cache_dir": host_cache_dir} self.change_config(host_config_file, config_dict) # Change /etc/hosts file by appending each hostname. self.modify_etc_hosts_file() + def copytree(self, src, dst, symlinks=False, ignore=None): + for item in os.listdir(src): + s = os.path.join(src, item) + d = os.path.join(dst, item) + if os.path.isdir(s): + shutil.copytree(s, d, symlinks, ignore) + else: + shutil.copy2(s, d) + def create_host_name_script(self, host_name, host_name_script): """ Creates a shell script that will echo the given hostname.
