Skip to content

Commit

Permalink
Modified sbin/slaves not to export HOSTLIST
Browse files Browse the repository at this point in the history
Modified sbin/slaves to choose localhost as a default host list

Renamed conf/slaves to conf/slaves.template

Added entries about slaves and slaves.template to .rat-excludes

Added entries about slaves to .gitignore
  • Loading branch information
sarutak committed Sep 18, 2014
1 parent 6772afe commit 297e75d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ conf/*.sh
conf/*.properties
conf/*.conf
conf/*.xml
conf/slaves
docs/_site
docs/api
target/
Expand Down
1 change: 1 addition & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ log4j.properties
log4j.properties.template
metrics.properties.template
slaves
slaves.template
spark-env.sh
spark-env.sh.template
log4j-defaults.properties
Expand Down
File renamed without changes.
18 changes: 13 additions & 5 deletions sbin/slaves.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ sbin="`cd "$sbin"; pwd`"
# If the slaves file is specified in the command line,
# then it takes precedence over the definition in
# spark-env.sh. Save it here.
HOSTLIST="$SPARK_SLAVES"
if [ -f "$SPARK_SLAVES" ]; then
HOSTLIST=`cat "$SPARK_SLAVES"`
fi

# Check if --config is passed as an argument. It is an optional parameter.
# Exit if the argument is not a directory.
Expand All @@ -67,20 +69,26 @@ fi

if [ "$HOSTLIST" = "" ]; then
if [ "$SPARK_SLAVES" = "" ]; then
export HOSTLIST="${SPARK_CONF_DIR}/slaves"
if [ -f "${SPARK_CONF_DIR}/slaves" ]; then
HOSTLIST=`cat "${SPARK_CONF_DIR}/slaves"`
else
HOSTLIST=localhost
fi
else
export HOSTLIST="${SPARK_SLAVES}"
HOSTLIST=`cat "${SPARK_SLAVES}"`
fi
fi



# By default disable strict host key checking
if [ "$SPARK_SSH_OPTS" = "" ]; then
SPARK_SSH_OPTS="-o StrictHostKeyChecking=no"
fi

for slave in `cat "$HOSTLIST"|sed "s/#.*$//;/^$/d"`; do
for slave in `echo "$HOSTLIST"|sed "s/#.*$//;/^$/d"`; do
ssh $SPARK_SSH_OPTS "$slave" $"${@// /\\ }" \
2>&1 | sed "s/^/$slave: /" &
2>&1 | sed "s/^/$slave: /"
if [ "$SPARK_SLAVE_SLEEP" != "" ]; then
sleep $SPARK_SLAVE_SLEEP
fi
Expand Down

0 comments on commit 297e75d

Please sign in to comment.