Skip to content

Commit 0183ddd

Browse files
nicklanpwendell
authored andcommitted
Bundle tachyon: SPARK-1269
This should all work as expected with the current version of the tachyon tarball (0.4.1) Author: Nick Lanham <nick@afternight.org> Closes #137 from nicklan/bundle-tachyon and squashes the following commits: 2eee15b [Nick Lanham] Put back in exec, start tachyon first 738ba23 [Nick Lanham] Move tachyon out of sbin f2f9bc6 [Nick Lanham] More checks for tachyon script 111e8e1 [Nick Lanham] Only try tachyon operations if tachyon script exists 0561574 [Nick Lanham] Copy over web resources so web interface can run 4dc9809 [Nick Lanham] Update to tachyon 0.4.1 0a1a20c [Nick Lanham] Add scripts using tachyon tarball (cherry picked from commit a18ea00) Signed-off-by: Patrick Wendell <pwendell@gmail.com>
1 parent 20d9458 commit 0183ddd

File tree

6 files changed

+98
-2
lines changed

6 files changed

+98
-2
lines changed

make-distribution.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ echo "Version is ${VERSION}"
5858
# Initialize defaults
5959
SPARK_HADOOP_VERSION=1.0.4
6060
SPARK_YARN=false
61+
SPARK_TACHYON=false
6162
MAKE_TGZ=false
6263

6364
# Parse arguments
@@ -70,6 +71,9 @@ while (( "$#" )); do
7071
--with-yarn)
7172
SPARK_YARN=true
7273
;;
74+
--with-tachyon)
75+
SPARK_TACHYON=true
76+
;;
7377
--tgz)
7478
MAKE_TGZ=true
7579
;;
@@ -90,6 +94,12 @@ else
9094
echo "YARN disabled"
9195
fi
9296

97+
if [ "$SPARK_TACHYON" == "true" ]; then
98+
echo "Tachyon Enabled"
99+
else
100+
echo "Tachyon Disabled"
101+
fi
102+
93103
# Build fat JAR
94104
export SPARK_HADOOP_VERSION
95105
export SPARK_YARN
@@ -113,6 +123,28 @@ cp -r "$FWDIR/python" "$DISTDIR"
113123
cp -r "$FWDIR/sbin" "$DISTDIR"
114124

115125

126+
# Download and copy in tachyon, if requested
127+
if [ "$SPARK_TACHYON" == "true" ]; then
128+
TACHYON_VERSION="0.4.1"
129+
TACHYON_URL="https://github.com/amplab/tachyon/releases/download/v${TACHYON_VERSION}/tachyon-${TACHYON_VERSION}-bin.tar.gz"
130+
131+
TMPD=`mktemp -d`
132+
133+
pushd $TMPD > /dev/null
134+
echo "Fetchting tachyon tgz"
135+
wget "$TACHYON_URL"
136+
137+
tar xf "tachyon-${TACHYON_VERSION}-bin.tar.gz"
138+
cp "tachyon-${TACHYON_VERSION}/target/tachyon-${TACHYON_VERSION}-jar-with-dependencies.jar" "$DISTDIR/jars"
139+
mkdir -p "$DISTDIR/tachyon/src/main/java/tachyon/web"
140+
cp -r "tachyon-${TACHYON_VERSION}"/{bin,conf,libexec} "$DISTDIR/tachyon"
141+
cp -r "tachyon-${TACHYON_VERSION}"/src/main/java/tachyon/web/resources "$DISTDIR/tachyon/src/main/java/tachyon/web"
142+
sed -i "s|export TACHYON_JAR=\$TACHYON_HOME/target/\(.*\)|# This is set for spark's make-distribution\n export TACHYON_JAR=\$TACHYON_HOME/../../jars/\1|" "$DISTDIR/tachyon/libexec/tachyon-config.sh"
143+
144+
popd > /dev/null
145+
rm -rf $TMPD
146+
fi
147+
116148
if [ "$MAKE_TGZ" == "true" ]; then
117149
TARDIR="$FWDIR/spark-$VERSION"
118150
cp -r "$DISTDIR" "$TARDIR"

sbin/start-all.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,22 @@
2424
sbin=`dirname "$0"`
2525
sbin=`cd "$sbin"; pwd`
2626

27+
TACHYON_STR=""
28+
29+
while (( "$#" )); do
30+
case $1 in
31+
--with-tachyon)
32+
TACHYON_STR="--with-tachyon"
33+
;;
34+
esac
35+
shift
36+
done
37+
2738
# Load the Spark configuration
2839
. "$sbin/spark-config.sh"
2940

