Remove tasks literals
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -84,6 +84,8 @@ class Statistic(object):
|
|||||||
return [task.get_task_name() for task in cls.get_all()]
|
return [task.get_task_name() for task in cls.get_all()]
|
||||||
|
|
||||||
def __init__(self, slug, label, func, minute='*', hour='*', day_of_week='*', day_of_month='*', month_of_year='*'):
|
def __init__(self, slug, label, func, minute='*', hour='*', day_of_week='*', day_of_month='*', month_of_year='*'):
|
||||||
|
from .queues import queue_statistics, task_execute_statistic
|
||||||
|
|
||||||
self.slug = slug
|
self.slug = slug
|
||||||
self.label = label
|
self.label = label
|
||||||
self.func = func
|
self.func = func
|
||||||
@@ -96,7 +98,7 @@ class Statistic(object):
|
|||||||
app.conf.CELERYBEAT_SCHEDULE.update(
|
app.conf.CELERYBEAT_SCHEDULE.update(
|
||||||
{
|
{
|
||||||
self.get_task_name(): {
|
self.get_task_name(): {
|
||||||
'task': 'mayan_statistics.tasks.task_execute_statistic',
|
'task': task_execute_statistic.dotted_path,
|
||||||
'schedule': self.schedule,
|
'schedule': self.schedule,
|
||||||
'args': (self.slug,)
|
'args': (self.slug,)
|
||||||
},
|
},
|
||||||
@@ -106,7 +108,7 @@ class Statistic(object):
|
|||||||
app.conf.CELERY_ROUTES.update(
|
app.conf.CELERY_ROUTES.update(
|
||||||
{
|
{
|
||||||
self.get_task_name(): {
|
self.get_task_name(): {
|
||||||
'queue': 'statistics'
|
'queue': queue_statistics.name
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ queue_statistics = CeleryQueue(
|
|||||||
label=_('Statistics'), name='statistics', transient=True, worker=worker_slow
|
label=_('Statistics'), name='statistics', transient=True, worker=worker_slow
|
||||||
)
|
)
|
||||||
|
|
||||||
queue_statistics.add_task_type(
|
task_execute_statistic = queue_statistics.add_task_type(
|
||||||
label=_('Execute statistic'),
|
label=_('Execute statistic'),
|
||||||
dotted_path='mayan.apps.mayan_statistics.tasks.task_execute_statistic'
|
dotted_path='mayan.apps.mayan_statistics.tasks.task_execute_statistic'
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user