mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-20 20:41:01 -06:00
As had been noted on some of the commands, 'ingest' was not the best place for them. However, [project-level apps are not supported in Django](https://forum.djangoproject.com/t/allow-project-to-have-management-commands/5220/2) So just create a 'main' app. I want to qualify it as 'myproject-main' though, to avoid further unqualified global namespace pollution. And I want to avoid prefixing with 'bugsink' b/c that's annoying for tab-completion. So 'bs' it is. I've moved all commands over; even though a case could be made that the "feeding" commands (raise_exception, send_json, stress_test) are somewhat related to ingestion, that's not a very good case :-)
19 lines
416 B
Python
19 lines
416 B
Python
from django.core.management.base import BaseCommand
|
|
|
|
from snappea.models import Task
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
def add_arguments(self, parser):
|
|
parser.add_argument(
|
|
"stat",
|
|
choices=["snappea-queue-size"],
|
|
)
|
|
|
|
def handle(self, *args, **options):
|
|
stat = options["stat"]
|
|
|
|
if stat == "snappea-queue-size":
|
|
print(Task.objects.all().count())
|