Add a tool to backfill the upload flags from the registry data.
This commit is contained in:
parent
ef9fe871fc
commit
efefc7fc03
1 changed files with 20 additions and 0 deletions
20
tools/backfilluploadingflag.py
Normal file
20
tools/backfilluploadingflag.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import logging
|
||||
|
||||
from data.database import ImageStorage
|
||||
from app import storage
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
for image_storage in ImageStorage.select(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)
|
||||
|
||||
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()
|
||||
else:
|
||||
logger.warning('Image does not exist.')
|
Reference in a new issue