Metadata-Version: 2.1
Name: celery-sqlalchemy-scheduler
Version: 0.1.0
Summary: A Scheduler Based SQLalchemy For Celery
Home-page: https://github.com/AngelLiang/celery-sqlalchemy-scheduler
Author: AngelLiang
Author-email: yannanxiu@126.com
License: MIT
Description: # celery-sqlalchemy-scheduler

        

        A Scheduler Based Sqlalchemy for Celery.

        

        ## Getting Started

        

        [English](/README.md) [中文文档](/README-zh.md)

        

        ### Prerequisites

        

        First you must install `celery` and `sqlalchemy`, and `celery` should be >=4.2.0.

        

        ```

        $ pip install celery sqlalchemy

        ```

        

        ### Installing

        

        Install from PyPi:

        

        ```

        $ pip install celery-sqlalchemy-scheduler

        ```

        

        Install from source by cloning this repository:

        

        ```

        $ git clone git@github.com:AngelLiang/celery-sqlalchemy-scheduler.git

        $ cd celery-sqlalchemy-scheduler

        $ python setup.py install

        ```

        

        ## Usage

        

        After you have installed `celery_sqlalchemy_scheduler`, you can easily start with following steps:

        

        This is a demo for exmaple, you can check the code in `examples` directory

        

        1. start celery worker

        

           ```

           $ celery worker -A tasks -l info

           ```

        

        2. start the celery beat with `DatabaseScheduler` as scheduler:

        

           ```

           $ celery beat -A tasks -S celery_sqlalchemy_scheduler.schedulers:DatabaseScheduler -l info

           ```

        

        ## Description

        

        After the celery beat is started, by default it create a sqlite database(`schedule.db`) in current folder. You can use `SQLiteStudio.exe` to inspect it.

        

        ![sqlite](screenshot/sqlite.png)

        

        When you want to update scheduler, you can update the data in `schedule.db`. But `celery_sqlalchemy_scheduler` don't update the scheduler immediately. Then you shoule be change the first column's `last_update` field in the `celery_periodic_task_changed` to now datetime. Finally the celery beat will update scheduler at next wake-up time.

        

        ### Database Configuration

        

        You can configure sqlalchemy db uri when you configure the celery, example as:

        

        ```Python

        from celery import Celery

        

        celery = Celery('tasks')

        

        beat_dburi = 'sqlite:///schedule.db'

        

        celery.conf.update(

            {'beat_dburi': beat_dburi}

        )

        ```

        

        Also, you can use mysql database.

        

        ```Python

        # install mysqlconnector at first: `pip install mysql-connector`

        beat_dburi = 'mysql+mysqlconnector://root:root@127.0.0.1/celery-schedule'

        ```

        

        ## Acknowledgments

        

        - [django-celery-beat](https://github.com/celery/django-celery-beat)

        - [celerybeatredis](https://github.com/liuliqiang/celerybeatredis)

        - [celery](https://github.com/celery/celery)

        
Keywords: celery scheduler sqlalchemy beat
Platform: any
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Description-Content-Type: text/markdown
