summaryrefslogtreecommitdiffstats
path: root/stator/management/commands
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-19 10:20:13 -0700
committerAndrew Godwin2022-11-19 10:20:13 -0700
commit2142677b015507bc1aeb6179c5dfc4dfa3aaf0ce (patch)
treedaac448f073c16a3e48157f2897ee6eff2a4d4d7 /stator/management/commands
parent80193114909a3f6ca1eda9a47b6330ef249a8ee5 (diff)
downloadtakahe-2142677b015507bc1aeb6179c5dfc4dfa3aaf0ce.tar.gz
takahe-2142677b015507bc1aeb6179c5dfc4dfa3aaf0ce.tar.bz2
takahe-2142677b015507bc1aeb6179c5dfc4dfa3aaf0ce.zip
A few more tweaks for an initial deploy
Diffstat (limited to 'stator/management/commands')
-rw-r--r--stator/management/commands/runstator.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/stator/management/commands/runstator.py b/stator/management/commands/runstator.py
index eaa2585..3030960 100644
--- a/stator/management/commands/runstator.py
+++ b/stator/management/commands/runstator.py
@@ -10,7 +10,7 @@ from stator.runner import StatorRunner
class Command(BaseCommand):
- help = "Runs a Stator runner for a short period"
+ help = "Runs a Stator runner"
def add_arguments(self, parser):
parser.add_argument(
@@ -20,9 +20,30 @@ class Command(BaseCommand):
default=30,
help="How many tasks to run at once",
)
+ parser.add_argument(
+ "--liveness-file",
+ type=str,
+ default=None,
+ help="A file to touch at least every 30 seconds to say the runner is alive",
+ )
+ parser.add_argument(
+ "--schedule-interval",
+ "-s",
+ type=int,
+ default=30,
+ help="How often to run cleaning and scheduling",
+ )
parser.add_argument("model_labels", nargs="*", type=str)
- def handle(self, model_labels: List[str], concurrency: int, *args, **options):
+ def handle(
+ self,
+ model_labels: List[str],
+ concurrency: int,
+ liveness_file: str,
+ schedule_interval: int,
+ *args,
+ **options
+ ):
# Cache system config
Config.system = Config.load_system()
# Resolve the models list into names
@@ -34,5 +55,10 @@ 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, concurrency=concurrency)
+ runner = StatorRunner(
+ models,
+ concurrency=concurrency,
+ liveness_file=liveness_file,
+ schedule_interval=schedule_interval,
+ )
async_to_sync(runner.run)()