A Django app for running periodic or one off jobs.
Project description
Simple async jobs is a Django app that provides you a simple way for running periodic and one off jobs using django management commands.
Quick start
Add “simple_jobs” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'simple_jobs', ]
Setup the settings like this:
JOB_POLLER_TIMEOUT_BEFORE_KILLED = 60 DEFAULT_LOGGER_NAME = "jobs" PERIODIC_JOBS_LOGGER_NAME = "periodic_jobs" ONE_OFF_JOBS_LOGGER_NAME = "one_off_jobs" DEFAULT_MAX_ONE_OFF_JOBS_RUNS_PER_LIFE = 10 DEFAULT_MAX_PERIODIC_JOBS_RUNS_PER_LIFE = 50 DEFAULT_MAX_JOB_RETRIES = 6 DEFAULT_JOB_RETRY_SECONDS_INTERVAL = 900
Run python manage.py migrate to create the polls models.
Start the development server and visit http://127.0.0.1:8000/admin/ to create a Job (you’ll need the Admin app enabled).
5. Run the python manage.py one_off_job_poller or python manage.py periodic_job_poller. It’s recommended to use one of these command as CMD for docker container in docker-compose config with parameter restart=always. The lifetime of container consists of the following:
1) retrieve jobs 2) execute jobs until the limit is hit 3) sleep for time specified in settings 4) exit
Once container is dead it will be started again by docker-compose.
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
File details
Details for the file django-simple-async-jobs-0.1.1.tar.gz
.
File metadata
- Download URL: django-simple-async-jobs-0.1.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 807fa88fff419bb914e027040779a90dbe035b0e9817d3c2eddea9d99c4ab0c8 |
|
MD5 | bdae95eb9d6ef3b157fbc1e2cad27937 |
|
BLAKE2b-256 | ad7c4a0cfe3c5d41307597409e953723ffa8480561c27c95f801c0f388c28a62 |