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

38 lines
1.2 KiB
Python
Raw Normal View History

import logging
from app import image_diff_queue
from data import model
2015-06-22 21:37:13 +00:00
from endpoints.v1.registry import process_image_changes
from workers.queueworker import QueueWorker
logger = logging.getLogger(__name__)
class DiffsWorker(QueueWorker):
def process_queue_item(self, job_details):
image_id = job_details['image_id']
repository = job_details['repository']
namespace = model.user.get_namespace_by_user_id(job_details['namespace_user_id'])
try:
process_image_changes(namespace, repository, image_id)
except model.DataModelException:
# This exception is unrecoverable, and the item should continue and be
# marked as complete.
msg = ('Image does not exist in database \'%s\' for repo \'%s/\'%s\'' %
(image_id, namespace, repository))
logger.warning(msg)
except IOError:
# This exception is unrecoverable, and the item should continue and be
# marked as complete.
msg = ("Data could not be retrieved for image %s under repo %s/%s" %
(image_id, namespace, repository))
logger.exception(msg)
return True
2013-10-18 21:52:55 +00:00
if __name__ == "__main__":
worker = DiffsWorker(image_diff_queue)
worker.start()