Skip to main content

Persist uWSGI spooled tasks in uWSGI cache

Project description

A polyvalent Task model to get the most out of uWSGI’s spooler with minimal effort.

Install

Install django-threadlocals if you want automatic provisioning of Task.user and Task.creation_ip.

This app works without uwsgi installed (ie. runserver), but you can test your wsgi app with a command like:

uwsgi --env DEBUG=1 --spooler=/tmp/spool --spooler-processes 16 --http-socket=0.0.0.0:8000 --plugin=python --module=mrs.wsgi:application --honour-stdin

Add django_uwsgi_spooler to INSTALLED_APPS and execute migrations with the ./manage.py migrate command.

django_uwsgi_spooler.models will set uwsgi.spooler so you don’t have any extra setup to do to enjoy uWSGI spooler, besides have it enabled if you want tasks to actually run in the background.

If you have CRUDLFA+ installed, it will register a CRUD for task, which will gain a lot of features as we move forward to 1.0 release as you can imagine: towards full control of the spooler as permited by uWSGI’s API.

Usage

Your callback is just a function that takes a task argument:

def yourcallback(task):
    # do stuff ...

You can start a task as such:

Task(callback_name='yourmodule.yourcallback').spool()

See a more elaborated example in django_uwsgi_spooler/example.py

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

django-uwsgi-spooler-0.0.0.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file django-uwsgi-spooler-0.0.0.tar.gz.

File metadata

File hashes

Hashes for django-uwsgi-spooler-0.0.0.tar.gz
Algorithm Hash digest
SHA256 eecb7533027dcb963cc7cca3566d9bc33218e431a755c05a9c89d88bd3d94152
MD5 3960a205c4f3346ea131ead93f373dee
BLAKE2b-256 7be3cb959a3e8ee0018ac0ae0981ba08f8516b1e76ba36a0af77d23b21566104

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page