)]}'
{"glance/api/middleware/cache.py":[{"author":{"_account_id":2537,"name":"Nikhil Komawar","email":"nik.komawar@gmail.com","username":"nikhil-komawar"},"change_message_id":"96cfaf1948792dabc0d72d2f22b4ea70f1a6e9de","unresolved":false,"context_lines":[{"line_number":342,"context_line":"    def get_from_cache(self, image_id, request):"},{"line_number":343,"context_line":"        \"\"\"Called if cache hit\"\"\""},{"line_number":344,"context_line":""},{"line_number":345,"context_line":"        def waiting_chunk_iter(fp, chunk_size\u003d65536):"},{"line_number":346,"context_line":"            \"\"\""},{"line_number":347,"context_line":"            Return an iterator yielding fixed size chunks of cached image data."},{"line_number":348,"context_line":"            If the underlying image data is still being cached, it waits for"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_d1ba8471","line":345,"updated":"2015-11-12 20:10:22.000000000","message":"I wonder if we should yield chunks of standard size, say 4kb ?","commit_id":"7ac45c587ca611466d9875b2fa8734ea6ab67734"},{"author":{"_account_id":11642,"name":"Jesse J. Cook","email":"jesse.cook@rackspace.com","username":"crashenx"},"change_message_id":"084b8d52d8e1397101675b685a014b15412ea8ed","unresolved":false,"context_lines":[{"line_number":356,"context_line":"                chunk \u003d fp.read(chunk_size)"},{"line_number":357,"context_line":"                if chunk:"},{"line_number":358,"context_line":"                    yield chunk"},{"line_number":359,"context_line":"                elif self.cache.is_being_cached(image_id):"},{"line_number":360,"context_line":"                    sleep(0.5)"},{"line_number":361,"context_line":"                else:"},{"line_number":362,"context_line":"                    LOG.debug(\"Done serving image out of cache: %s\" % image_id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba5201f7_d2e03999","line":359,"updated":"2017-01-10 16:14:01.000000000","message":"I think to prevent races, we might need to check this before read.","commit_id":"7ac45c587ca611466d9875b2fa8734ea6ab67734"},{"author":{"_account_id":2537,"name":"Nikhil Komawar","email":"nik.komawar@gmail.com","username":"nikhil-komawar"},"change_message_id":"96cfaf1948792dabc0d72d2f22b4ea70f1a6e9de","unresolved":false,"context_lines":[{"line_number":357,"context_line":"                if chunk:"},{"line_number":358,"context_line":"                    yield chunk"},{"line_number":359,"context_line":"                elif self.cache.is_being_cached(image_id):"},{"line_number":360,"context_line":"                    sleep(0.5)"},{"line_number":361,"context_line":"                else:"},{"line_number":362,"context_line":"                    LOG.debug(\"Done serving image out of cache: %s\" % image_id)"},{"line_number":363,"context_line":"                    break"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_b47fae65","line":360,"updated":"2015-11-12 20:10:22.000000000","message":"The sleep value may need change based on the chunk size.","commit_id":"7ac45c587ca611466d9875b2fa8734ea6ab67734"},{"author":{"_account_id":11642,"name":"Jesse J. Cook","email":"jesse.cook@rackspace.com","username":"crashenx"},"change_message_id":"084b8d52d8e1397101675b685a014b15412ea8ed","unresolved":false,"context_lines":[{"line_number":357,"context_line":"                if chunk:"},{"line_number":358,"context_line":"                    yield chunk"},{"line_number":359,"context_line":"                elif self.cache.is_being_cached(image_id):"},{"line_number":360,"context_line":"                    sleep(0.5)"},{"line_number":361,"context_line":"                else:"},{"line_number":362,"context_line":"                    LOG.debug(\"Done serving image out of cache: %s\" % image_id)"},{"line_number":363,"context_line":"                    break"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba5201f7_c8b96c17","line":360,"in_reply_to":"da85f559_b47fae65","updated":"2017-01-10 16:14:01.000000000","message":"I suppose you could scale it or have a backoff, but I\u0027m not sure it\u0027s warranted. I\u0027m not entirely sure a sleep is warranted at all since read should yield to eventlet. Perhaps a performance test would help in determining if anything more sophisticated is required.\n\nI do worry that we are importing from time if eventlet sleep is unavailable making this block.","commit_id":"7ac45c587ca611466d9875b2fa8734ea6ab67734"},{"author":{"_account_id":2537,"name":"Nikhil Komawar","email":"nik.komawar@gmail.com","username":"nikhil-komawar"},"change_message_id":"96cfaf1948792dabc0d72d2f22b4ea70f1a6e9de","unresolved":false,"context_lines":[{"line_number":368,"context_line":""},{"line_number":369,"context_line":"        with self.cache.open_for_read(image_id) as cache_file:"},{"line_number":370,"context_line":"            chunks \u003d waiting_chunk_iter(cache_file)"},{"line_number":371,"context_line":"            for chunk in chunks:"},{"line_number":372,"context_line":"                yield chunk"},{"line_number":373,"context_line":""},{"line_number":374,"context_line":"        if caching_image and not self.cache.is_cached(image_id):"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_d780344c","line":371,"updated":"2015-11-12 20:10:22.000000000","message":"hmm, I wonder why we need to pass the iterator to create another iterator? \n\nShouldn\u0027t this suffice ? :\n\n    return waiting_chunk_iter(cache_file)\n\nas a generator is already being passed from that method.","commit_id":"7ac45c587ca611466d9875b2fa8734ea6ab67734"},{"author":{"_account_id":11642,"name":"Jesse J. Cook","email":"jesse.cook@rackspace.com","username":"crashenx"},"change_message_id":"084b8d52d8e1397101675b685a014b15412ea8ed","unresolved":false,"context_lines":[{"line_number":368,"context_line":""},{"line_number":369,"context_line":"        with self.cache.open_for_read(image_id) as cache_file:"},{"line_number":370,"context_line":"            chunks \u003d waiting_chunk_iter(cache_file)"},{"line_number":371,"context_line":"            for chunk in chunks:"},{"line_number":372,"context_line":"                yield chunk"},{"line_number":373,"context_line":""},{"line_number":374,"context_line":"        if caching_image and not self.cache.is_cached(image_id):"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba5201f7_85210dff","line":371,"in_reply_to":"da85f559_d780344c","updated":"2017-01-10 16:14:01.000000000","message":"If we return here, we cannot check below. Seems like a reasonable approach and follows the pattern that exists before the change.","commit_id":"7ac45c587ca611466d9875b2fa8734ea6ab67734"},{"author":{"_account_id":2537,"name":"Nikhil Komawar","email":"nik.komawar@gmail.com","username":"nikhil-komawar"},"change_message_id":"96cfaf1948792dabc0d72d2f22b4ea70f1a6e9de","unresolved":false,"context_lines":[{"line_number":374,"context_line":"        if caching_image and not self.cache.is_cached(image_id):"},{"line_number":375,"context_line":"            msg \u003d _(\"Image download failed due to unknown reasons. \""},{"line_number":376,"context_line":"                    \"Please re-try!\")"},{"line_number":377,"context_line":"            LOG.debug(\"Caching image %s failed to cache successfully\""},{"line_number":378,"context_line":"                      % image_id)"},{"line_number":379,"context_line":"            raise webob.exc.HTTPInternalServerError(explanation\u003dmsg,"},{"line_number":380,"context_line":"                                                    request\u003drequest)"}],"source_content_type":"text/x-python","patch_set":1,"id":"da85f559_d4cef2b6","line":377,"updated":"2015-11-12 20:10:22.000000000","message":"remove successfully as it may lead to confusion. the sentence makes sense even without it.","commit_id":"7ac45c587ca611466d9875b2fa8734ea6ab67734"},{"author":{"_account_id":11642,"name":"Jesse J. Cook","email":"jesse.cook@rackspace.com","username":"crashenx"},"change_message_id":"084b8d52d8e1397101675b685a014b15412ea8ed","unresolved":false,"context_lines":[{"line_number":374,"context_line":"        if caching_image and not self.cache.is_cached(image_id):"},{"line_number":375,"context_line":"            msg \u003d _(\"Image download failed due to unknown reasons. \""},{"line_number":376,"context_line":"                    \"Please re-try!\")"},{"line_number":377,"context_line":"            LOG.debug(\"Caching image %s failed to cache successfully\""},{"line_number":378,"context_line":"                      % image_id)"},{"line_number":379,"context_line":"            raise webob.exc.HTTPInternalServerError(explanation\u003dmsg,"},{"line_number":380,"context_line":"                                                    request\u003drequest)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba5201f7_a577f100","line":377,"in_reply_to":"da85f559_d4cef2b6","updated":"2017-01-10 16:14:01.000000000","message":"++","commit_id":"7ac45c587ca611466d9875b2fa8734ea6ab67734"}],"glance/image_cache/__init__.py":[{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"d7adff4c2a9ee4016778c309116d3087ed4243ed","unresolved":false,"context_lines":[{"line_number":349,"context_line":"        :param image_iter: Iterator that will read image contents"},{"line_number":350,"context_line":"        :raises: GlanceException if entire image cannot be retrieved"},{"line_number":351,"context_line":"        \"\"\""},{"line_number":352,"context_line":"        caching \u003d self.cache.is_being_cached(image_id)"},{"line_number":353,"context_line":"        cached \u003d self.cache.is_cached(image_id)"},{"line_number":354,"context_line":"        if caching:"},{"line_number":355,"context_line":"            LOG.debug(\"Image \u0027%s\u0027 is actively caching. Serving image \""}],"source_content_type":"text/x-python","patch_set":3,"id":"5a3905b3_2516d955","line":352,"range":{"start_line":352,"start_character":18,"end_line":352,"end_character":28},"updated":"2017-01-25 00:09:38.000000000","message":"\"self.driver\" here and all other references.","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"d7adff4c2a9ee4016778c309116d3087ed4243ed","unresolved":false,"context_lines":[{"line_number":360,"context_line":"            LOG.debug(\"Serving image \u0027%s\u0027 from cache.\", image_id)"},{"line_number":361,"context_line":"            for chunk in self._from_cache_iter(image_id):"},{"line_number":362,"context_line":"                yield chunk"},{"line_number":363,"context_line":"        elif image_iter and image_checksum:"},{"line_number":364,"context_line":"            LOG.debug(\"Tee\u0027ing image \u0027%s\u0027 into cache.\", image_id)"},{"line_number":365,"context_line":"            for chunk in self._cache_tee_iter(image_id, image_iter,"},{"line_number":366,"context_line":"                                              image_checksum):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a3905b3_80b85b2c","line":363,"range":{"start_line":363,"start_character":8,"end_line":363,"end_character":43},"updated":"2017-01-25 00:09:38.000000000","message":"I think we need to make sure that the image is cacheable first by calling drivers.is_cacheable before calling _cache_tee_iter","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"},{"author":{"_account_id":11642,"name":"Jesse J. Cook","email":"jesse.cook@rackspace.com","username":"crashenx"},"change_message_id":"083cc4bf15fd0ebaa905681b98f5f7a3f02d4300","unresolved":false,"context_lines":[{"line_number":360,"context_line":"            LOG.debug(\"Serving image \u0027%s\u0027 from cache.\", image_id)"},{"line_number":361,"context_line":"            for chunk in self._from_cache_iter(image_id):"},{"line_number":362,"context_line":"                yield chunk"},{"line_number":363,"context_line":"        elif image_iter and image_checksum:"},{"line_number":364,"context_line":"            LOG.debug(\"Tee\u0027ing image \u0027%s\u0027 into cache.\", image_id)"},{"line_number":365,"context_line":"            for chunk in self._cache_tee_iter(image_id, image_iter,"},{"line_number":366,"context_line":"                                              image_checksum):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_c99ff6b2","line":363,"range":{"start_line":363,"start_character":8,"end_line":363,"end_character":43},"in_reply_to":"5a3905b3_80b85b2c","updated":"2017-01-25 16:24:45.000000000","message":"As currently implemented, this elif is the same as checking is_cacheable since it\u0027s implemented as not cached or caching. However, that is leaking an abstraction, and you\u0027re right, we should probably check that here.","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"d7adff4c2a9ee4016778c309116d3087ed4243ed","unresolved":false,"context_lines":[{"line_number":362,"context_line":"                yield chunk"},{"line_number":363,"context_line":"        elif image_iter and image_checksum:"},{"line_number":364,"context_line":"            LOG.debug(\"Tee\u0027ing image \u0027%s\u0027 into cache.\", image_id)"},{"line_number":365,"context_line":"            for chunk in self._cache_tee_iter(image_id, image_iter,"},{"line_number":366,"context_line":"                                              image_checksum):"},{"line_number":367,"context_line":"                yield chunk"},{"line_number":368,"context_line":"        else:"},{"line_number":369,"context_line":"            msg \u003d _(\"Image \u0027%s\u0027 not available in cache and no image \""}],"source_content_type":"text/x-python","patch_set":3,"id":"5a3905b3_017d4ce7","line":366,"range":{"start_line":365,"start_character":12,"end_line":366,"end_character":62},"updated":"2017-01-25 00:09:38.000000000","message":"Why are we iterating through here? Isnt _cache_tee_iter yielding chunks?","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"},{"author":{"_account_id":11642,"name":"Jesse J. Cook","email":"jesse.cook@rackspace.com","username":"crashenx"},"change_message_id":"083cc4bf15fd0ebaa905681b98f5f7a3f02d4300","unresolved":false,"context_lines":[{"line_number":362,"context_line":"                yield chunk"},{"line_number":363,"context_line":"        elif image_iter and image_checksum:"},{"line_number":364,"context_line":"            LOG.debug(\"Tee\u0027ing image \u0027%s\u0027 into cache.\", image_id)"},{"line_number":365,"context_line":"            for chunk in self._cache_tee_iter(image_id, image_iter,"},{"line_number":366,"context_line":"                                              image_checksum):"},{"line_number":367,"context_line":"                yield chunk"},{"line_number":368,"context_line":"        else:"},{"line_number":369,"context_line":"            msg \u003d _(\"Image \u0027%s\u0027 not available in cache and no image \""}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_89008eac","line":366,"range":{"start_line":365,"start_character":12,"end_line":366,"end_character":62},"in_reply_to":"5a3905b3_017d4ce7","updated":"2017-01-25 16:24:45.000000000","message":"yeah, I think we can just: return self._cache_tee_iter(image_id, image_iter, image_checksum)","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"d7adff4c2a9ee4016778c309116d3087ed4243ed","unresolved":false,"context_lines":[{"line_number":371,"context_line":"            LOG.debug(msg)"},{"line_number":372,"context_line":"            raise exception.GlanceException(msg)"},{"line_number":373,"context_line":""},{"line_number":374,"context_line":"    def _from_cache_iter(self, image_id, chunk_size\u003d65536):"},{"line_number":375,"context_line":"        with self.cache.open_for_read(image_id) as fp:"},{"line_number":376,"context_line":"            while True:"},{"line_number":377,"context_line":"                chunk \u003d fp.read(chunk_size)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a3905b3_60ac4f36","line":374,"updated":"2017-01-25 00:09:38.000000000","message":"I think we need to perform len(chunk) or something similar to decide when to break out from serving from the cache.","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"},{"author":{"_account_id":11642,"name":"Jesse J. Cook","email":"jesse.cook@rackspace.com","username":"crashenx"},"change_message_id":"083cc4bf15fd0ebaa905681b98f5f7a3f02d4300","unresolved":false,"context_lines":[{"line_number":371,"context_line":"            LOG.debug(msg)"},{"line_number":372,"context_line":"            raise exception.GlanceException(msg)"},{"line_number":373,"context_line":""},{"line_number":374,"context_line":"    def _from_cache_iter(self, image_id, chunk_size\u003d65536):"},{"line_number":375,"context_line":"        with self.cache.open_for_read(image_id) as fp:"},{"line_number":376,"context_line":"            while True:"},{"line_number":377,"context_line":"                chunk \u003d fp.read(chunk_size)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_a9b9caee","line":374,"in_reply_to":"5a3905b3_60ac4f36","updated":"2017-01-25 16:24:45.000000000","message":"You mean when the chunk is 0 length?","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"d7adff4c2a9ee4016778c309116d3087ed4243ed","unresolved":false,"context_lines":[{"line_number":374,"context_line":"    def _from_cache_iter(self, image_id, chunk_size\u003d65536):"},{"line_number":375,"context_line":"        with self.cache.open_for_read(image_id) as fp:"},{"line_number":376,"context_line":"            while True:"},{"line_number":377,"context_line":"                chunk \u003d fp.read(chunk_size)"},{"line_number":378,"context_line":"                if chunk:"},{"line_number":379,"context_line":"                    yield chunk"},{"line_number":380,"context_line":"                elif self.cache.is_being_cached(image_id):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a3905b3_a01c77c2","line":377,"range":{"start_line":377,"start_character":16,"end_line":377,"end_character":43},"updated":"2017-01-25 00:09:38.000000000","message":"What if there is a read error? Maybe handle it and allow retries? Cos, control might go to L382 and break out.","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"},{"author":{"_account_id":11642,"name":"Jesse J. Cook","email":"jesse.cook@rackspace.com","username":"crashenx"},"change_message_id":"083cc4bf15fd0ebaa905681b98f5f7a3f02d4300","unresolved":false,"context_lines":[{"line_number":374,"context_line":"    def _from_cache_iter(self, image_id, chunk_size\u003d65536):"},{"line_number":375,"context_line":"        with self.cache.open_for_read(image_id) as fp:"},{"line_number":376,"context_line":"            while True:"},{"line_number":377,"context_line":"                chunk \u003d fp.read(chunk_size)"},{"line_number":378,"context_line":"                if chunk:"},{"line_number":379,"context_line":"                    yield chunk"},{"line_number":380,"context_line":"                elif self.cache.is_being_cached(image_id):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a461143_a911cab1","line":377,"range":{"start_line":377,"start_character":16,"end_line":377,"end_character":43},"in_reply_to":"5a3905b3_a01c77c2","updated":"2017-01-25 16:24:45.000000000","message":"Yeah, there should probably be a try block here to catch exceptions that might be raised by this call and handle them appropriately. I\u0027m not sure what level if any retries should be made. I\u0027ll have to think about that.","commit_id":"a8251779ed32cab84c7bcf9f638f7395d77d18c0"}]}
