RedisBeater is a Celery Beat Scheduler that stores the scheduled tasks and runtime metadata in Redis. It is a fork of RedBeat
Why RedisBeater?
Dynamic live task creation and modification, without lengthy downtime
Externally manage tasks from any language with Redis bindings
Shared data store; Beat isn’t tied to a single drive or machine
Fast startup even with a large task count
Prevent accidentally running multiple Beat servers
Work with any schedule class which provide required interface
For more background on the genesis of RedisBeater see this blog post
Getting Started
Install with pip:
pip install celery-redisbeater
Configure RedisBeater settings in your Celery configuration file:
redisbeater_redis_url = "redis://localhost:6379/1"
Then specify the scheduler when running Celery Beat:
celery beat -S redisbeater.RedisBeaterScheduler
RedisBeater uses a distributed lock to prevent multiple instances running. To disable this feature, set:
redisbeater_lock_key = None
More details available on Read the Docs
You can initialize and use RedisBeater just as use forked project. You just need to replace RedBeat with RedisBeater. For instance:
RedisBeaterSchedulerEntry(
'task-name',
'tasks.some_task',
interval,
args=['arg1', 2],
).save()
Custom Schedule
If you want to use your custom schedule class, you must define encode_beater method and return fields that your class needs when initialized by RedisBeaterScheduler later. For instance:
class customecrontab(BaseSchedule):
def __init__(self, minute='*', hour='*', day_of_week='*',
day_of_month='*', month_of_year='*', **kwargs):
self.hour = hour
self.minute = minute
self.day_of_week = day_of_week
self.day_of_month = day_of_month
self.month_of_year = month_of_year
super(crontab, self).__init__(**kwargs)
def encode_beater(self):
return {
'minute': self.minute,
'hour': self.hour,
'day_of_week': self.day_of_week,
'day_of_month': self.day_of_month,
'month_of_year': self.month_of_year,
}
Development
RedisBeater is available on GitHub
Once you have the source you can run the tests with the following commands:
pip install -r requirements.dev.txt py.test tests
You can also quickly fire up a sample Beat instance with:
celery beat --config exampleconf
Release files for celery-redisbeater 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| celery-redisbeater-1.0.1.tar.gz | 16.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| celery_redisbeater-1.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 32.0 kB
Release files / celery-redisbeater-1.0.1.tar.gz
| Download URL | celery-redisbeater-1.0.1.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17d7c023b7a2ae7b59fc6ddd0119197e8268fb669358ac6e8707778c11ba5522
|
|
BLAKE2b-256 checksum How to use checksums |
bf10cde31e634f1c2ef7f0fa9611eaaa1244d9d0ef359b543c350dc73ba993c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
|
Release files / celery_redisbeater-1.0.1-py2.py3-none-any.whl
| Download URL | celery_redisbeater-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
bb43bf847b664c1458e35102be4d540a4d6fecac98cc98df4a9ec02abe48b278
|
|
BLAKE2b-256 checksum How to use checksums |
036b6f2d1ab0f0f56e327ee8d59e93aa800d5cac0be7733fe1e37e6a7e9da318
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
|