celerystats.py 639 B

12345678910111213141516171819202122
  1. """
  2. Start the celery daemon from the Django management command.
  3. """
  4. from django.core.management.base import BaseCommand
  5. from celery.statistics import StatsCollector
  6. class Command(BaseCommand):
  7. """Collect/flush and dump a report from the currently available
  8. statistics."""
  9. option_list = BaseCommand.option_list
  10. help = "Collect/flush and dump a report from the currently available " + \
  11. "statistics"
  12. def handle(self, *args, **options):
  13. """Handle the management command."""
  14. stats = StatsCollector()
  15. print("* Gathering statistics...")
  16. stats.collect()
  17. stats.report()