Skip to main content

"Simple, generic cron-like task runner for Django"

Project description

A beat server for Django, with cron-like syntax

Bronski allows you to configure periodic function calls using a Django model.

It is ideally suited to being a task “beat” sever, akin to celery-beat.

Install

$ pip install bronski

Setup

  1. Add ‘bronski’ to your INSTALLED_APPS

    This is only needed to enable the management command.

  1. Create a model in your own app that inherits from bronski.models.CrontabBase

  1. Create and apply migrations:

    $ manage.py makemigrations
    $ manage.py migrate
  1. Specify your model in settings

    CRONTAB_MODEL = "myapp.MyCronModel"
  1. Launch your beat server:

    $ ./manage.py bronski

Each minute the bronski service will scan the model for active tasks that haven’t been run in the past 59 seconds. It will then check each to see if its crontab definition matches the next minute.

For job records that match, their run method will be called. The default run method first calls self.get_function() to import the function specified in the function field, then invokes it, passing the kwargs field as keyword arguments.

You can override run in your custom model to, for instance, enqueue jobs:

class Tasks(CrontabBase):

    def run(self):
        func = self.get_function()
        kwargs = self.get_kwargs()

        # Celery task API:
        func.delay(**kwargs)
        # Dramatiq actor API:
        func.send(**kwargs)

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

bronski-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file bronski-0.1.1.tar.gz.

File metadata

  • Download URL: bronski-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.7

File hashes

Hashes for bronski-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7d21fcac5e4c8c69ff397a79df49bc6dd18c6754150d8090a883093026593d1c
MD5 1082610d56e87e0101b598ab772a80e7
BLAKE2b-256 a134bc99f923f390f044665ff43693f24f9ea5120315c5dc1d8441c354d393bb

See more details on using hashes here.

Provenance

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