GithubHelp home page GithubHelp logo

tonal / celerybeatmongo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sm11963/celerybeatmongo

0.0 2.0 0.0 9 KB

A very simple Celery Beat Scheduler that stores status information in a MongoDB database.

Python 100.00%

celerybeatmongo's Introduction

celerybeatmongo

A very simple Celery Beat Scheduler that stores status information in a MongoDB database.

Install

pip install celerybeatmongo

Details

This project provides a Celery Beat Scheduler that uses MongoDB to store the schedule stats (last run, run count, etc.). This is safer than using a file on your server which could be cleared or corrupted (on Heroku for example). This scheduler aims to replace the default Beat Scheduler provided with Celery. There are a few caveats though:

  • Only supports interval scheduling (currently, easy to add support for Crontab and Solar)
  • Can only pass native JSON types (dict, list, str, number) to kwargs, args, and options for tasks

Motivation

I started this project because I run Celerybeat on Heroku and I started noticing that tasks were being dropped. This was because the default Celerybeat Scheduler ([celery.beat.PersistentScheduler](http://docs.celeryproject.org/en/latest/reference/celery.beat.html#celery.beat.PersistentScheduler)) uses a shelve database file that it adds the current directory. In Heroku this file was cleared and so the schedule data was not saved reliably. With the celerybeatmongo.MongoPersistentScheduler this is not an issue anymore.

Example

Please see examples/celery_worker.py for a simple example to just try it out.

Running the example requires MongoDB and Redis (you can edit it to use another Broker instead if Redis if you want).

You can run the following to start the example:

  1. In a seperate terminal window, start Redis:
$ redis-server      # start redis
  1. In a seperate terminal window, start MongoDB:
$ mongod
  1. Then start the example worker:
$ pip install redis
$ python examples/celery_worker.py

Contribute

Please add issues or put up pull requests if you need more functionality or have suggestions. Its a new project and should be easy to contribute to!

celerybeatmongo's People

Contributors

sm11963 avatar tonal 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.