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/namespacegcworker.py

29 lines
854 B
Python
Raw Normal View History

import logging
import time
from app import app, namespace_gc_queue, all_queues
from data import model
from workers.queueworker import QueueWorker, JobException
from util.log import logfile_path
logger = logging.getLogger(__name__)
POLL_PERIOD_SECONDS = 60
class NamespaceGCWorker(QueueWorker):
""" Worker which cleans up namespaces enqueued to be GCed.
"""
def process_queue_item(self, job_details):
logger.debug('Got namespace GC queue item: %s', job_details)
marker_id = job_details['marker_id']
model.user.delete_namespace_via_marker(marker_id, all_queues)
if __name__ == "__main__":
logging.config.fileConfig(logfile_path(debug=False), disable_existing_loggers=False)
logger.debug('Starting namespace GC worker')
worker = NamespaceGCWorker(namespace_gc_queue, poll_period_seconds=POLL_PERIOD_SECONDS)
worker.start()