1
1
RedisBeater
2
- =======
2
+ ===========
3
3
4
4
.. image :: https://img.shields.io/pypi/v/celery-redisbeater.svg
5
5
: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/
23
23
fork of `RedBeat <https://github.com/sibson/redbeat >`_
24
24
25
25
Why RedisBeater?
26
- -------------
26
+ ----------------
27
27
28
28
#. Dynamic live task creation and modification, without lengthy downtime
29
29
#. Externally manage tasks from any language with Redis bindings
@@ -64,9 +64,51 @@ To disable this feature, set:
64
64
65
65
More details available on `Read the Docs <https://redbeat.readthedocs.io/en/latest/ >`_
66
66
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
+
67
109
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 >`_
70
112
71
113
Once you have the source you can run the tests with the following commands::
72
114
@@ -76,3 +118,4 @@ Once you have the source you can run the tests with the following commands::
76
118
You can also quickly fire up a sample Beat instance with::
77
119
78
120
celery beat --config exampleconf
121
+
0 commit comments