Giter Site home page Giter Site logo

hamdisumer / pyspark-testing-env Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emmc15/pyspark-testing-env

0.0 0.0 0.0 79 KB

Example Repo to have full end to end pyspark testing via docker-compose

License: MIT License

Shell 2.81% Python 59.19% Jupyter Notebook 17.81% Dockerfile 20.19%

pyspark-testing-env's Introduction

Pyspark Testing Env

Build and Test Status

Example Repo to have full end-to-end pyspark testing via docker-compose that allows for the following:

  • Quick and Easy setup for local testing and development environment and abstracting the complexity of setting up a pyspark environment
  • Full Pyspark Implementation
  • Full S3 like implementation with Minio
  • Read and write data to S3 and access them as tables in Spark through metastore
  • Ability to run pytest on the pyspark container
  • Read and write with delta format
  • Consistent environment for testing and development with docker-compose and poetry
  • Ability to run tests on push with github actions

NOTE: This repo is not intended to be used in production. It is only intended to be used for testing purposes only.

Quickstart

docker-compose build
docker-compose up -d
docker exec -it spark-node pytest .

Folder Layout

infra: Contains the docker-compose file and the dockerfiles for the spark and minio containers

src: Contains the python code

tests: Contains the example tests used for working with pyspark with either pytest or unittest

.github: Contains the github actions workflow for running the tests on push

What is connection_utils.py?

connection_utils.py is a utility file that contains the logic for connecting to the spark cluster and minio s3 cluster/node. It provides functions with sensible defaults for when running tests and accessing services locally with the docker-compose. When running tests it is highly recommeneded to use them, as without them you will need to pass in the connection information for the spark cluster and minio s3 cluster/node. This is not recommended as it will make the tests less portable and more difficult to run locally. The functions in connection_utils.py are as follows:

  • create_docker_spark_builder: Creates a spark builder that is configured to connect to the spark cluster running in docker-compose
  • create_docker_s3_resource: Creates a boto3 s3 resource that is configured to connect to the minio s3 cluster/node running in docker-compose
  • create_docker_s3_client: Creates a boto3 s3 client that is configured to connect to the minio s3 cluster/node running in docker-compose

pyspark-testing-env's People

Contributors

emmc15 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.