Git Product home page Git Product logo

grpc-multiprocessing-streaming's Introduction

gRPC multiprocessing with streaming

This repo is a boilerplate showing how you can use multiprocessing with gRPC with streaming capabilities in Python

Payloads streaming allows bypassing gRPC's 2Gb limit in its Python implementation.

Getting started

This project offers a minimum reproducible example of clients sending batches of videos to gRPC servers.

  • Input : video(s)
  • Output : thumbnail(s)

client.py starts a pool of several gRPC channels. Each client process is attributed a video and cuts it into chunks that are sent to one of the gRPC servers parallely to other client processes.

Each response including the video thumbnail gets returned and cut if exceeding 2Gb as well.

  1. Adjust the NUM_WORKERS and NUM_JOBS variables in docker-compose.yml if desired

  2. Add your videos in the input/ directory. Thumbnails will be saved in output/.

# Download 2 videos (to test multiprocessing)
wget -O ./input/video.mp4 https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_640_3MG.mp4
wget -O ./input/video_2.mp4 https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_640_3MG.mp4
  1. Start playing around by running :
docker-compose build
docker-compose run client

Re-compile proto

You must have python3 and pip installed

# In project root directory
python3 -m pip install grpcio==1.32.0 protobuf==3.12.2
python3 -m grpc_tools.protoc --proto_path=./grpc_config --python_out=./grpc_config --grpc_python_out=./grpc_config ./grpc_config/video_thumbnail.proto

Credits

grpc-multiprocessing-streaming's People

Contributors

flavienbwk avatar

Stargazers

 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.