This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/workers/gc/models_pre_oci.py
2017-06-29 09:40:39 +03:00

23 lines
722 B
Python

import logging
from data.model.repository import (
find_repository_with_garbage, garbage_collect_repo, get_random_gc_policy)
from workers.gc.models_interface import GCWorkerDataInterface
logger = logging.getLogger(__name__)
class PreOCIModel(GCWorkerDataInterface):
def perform_garbage_collection(self):
repository = find_repository_with_garbage(get_random_gc_policy())
if repository is None:
logger.debug('No repository with garbage found')
return
logger.debug('Starting GC of repository #%s (%s)', repository.id, repository.name)
garbage_collect_repo(repository)
logger.debug('Finished GC of repository #%s (%s)', repository.id, repository.name)
pre_oci_model = PreOCIModel()