From c9371fd01cb396f409698465fec65353c69bb76f Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Fri, 2 May 2014 17:49:36 -0400 Subject: [PATCH] Fix the script to backfill uploading flags. --- tools/backfilluploadingflag.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/backfilluploadingflag.py b/tools/backfilluploadingflag.py index 6d5ce4a37..1d8a8a412 100644 --- a/tools/backfilluploadingflag.py +++ b/tools/backfilluploadingflag.py @@ -1,20 +1,23 @@ import logging +logging.basicConfig(level=logging.DEBUG) +logger = logging.getLogger(__name__) +logging.getLogger('boto').setLevel(logging.CRITICAL) + from data.database import ImageStorage from app import storage -logging.basicConfig(level=logging.DEBUG) -logger = logging.getLogger(__name__) +logger.info('Total image storages: %s', ImageStorage.select().count()) -for image_storage in ImageStorage.select(ImageStorage.uploading == None).limit(1000): +for image_storage in ImageStorage.select().where(ImageStorage.uploading == None).limit(1000): mark_path = storage.image_mark_path(None, None, None, image_storage.uuid) json_path = storage.image_json_path(None, None, None, image_storage.uuid) - logger.debug('Mark path: %s Json path: %s', mark_path, json_path) + logger.info('Mark path: %s Json path: %s', mark_path, json_path) if storage.exists(json_path): image_storage.uploading = storage.exists(mark_path) - logger.debug('Image existed and was currently uploading: %s', image_storage.uploading) - # image_storage.save() + logger.info('Image existed and was currently uploading: %s', image_storage.uploading) + image_storage.save() else: logger.warning('Image does not exist.')