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

24 lines
722 B
Python
Raw Normal View History

2017-06-28 12:13:11 +00:00
import logging
2017-06-29 06:40:39 +00:00
from data.model.repository import (
find_repository_with_garbage, garbage_collect_repo, get_random_gc_policy)
2017-06-28 12:13:11 +00:00
2017-06-29 06:37:32 +00:00
from workers.gc.models_interface import GCWorkerDataInterface
2017-06-28 12:13:11 +00:00
logger = logging.getLogger(__name__)
2017-06-29 06:40:39 +00:00
2017-06-28 12:13:11 +00:00
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)
2017-06-29 06:40:39 +00:00
2017-06-28 12:13:11 +00:00
pre_oci_model = PreOCIModel()