celerystats.py 585 B

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