Skip to content

Commit 5058094

Browse files
author
saber
committed
Fix Readme and setup
1 parent 6a47d67 commit 5058094

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

README.rst

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
RedisBeater
2-
=======
2+
===========
33

44
.. image:: https://img.shields.io/pypi/v/celery-redisbeater.svg
55
:target: https://pypi.python.org/pypi/celery-redisbeater
@@ -23,7 +23,7 @@ that stores the scheduled tasks and runtime metadata in `Redis <http://redis.io/
2323
fork of `RedBeat <https://github.com/sibson/redbeat>`_
2424

2525
Why RedisBeater?
26-
-------------
26+
----------------
2727

2828
#. Dynamic live task creation and modification, without lengthy downtime
2929
#. Externally manage tasks from any language with Redis bindings
@@ -64,9 +64,51 @@ To disable this feature, set:
6464
6565
More details available on `Read the Docs <https://redbeat.readthedocs.io/en/latest/>`_
6666

67+
You can initialize and use RedisBeater just as use
68+
`forked project <https://github.com/sibson/redbeat>`_. You just need to replace
69+
RedBeat with RedisBeater. For instance:
70+
71+
.. code-block:: python
72+
73+
RedisBeaterSchedulerEntry(
74+
'task-name',
75+
'tasks.some_task',
76+
interval,
77+
args=['arg1', 2],
78+
).save()
79+
80+
81+
Custom Schedule
82+
---------------
83+
84+
If you want to use your custom schedule class, you must define `encode_beater`
85+
method and return fields that your class needs when initialized by
86+
`RedisBeaterScheduler` later. For instance:
87+
88+
.. code-block:: python
89+
90+
class customecrontab(BaseSchedule):
91+
def __init__(self, minute='*', hour='*', day_of_week='*',
92+
day_of_month='*', month_of_year='*', **kwargs):
93+
self.hour = hour
94+
self.minute = minute
95+
self.day_of_week = day_of_week
96+
self.day_of_month = day_of_month
97+
self.month_of_year = month_of_year
98+
super(crontab, self).__init__(**kwargs)
99+
100+
def encode_beater(self):
101+
return {
102+
'minute': self.minute,
103+
'hour': self.hour,
104+
'day_of_week': self.day_of_week,
105+
'day_of_month': self.day_of_month,
106+
'month_of_year': self.month_of_year,
107+
}
108+
67109
Development
68-
--------------
69-
RedisBeater is available on `GitHub <hhttps://github.com/saber-solooki/redisbeater>`_
110+
-----------
111+
RedisBeater is available on `GitHub <https://github.com/saber-solooki/redisbeater>`_
70112

71113
Once you have the source you can run the tests with the following commands::
72114

@@ -76,3 +118,4 @@ Once you have the source you can run the tests with the following commands::
76118
You can also quickly fire up a sample Beat instance with::
77119

78120
celery beat --config exampleconf
121+

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
name="celery-redisbeater",
77
description="A Celery Beat Scheduler using Redis for persistent storage",
88
long_description=long_description,
9-
version="1.0.0",
9+
version="1.0.1",
1010
url="https://github.com/saber-solooki/redisbeater",
1111
license="Apache License, Version 2.0",
1212
author="Saber Solooki",
@@ -29,4 +29,5 @@
2929
],
3030
install_requires=['redis>=3.2', 'celery>=4.2', 'python-dateutil', 'tenacity'],
3131
tests_require=['pytest', 'fakeredis'],
32+
long_description_content_type="text/x-rst"
3233
)

0 commit comments

Comments
 (0)