File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1111# ZooKeeper URL, etc as read from the environment.
1212
1313# Find system memory in KB and compute Spark's default limit from that
14- system_ram_kb = int (
15- os .popen ("cat /proc/meminfo | grep MemTotal | awk '{print $2}'" )
16- .read ().strip ())
14+ mem_command = "cat /proc/meminfo | grep MemTotal | awk '{print $2}'"
15+
16+ master_ram_kb = int (
17+ os .popen (mem_command ).read ().strip ())
18+ # This is the master's memory. Try to find slave's memory as well
19+ first_slave = os .popen ("cat /root/spark-ec2/slaves | head -1" ).read ().strip ()
20+
21+ slave_mem_command = "ssh -t -o StrictHostKeyChecking=no %s %s" % \
22+ (first_slave , mem_command )
23+ slave_ram_kb = int (os .popen (slave_mem_command ).read ().strip ())
24+
25+ system_ram_kb = min (slave_ram_kb , master_ram_kb )
26+
1727system_ram_mb = system_ram_kb / 1024
1828if system_ram_mb > 20 * 1024 :
1929 # Leave 3 GB for the OS, HDFS and buffer cache
You can’t perform that action at this time.
0 commit comments