parent
d6fd9a07c2
commit
ab166c4448
14 changed files with 3 additions and 413 deletions
|
@ -1,37 +0,0 @@
|
|||
import logging
|
||||
|
||||
from app import image_diff_queue
|
||||
from data import model
|
||||
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
|
||||
|
||||
if __name__ == "__main__":
|
||||
worker = DiffsWorker(image_diff_queue)
|
||||
worker.start()
|
Reference in a new issue