SPARK_HOME=$(python3 -c 'import json,sys;config=json.load(open("./settings.json"));print(config["spark_home"])')
SPARK_MASTER=$(python3 -c 'import json,sys;config=json.load(open("./settings.json"));print(config["spark_master"])')

echo "Starting spark master..."
"$SPARK_HOME"/sbin/start-master.sh
echo "Starting spark workers..."
SPARK_WORKER_INSTANCES=5 "$SPARK_HOME"/sbin/start-worker.sh "$SPARK_MASTER"
echo "Starting cassandra container..."
docker run -d -p 9042:9042 cassandra
echo "Starting spark history server..."
mkdir -p /tmp/spark-events
"$SPARK_HOME"/sbin/start-history-server.sh