Example of how to handle background processes with Flask, Redis Queue, and Docker
Spin up the containers:
$ docker-compose up --build -V --scale worker=4
Spin up the containers in background:
$ docker-compose up -d --build -V --scale worker=4
Stop all containers and workers:
$ docker-compose down -v
Open your browser to http://localhost:5004
Open redis dashboard in http://localhost:9181/
Show logs from worker containers:
docker-compose logs --tail=0 -f master
docker-compose logs --tail=0 -f worker
You can view a list of all the allocated volumes in your system with
docker volume ls
If you prefer a more automatic cleanup, the following command will remove any unused images or volumes, and any stopped containers that are still in the system.
docker system prune --volumes
Below command will remove the following:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
docker system prune
Below command will remove the following:
- all stopped containers
- all networks not used by at least one container
- all images without at least one container associated to them
- all build cache
docker system prune --all --force
Below command will remove all docker images:
docker rmi --force $(docker images --all --quiet)
Following command will help to remove trailing-whitespace, check case conflict, check added large files, check merge conflict by using isort, black and flake8 automation tools.
python3 pre-commit-2.15.0.pyz run -a
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
This architecture has been upgraded in this repo.