Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions bin/dev/clear-buffer-cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,22 @@
import os
import thread
import time

machinesFile = "/root/spark-ec2/slaves"
import sys

EC2_MACHINES_FILE = "/root/spark-ec2/slaves"

spark_home = os.getenv("SPARK_HOME")
if spark_home is None:
machinesFile = EC2_MACHINES_FILE
if not os.path.exists(machinesFile):
print "Could not find Spark slaves file. SPARK_HOME is not set and could not find file at %s" % EC2_MACHINES_FILE
sys.exit(1)
else:
machinesFile = spark_home + "/conf/slaves"
if not os.path.exists(machinesFile):
print "Could not find Spark slaves file. Based on SPARK_HOME, expected file to be located at %s" % machinesFile
sys.exit(1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested refactor - lift the test out of the if spark_home is None block, use a generic message


machs = open(machinesFile).readlines()
machs = map(lambda s: s.strip(),machs)
machCount = len(machs)
Expand Down