3041
# Start Master
31-
"$sbin"/start-master.sh
42+
"$sbin"/start-master.sh $TACHYON_STR
3243

3344
# Start Workers
34-
"$sbin"/start-slaves.sh
45+
"$sbin"/start-slaves.sh $TACHYON_STR

sbin/start-master.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@
2222
sbin=`dirname "$0"`
2323
sbin=`cd "$sbin"; pwd`
2424

25+
START_TACHYON=false
26+
27+
while (( "$#" )); do
28+
case $1 in
29+
--with-tachyon)
30+
if [ ! -e "$sbin"/../tachyon/bin/tachyon ]; then
31+
echo "Error: --with-tachyon specified, but tachyon not found."
32+
exit -1
33+
fi
34+
START_TACHYON=true
35+
;;
36+
esac
37+
shift
38+
done
39+
2540
. "$sbin/spark-config.sh"
2641

2742
if [ -f "${SPARK_CONF_DIR}/spark-env.sh" ]; then
@@ -50,3 +65,9 @@ if [ "$SPARK_PUBLIC_DNS" = "" ]; then
5065
fi
5166

5267
"$sbin"/spark-daemon.sh start org.apache.spark.deploy.master.Master 1 --ip $SPARK_MASTER_IP --port $SPARK_MASTER_PORT --webui-port $SPARK_MASTER_WEBUI_PORT
68+
69+
if [ "$START_TACHYON" == "true" ]; then
70+
"$sbin"/../tachyon/bin/tachyon bootstrap-conf $SPARK_MASTER_IP
71+
"$sbin"/../tachyon/bin/tachyon format -s
72+
"$sbin"/../tachyon/bin/tachyon-start.sh master
73+
fi

sbin/start-slaves.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@
2020
sbin=`dirname "$0"`
2121
sbin=`cd "$sbin"; pwd`
2222

23+
24+
START_TACHYON=false
25+
26+
while (( "$#" )); do
27+
case $1 in
28+
--with-tachyon)
29+
if [ ! -e "$sbin"/../tachyon/bin/tachyon ]; then
30+
echo "Error: --with-tachyon specified, but tachyon not found."
31+
exit -1
32+
fi
33+
START_TACHYON=true
34+
;;
35+
esac
36+
shift
37+
done
38+
2339
. "$sbin/spark-config.sh"
2440

2541
if [ -f "${SPARK_CONF_DIR}/spark-env.sh" ]; then
@@ -35,6 +51,13 @@ if [ "$SPARK_MASTER_IP" = "" ]; then
3551
SPARK_MASTER_IP=`hostname`
3652
fi
3753

54+
if [ "$START_TACHYON" == "true" ]; then
55+
"$sbin/slaves.sh" cd "$SPARK_HOME" \; "$sbin"/../tachyon/bin/tachyon bootstrap-conf $SPARK_MASTER_IP
56+
57+
# set -t so we can call sudo
58+
SPARK_SSH_OPTS="-o StrictHostKeyChecking=no -t" "$sbin/slaves.sh" cd "$SPARK_HOME" \; "$sbin/../tachyon/bin/tachyon-start.sh" worker SudoMount \; sleep 1
59+
fi
60+
3861
# Launch the slaves
3962
if [ "$SPARK_WORKER_INSTANCES" = "" ]; then
4063
exec "$sbin/slaves.sh" cd "$SPARK_HOME" \; "$sbin/start-slave.sh" 1 spark://$SPARK_MASTER_IP:$SPARK_MASTER_PORT

sbin/stop-master.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ sbin=`cd "$sbin"; pwd`
2525
. "$sbin/spark-config.sh"
2626

2727
"$sbin"/spark-daemon.sh stop org.apache.spark.deploy.master.Master 1
28+
29+
if [ -e "$sbin"/../tachyon/bin/tachyon ]; then
30+
"$sbin"/../tachyon/bin/tachyon killAll tachyon.master.Master
31+
fi

sbin/stop-slaves.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ if [ -f "${SPARK_CONF_DIR}/spark-env.sh" ]; then
2626
. "${SPARK_CONF_DIR}/spark-env.sh"
2727
fi
2828

29+
# do before the below calls as they exec
30+
if [ -e "$sbin"/../tachyon/bin/tachyon ]; then
31+
"$sbin/slaves.sh" cd "$SPARK_HOME" \; "$sbin"/../tachyon/bin/tachyon killAll tachyon.worker.Worker
32+
fi
33+
2934
if [ "$SPARK_WORKER_INSTANCES" = "" ]; then
3035
"$sbin"/spark-daemons.sh stop org.apache.spark.deploy.worker.Worker 1
3136
else

0 commit comments

Comments
 (0)