-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add spark master and worker image build
- Loading branch information
1 parent
af235d9
commit c51a77f
Showing
10 changed files
with
181 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM quay.io/cdis/spark-base:3.3.0-hadoop3.3 | ||
|
||
LABEL maintainer="Gezim Sejdiu <g.sejdiu@gmail.com>, Giannis Mouchakis <gmouchakis@gmail.com>" | ||
|
||
ENV SPARK_MASTER_PORT 7077 | ||
ENV SPARK_MASTER_WEBUI_PORT 8080 | ||
ENV SPARK_MASTER_LOG /spark/logs | ||
|
||
RUN mkdir /tube | ||
WORKDIR /tube | ||
|
||
# copy ONLY poetry artifact, install the dependencies but not fence | ||
# this will make sure than the dependencies is cached | ||
COPY ../../../poetry.lock ../../../pyproject.toml /tube/ | ||
RUN python -m poetry config virtualenvs.create false \ | ||
&& python -m poetry install -vv --no-root --only main --no-interaction \ | ||
&& python -m poetry show -v | ||
|
||
# copy source code ONLY after installing dependencies | ||
COPY ../../../tube /tube/ | ||
|
||
RUN python -m poetry config virtualenvs.create false \ | ||
&& python -m poetry install -vv --only main --no-interaction \ | ||
&& python -m poetry show -v | ||
|
||
EXPOSE 8080 7077 6066 | ||
|
||
COPY master.sh / | ||
|
||
CMD ["/bin/bash", "/master.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
export SPARK_MASTER_HOST=${SPARK_MASTER_HOST:-`hostname`} | ||
|
||
export SPARK_HOME=/spark | ||
|
||
. "/spark/sbin/spark-config.sh" | ||
|
||
. "/spark/bin/load-spark-env.sh" | ||
|
||
mkdir -p $SPARK_MASTER_LOG | ||
|
||
ln -sf /dev/stdout $SPARK_MASTER_LOG/spark-master.out | ||
|
||
cp /spark/conf/log4j2.properties.template /spark/conf/log4j2.properties | ||
sed -i 's/= info/= DEBUG/g' /spark/conf/log4j2.properties | ||
echo "logger.org.apache.spark=DEBUG" >> /spark/conf/log4j2.properties | ||
|
||
function addConfig() { | ||
local path=$1 | ||
local name=$2 | ||
local value=$3 | ||
|
||
local entry="<property><name>$name</name><value>${value}</value></property>" | ||
local escapedEntry=$(echo $entry | sed 's/\//\\\//g') | ||
sed -i "/<\/configuration>/ s/.*/${escapedEntry}\n&/" $path | ||
} | ||
|
||
cd /spark/bin && /spark/sbin/../bin/spark-class -Dlog4j.configuration=file:/spark/conf/log4j2.properties org.apache.spark.deploy.master.Master \ | ||
--ip $SPARK_MASTER_HOST --port $SPARK_MASTER_PORT --webui-port $SPARK_MASTER_WEBUI_PORT >> $SPARK_MASTER_LOG/spark-master.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM quay.io/cdis/spark-base:3.3.0-hadoop3.3 | ||
|
||
LABEL maintainer="Gezim Sejdiu <g.sejdiu@gmail.com>, Giannis Mouchakis <gmouchakis@gmail.com>" | ||
|
||
ENV SPARK_MASTER_NAME spark-master | ||
ENV SPARK_MASTER_PORT 7077 | ||
|
||
COPY submit.sh / | ||
|
||
CMD ["/bin/bash", "/submit.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
export SPARK_MASTER_URL=spark://${SPARK_MASTER_NAME}:${SPARK_MASTER_PORT} | ||
export SPARK_HOME=/spark | ||
|
||
/wait-for-step.sh | ||
/execute-step.sh | ||
|
||
if [ ! -z "${SPARK_APPLICATION_JAR_LOCATION}" ]; then | ||
echo "Submit application ${SPARK_APPLICATION_JAR_LOCATION} with main class ${SPARK_APPLICATION_MAIN_CLASS} to Spark master ${SPARK_MASTER_URL}" | ||
echo "Passing arguments ${SPARK_APPLICATION_ARGS}" | ||
/${SPARK_HOME}/bin/spark-submit \ | ||
--class ${SPARK_APPLICATION_MAIN_CLASS} \ | ||
--master ${SPARK_MASTER_URL} \ | ||
${SPARK_SUBMIT_ARGS} \ | ||
${SPARK_APPLICATION_JAR_LOCATION} ${SPARK_APPLICATION_ARGS} | ||
else | ||
if [ ! -z "${SPARK_APPLICATION_PYTHON_LOCATION}" ]; then | ||
echo "Submit application ${SPARK_APPLICATION_PYTHON_LOCATION} to Spark master ${SPARK_MASTER_URL}" | ||
echo "Passing arguments ${SPARK_APPLICATION_ARGS}" | ||
PYSPARK_PYTHON=python3 /spark/bin/spark-submit \ | ||
--master ${SPARK_MASTER_URL} \ | ||
${SPARK_SUBMIT_ARGS} \ | ||
${SPARK_APPLICATION_PYTHON_LOCATION} ${SPARK_APPLICATION_ARGS} | ||
else | ||
echo "Not recognized application." | ||
fi | ||
fi | ||
|
||
/finish-step.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM quay.io/cdis/spark-base:3.3.0-hadoop3.3 | ||
|
||
LABEL maintainer="Gezim Sejdiu <g.sejdiu@gmail.com>, Giannis Mouchakis <gmouchakis@gmail.com>" | ||
|
||
ENV SPARK_WORKER_WEBUI_PORT 8081 | ||
ENV SPARK_WORKER_LOG /spark/logs | ||
ENV SPARK_MASTER "spark://spark-master:7077" | ||
|
||
RUN mkdir /tube | ||
WORKDIR /tube | ||
|
||
# copy ONLY poetry artifact, install the dependencies but not fence | ||
# this will make sure than the dependencies is cached | ||
COPY ../../../poetry.lock ../../../pyproject.toml /tube/ | ||
RUN python -m poetry config virtualenvs.create false \ | ||
&& python -m poetry install -vv --no-root --only main --no-interaction \ | ||
&& python -m poetry show -v | ||
|
||
# copy source code ONLY after installing dependencies | ||
COPY ../../../tube /tube | ||
|
||
RUN python -m poetry config virtualenvs.create false \ | ||
&& python -m poetry install -vv --only main --no-interaction \ | ||
&& python -m poetry show -v | ||
|
||
EXPOSE 8081 | ||
|
||
COPY worker.sh / | ||
|
||
CMD ["/bin/bash", "/worker.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
export SPARK_HOME=/spark | ||
|
||
. "/spark/sbin/spark-config.sh" | ||
|
||
. "/spark/bin/load-spark-env.sh" | ||
|
||
mkdir -p $SPARK_WORKER_LOG | ||
|
||
ln -sf /dev/stdout $SPARK_WORKER_LOG/spark-worker.out | ||
|
||
cp /spark/conf/log4j2.properties.template /spark/conf/log4j2.properties | ||
sed -i 's/= info/= DEBUG/g' /spark/conf/log4j2.properties | ||
echo "logger.org.apache.spark=DEBUG" >> /spark/conf/log4j2.properties | ||
|
||
/spark/sbin/../bin/spark-class -Dlog4j.configuration=file:/spark/conf/log4j2.properties org.apache.spark.deploy.worker.Worker \ | ||
--webui-port $SPARK_WORKER_WEBUI_PORT $SPARK_MASTER >> $SPARK_WORKER_LOG/spark-worker.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters