Prechádzať zdrojové kódy

New management command: celerystats (Dump and flush currently available
statistics)

Ask Solem 16 rokov pred
rodič
commit
b2d5bdd225
1 zmenil súbory, kde vykonal 20 pridanie a 0 odobranie
  1. 20 0
      celery/management/commands/celerystats.py

+ 20 - 0
celery/management/commands/celerystats.py

@@ -0,0 +1,20 @@
+"""
+
+Start the celery daemon from the Django management command.
+
+"""
+from django.core.management.base import BaseCommand
+from celery.monitoring import StatsCollector
+
+
+class Command(BaseCommand):
+    """Run the celery daemon."""
+    option_list = BaseCommand.option_list + OPTION_LIST
+    help = 'Dump and flush the currently available statistics'
+
+    def handle(self, *args, **options):
+        """Handle the management command."""
+        stats = StatsCollector()
+        print("* Gathering statistics...")
+        stats.collect()
+        stats.dump()