The Mule - run arbitrary python function on AWS Batch
Project description
The Mule
TheMule is an async task runner for python.
About
The purpose of this library is to run long running, heavy tasks in the background using cloud-native solutions. It's modular design allows you to use different backends for individual background tasks.
TheMule vs. Celery
TheMule is not intended to replace Celery. They play well together: Celery used to run small and fast tasks, while TheMule is used to run heavy and slow task.
Design principal | TheMule | Celery |
---|---|---|
Worker lifecycle | One docker container per task | Long living worker process |
Application codebase | Main application and worker can run from different docker images, but the syntax is simpler when they share the codebase | Main application and worker share codebase |
Task assignment | Tasks can run on different backends; Tasks assignment is done in backend | Tasks can be assigned to workers with routing |
Task queueing | Backend-specific | External queueing service (Redis, RabbitMQ) |
Available Backends
TheMule comes with pre-made backends and you can write your own.
AWS Batch
Installation: pip install themule[aws_batch]
Class path: themule.backends.AwsBatchBackend
Configuration:
Job parameter | Env variable | Required | Default | Description |
---|---|---|---|---|
aws_batch_queue_name | THEMULE_AWS_BATCH_QUEUE_NAME | Yes | - | The name of AWS Batch queue |
aws_batch_job_definition | THEMULE_AWS_BATCH_JOB_DEFINITION | Yes | - | The name of AWS Batch job definition |
Local Docker
Installation: pip install themule[docker]
Class path: themule.backends.LocalDockerBackend
Configuration:
Job parameter | Env variable | Required | Default | Description |
---|---|---|---|---|
docker_image | THEMULE_DOCKER_IMAGE | Yes | - | The name of the Docker image |
docker_entrypoint | THEMULE_DOCKER_ENTRYPOINT | No | None | Override of the container's entrypoint |
docker_pass_environment | THEMULE_DOCKER_PASS_ENVIRONMENT | No | True | Passes application's env to worker container if true |
docker_environment | THEMULE_DOCKER_ENVIRONMENT | No | None | Additional container environment variables |
docker_auto_remove | THEMULE_DOCKER_AUTO_REMOVE | No | True | Removes the container after worker exit if true |
run_options | THEMULE_DOCKER_RUN_OPTIONS | No | - | Allows to set docker run options |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file themule-0.3.0.tar.gz
.
File metadata
- Download URL: themule-0.3.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b3e29272181bebab03273e4225614d84c915ab332661c895702877160b1fac0 |
|
MD5 | 348636cfbaf2a1f919e0c1365ada1403 |
|
BLAKE2b-256 | 5e0c48cd70543dc25b28e7249f6f1f92a0a874b9c35fdcda1b97571357b8e78b |
File details
Details for the file themule-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: themule-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cba0625cf9e4d04b1d107c0ee0496a3eda9120962259ac0acca4de439e56764 |
|
MD5 | 14420c54416a22e58b453b796e0d00af |
|
BLAKE2b-256 | 1756c00a8da9eb0bc9f77a72bc07b89201460191b104c4c3486ad86a4f4f6b10 |