diff options
author | Andrew Godwin | 2022-11-13 18:42:47 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-13 18:43:09 -0700 |
commit | ddb3436275d3f02183f515c38cd3193cd1dfe2f4 (patch) | |
tree | 8902d4f085ad6d8323f43af20ca497d291e4d28a /stator/management/commands | |
parent | 68c156fd2758da5831bd83bfb1249dd014d78177 (diff) | |
download | takahe-ddb3436275d3f02183f515c38cd3193cd1dfe2f4.tar.gz takahe-ddb3436275d3f02183f515c38cd3193cd1dfe2f4.tar.bz2 takahe-ddb3436275d3f02183f515c38cd3193cd1dfe2f4.zip |
Boosting! Incoming, anyway.
Diffstat (limited to 'stator/management/commands')
-rw-r--r-- | stator/management/commands/runstator.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/stator/management/commands/runstator.py b/stator/management/commands/runstator.py index 1307fef..a77192e 100644 --- a/stator/management/commands/runstator.py +++ b/stator/management/commands/runstator.py @@ -12,9 +12,16 @@ class Command(BaseCommand): help = "Runs a Stator runner for a short period" def add_arguments(self, parser): + parser.add_argument( + "--concurrency", + "-c", + type=int, + default=30, + help="How many tasks to run at once", + ) parser.add_argument("model_labels", nargs="*", type=str) - def handle(self, model_labels: List[str], *args, **options): + def handle(self, model_labels: List[str], concurrency: int, *args, **options): # Resolve the models list into names models = cast( List[Type[StatorModel]], @@ -24,5 +31,5 @@ class Command(BaseCommand): models = StatorModel.subclasses print("Running for models: " + " ".join(m._meta.label_lower for m in models)) # Run a runner - runner = StatorRunner(models) + runner = StatorRunner(models, concurrency=concurrency) async_to_sync(runner.run)() |