28
loading...
This website collects cookies to deliver better user experience
pyspark
tests to run at every commit made on an open pull/merge request as well as after merge (because, you know... we love tests).Dockerfile
and docker-compose.yaml
, which installed whatever requirements.txt
we placed in the root of the repo and ran all the tests.FROM openjdk:8
ARG PYTHON_VERSION=3.7
ENV PATH="/root/miniconda3/bin:${PATH}"
# provision python with miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
&& conda install python=$PYTHON_VERSION -y \
&& conda init bash
RUN . /root/.bashrc
tests/Dockerfile
and then the following docker-compose.yaml
in the root of the repo.version: "3.0"
services:
test:
build:
context: .
dockerfile: ./tests/Dockerfile
args:
PYTHON_VERSION: 3.7
working_dir: /app
volumes:
- .:/app/
command:
- /bin/bash
- -c
- |
pip install pytest
pip install -r ./requirements.txt # including pyspark==2.4.2
pytest ./tests
docker-compose up test
either on the designated CICD pipeline step and see the results. At least, there's no excuse for anyone to say they can't run the tests. Yeah, but there's jupyter pyspark notebook
images out there with the similar pre-installed stack.
mklabsio/pyspark:py37-spark242
image in your docker-compose.yaml
, get rid of the Dockerfile
and leave everything as before.version: "3.0"
services:
test:
**image: mklabsio/pyspark:py37-spark242**
working_dir: /app
volumes:
- .:/app/
command:
- /bin/bash
- -c
- |
pip install pytest
pip install -r ./requirements.txt # including pyspark==2.4.2
pytest ./tests