Skip to main content

Simple, generic cron-like job runner service 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.

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

  3. Create and apply migrations:

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

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

    $ ./manage.py bronski

Each minute the bronski service will scan the model for enabled jobs 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 will:

  • get the specified function by calling self.get_function()

  • resolve the kwargs to use by calling self.get_kwargs()

  • invoke the function with the kwargs.

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

class Jobs(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.3.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

bronski-0.3.3-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bronski-0.3.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for bronski-0.3.3.tar.gz
Algorithm Hash digest
SHA256 5e7fe3ad891442e2252575e7120a9fd4172db9b7283a42cb22206f1c154dfa98
MD5 5f66aaeed6ec610527b6ee4c11b6779c
BLAKE2b-256 a9e2ce808902dcddc7ec13bf898e90d7f9b0c5f28dea004d1b0d2ab18e728557

See more details on using hashes here.

Provenance

File details

Details for the file bronski-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: bronski-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for bronski-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 eed5303befc6c7a25f6b1519f38981addf616e4c5d7f74cabebcec4a5388788b
MD5 3b70c3076235d12046dcbea046fa72ab
BLAKE2b-256 bffc8088c52fabad97519d6b63075be649ca033c1bfe0a1f9a5c69a0c421d22b

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