Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/celery_backend/config.py
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
@Panel.register | @Panel.register | ||||
def monotonic(state): | def monotonic(state): | ||||
"""Get the current value for the monotonic clock""" | """Get the current value for the monotonic clock""" | ||||
return {'monotonic': _monotonic()} | return {'monotonic': _monotonic()} | ||||
class TaskRouter: | class TaskRouter: | ||||
"""Route tasks according to the task_queue attribute in the task class""" | """Route tasks according to the task_queue attribute in the task class""" | ||||
def route_for_task(self, task, args=None, kwargs=None): | def route_for_task(self, task, *args, **kwargs): | ||||
task_class = app.tasks[task] | if task.startswith('swh.'): | ||||
if hasattr(task_class, 'task_queue'): | return {'queue': task} | ||||
return {'queue': task_class.task_queue} | |||||
return None | |||||
class CustomCelery(Celery): | class CustomCelery(Celery): | ||||
def get_queue_stats(self, queue_name): | def get_queue_stats(self, queue_name): | ||||
"""Get the statistics regarding a queue on the broker. | """Get the statistics regarding a queue on the broker. | ||||
Arguments: | Arguments: | ||||
queue_name: name of the queue to check | queue_name: name of the queue to check | ||||
▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines |