feat(demo): add isolated demo environments
This commit is contained in:
1
apps/demos/management/__init__.py
Normal file
1
apps/demos/management/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
apps/demos/management/commands/__init__.py
Normal file
1
apps/demos/management/commands/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
18
apps/demos/management/commands/cleanup_demo_environments.py
Normal file
18
apps/demos/management/commands/cleanup_demo_environments.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from apps.demos.services import cleanup_expired_demo_environments
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Clean up expired isolated demo environments."
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument("--expired", action="store_true", help="Clean expired demo environments.")
|
||||
parser.add_argument("--batch-size", type=int, default=None, help="Maximum number of environments to clean.")
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if not options["expired"]:
|
||||
self.stderr.write("Only --expired cleanup is supported.")
|
||||
return
|
||||
cleaned = cleanup_expired_demo_environments(batch_size=options["batch_size"])
|
||||
self.stdout.write(self.style.SUCCESS(f"Cleaned {cleaned} expired demo environment(s)."))
|
||||
Reference in New Issue
Block a user