django-async-tasks
It’s a simple system to process queue task in real time.
Requirements
python 2.7
Django 1.6 through Django 1.9
django-redis-cache
Install
Download it from PyPi with pip install django-async-tasks
Add “async_tasks” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = ( ... 'async_tasks', )Configure settings
Set setting name that defined for Redis in settings.CACHES. The default used ‘default’ setting name.
ASYNC_TASKS_REDIS_SETTING_NAME = 'default'
Setup log path and log filename. The default used for path os.path.join(BASE_DIR, 'logs') and filename 'async-tasks.log'.
ASYNC_TASKS_LOG_PATH = os.path.join(BASE_DIR, 'logs') # Log path ASYNC_TASKS_LOG_FILENAME = 'async-tasks.log' # Log filename
Add cron job to execute every minute:
python manage.py django_async_tasks
How to use?
Add task to execute delayed_task(your_function, **params), return identification code
Check is task ready ready_task(identification_code). Return statuses: 'PROCESS', 'SUCCESS', 'FAIL'
Get result result_task(identification_code)
Example
from async_tasks.utils import delay_task, ready_task, result_task
def test(a, b):
return a + b
def test_delay_task():
idn = delay_task(test, **{'a': 1, 'b': 2})
status = None
while status not in ['SUCCESS', 'FAIL']:
status = ready_task(idn)
if status == 'SUCCESS':
print result_task(idn)
else:
print status
if __name__ == "__main__":
test_delay_task()
Metadata
Release files for django-async-tasks 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-async-tasks-0.1.1.tar.gz | 13.2 kB | Without provenance | Details for django-async-tasks-0.1.1.tar.gz |
Release files / django-async-tasks-0.1.1.tar.gz
| Download URL | django-async-tasks-0.1.1.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8409e090540266da4122f3a727883f209604d2ccbd5ea294c3853cd16a3b09f
|
|
BLAKE2b-256 checksum How to use checksums |
3514f092656e3e8fae328cbf76308d631240c5386ec47ec7f8deacf7dd2fdaf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-async-tasks 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.