UnisKB/apps/system_manage/management/commands/ai_hub_cleanup_assets.py

14 lines
511 B
Python

from django.core.management.base import BaseCommand
from system_manage.ai_hub_assets import cleanup
class Command(BaseCommand):
help = 'Check expired Hub images; --apply removes only images not referenced by saved graphs/history.'
def add_arguments(self, parser):
parser.add_argument('--apply', action='store_true')
def handle(self, *args, **options):
count = cleanup(apply=options['apply'])
self.stdout.write(f'{"Removed" if options["apply"] else "Eligible"}: {count}')