Skip to content

seraphliu/celery_sqlalchemy_scheduler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What

This repo contains my modification of the Celery Database Scheduler from djcelery project. I've used it in production for over a year now without problems.

How do I use this

You'll have to include the scheduler module in your project and modify the models to work with your SQLAlchemy setup. The code in repo just uses temporary in-memory SQLite database since I cannot assume anything.

Finally, set CELERYBEAT_SCHEDULER to yourproject.sqlalchemy_scheduler:DatabaseScheduler.

Adding and removing tasks is done with manipulating the SQLAlchemy models.

dse = model.DatabaseSchedulerEntry()
dse.name = 'Simple add task'
dse.task = 'yourproject.tasks.add'
dse.arguments = '[]'  # json string
dse.keyword_arguments = '{}'  # json string

# crontab defaults to run every minute
dse.crontab = model.CrontabSchedule()

dbsession.add(dse)
dbsession.commit()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%