Celery worker
To create a worker, we made our own container image very similar to the Flask container. The Dockerfile uses Alpine Linux and explicitly loads Python 3 onto that image, then installs the requirements from a requirements.txt file and adds in two Python files. The first, celery_conf.py, is the Python definition for a couple of tasks taken directly from the Celery documentation. The second, submit_tasks.py, is a short example that is meant to be run interactively to create work and send it over the queue. The container also includes two shell scripts: run.sh and celery_status.sh.
In all of these cases, we used environment variables that we source from the preceding ConfigMap to set up the logging output from the worker, as well ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access