Code Monkey home page Code Monkey logo

bambu-cron's Introduction

Bambu Cron

A simple scheduling system that lets you define jobs that get performed at various intervals

About Bambu Cron

Bambu Cron makes it easy to define scheduled tasks that can run as rarely as once a year os often as once a minute. The syadmin only needs to add an extra line to the crontab file belonging to the user with permission to perform actions on the site, and and Bambu Cron will do the rest.

Jobs are defined very simply, and a flag is set to alert the system that a job is running, so that frequent jobs that take longer than a minute to run, don't run in parallel.

About Bambu Tools 2.0

This is part of a toolset called Bambu Tools. It's being moved from a namespace of bambu to its own 'root-level' package, along with all the other tools in the set. If you're upgrading from a version prior to 2.0, please make sure to update your code to use bambu_cron rather than bambu_cron.

Installation

Install the package via Pip:

pip install bambu-cron

Add it to your INSTALLED_APPS list:

INSTALLED_APPS = (
    ...
    'bambu_cron'
)

Run manage.py syncdb or manage.py migrate to setup the database tables.

Basic usage

You define cron jobs and register them in a file called cron.py, which you add to your Django app. Only cron.py files found within an app referenced in the INSTALLED_APPS setting will be discovered.

import bambu_cron

class EmailDigestJob(bambu_cron.CronJob):
    frequency = bambu_cron.frequency.DAY
    
    def run(self, logger):
        # Send a digest email on a daily basis
        ...

bambu_cron.site.register(EmailDigestJob)

This registers the EmailDigestJob job. Once registered, you'll need to call python manage.py cron --setup to allow Bambu Cron to store details of the job in the database.

Documentation

Full documentation can be found at ReadTheDocs.

Questions or suggestions?

Find me on Twitter (@iamsteadman) or visit my blog.

bambu-cron's People

Contributors

hellosteadman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.