diff --git a/pillar/application/utils/gcs.py b/pillar/application/utils/gcs.py index 8825a521..d350deb2 100644 --- a/pillar/application/utils/gcs.py +++ b/pillar/application/utils/gcs.py @@ -1,12 +1,15 @@ import os import time import datetime -import bugsnag +import logging + from bson import ObjectId from gcloud.storage.client import Client from gcloud.exceptions import NotFound from flask import current_app +log = logging.getLogger(__name__) + class GoogleCloudStorageBucket(object): """Cloud Storage bucket interface. We create a bucket for every project. In @@ -176,6 +179,10 @@ def update_file_name(node): _, override_ext = os.path.splitext(v['file_path']) name = _format_name(node['name'], override_ext, v['size'], map_type=map_type) blob = storage.Get(v['file_path'], to_dict=False) + if blob is None: + log.info('Unable to find blob for file %s in project %s. This can happen if the ' + 'video encoding is still processing.', v['file_path'], node['project']) + continue storage.update_name(blob, name) # Currently we search for 'file' and 'files' keys in the object properties.