)]}'
{"glance/api/v1/images.py":[{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"a4424f69142c254822945bf38c3cb3c2af2e8a5c","unresolved":false,"context_lines":[{"line_number":151,"context_line":"        global _THREAD_POOL"},{"line_number":152,"context_line":"        if _THREAD_POOL is None:"},{"line_number":153,"context_line":"            _THREAD_POOL \u003d \\"},{"line_number":154,"context_line":"                wsgi.get_asynchronus_eventlet_pool(size\u003d1024)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def _enforce(self, req, action, target\u003dNone):"},{"line_number":157,"context_line":"        \"\"\"Authorize an action against our policies\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_7b597d59","line":154,"updated":"2015-02-03 16:52:27.000000000","message":"Nit: asynchronous (this probably needs to be fixed elsewhere first though)","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"8e7c04b4f5fffd3699f7a2e3b57c410b43f2bbc6","unresolved":false,"context_lines":[{"line_number":151,"context_line":"        global _THREAD_POOL"},{"line_number":152,"context_line":"        if _THREAD_POOL is None:"},{"line_number":153,"context_line":"            _THREAD_POOL \u003d \\"},{"line_number":154,"context_line":"                wsgi.get_asynchronus_eventlet_pool(size\u003d1024)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def _enforce(self, req, action, target\u003dNone):"},{"line_number":157,"context_line":"        \"\"\"Authorize an action against our policies\"\"\""}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_96aebb7f","line":154,"in_reply_to":"da86d52c_7b597d59","updated":"2015-02-05 07:57:07.000000000","message":"Done","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"a4424f69142c254822945bf38c3cb3c2af2e8a5c","unresolved":false,"context_lines":[{"line_number":741,"context_line":"                                                             image_meta)"},{"line_number":742,"context_line":"            image_meta \u003d self._upload_and_activate(req, image_meta)"},{"line_number":743,"context_line":"        elif copy_from:"},{"line_number":744,"context_line":"            if _THREAD_POOL is None:"},{"line_number":745,"context_line":"                self._set_gobal_threadpool_if_none()"},{"line_number":746,"context_line":""},{"line_number":747,"context_line":"            msg \u003d _LI(\u0027Triggering asynchronous copy from external source\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_dbf2696e","line":744,"updated":"2015-02-03 16:52:27.000000000","message":"Given the usage here, I\u0027d rather see the above be a function to retrieve the threadpool, something like,\n\n    def _get_threadpool(self):\n        global _THREAD_POOL\n        if _THREAD_POOL is None:\n            _THREAD_POOL \u003d wsg.get_asyncrhonus_eventlet_pool(\n                size\u003d1024)\n        return _THREAD_POOL\n\nThen down here instead of checking the global variable implicitly, you just do:\n\n    pool \u003d self._get_threadpool():\n    pool.spawn_n(...)\n\nFurther, I don\u0027t think _get_threadpool should be a method on this class. It should be a private function of the module. We\u0027re not maintaining the pool on the instance any longer so there\u0027s no need for this to be a method.","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"8e7c04b4f5fffd3699f7a2e3b57c410b43f2bbc6","unresolved":false,"context_lines":[{"line_number":741,"context_line":"                                                             image_meta)"},{"line_number":742,"context_line":"            image_meta \u003d self._upload_and_activate(req, image_meta)"},{"line_number":743,"context_line":"        elif copy_from:"},{"line_number":744,"context_line":"            if _THREAD_POOL is None:"},{"line_number":745,"context_line":"                self._set_gobal_threadpool_if_none()"},{"line_number":746,"context_line":""},{"line_number":747,"context_line":"            msg \u003d _LI(\u0027Triggering asynchronous copy from external source\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_76bdc7b6","line":744,"in_reply_to":"da86d52c_dbf2696e","updated":"2015-02-05 07:57:07.000000000","message":"Done","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"}],"glance/async/eventlet_executor.py":[{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"a4424f69142c254822945bf38c3cb3c2af2e8a5c","unresolved":false,"context_lines":[{"line_number":41,"context_line":"            self._set_gobal_threadpool_if_none()"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    @lockutils.synchronized(\"tasks_eventlet_pool\")"},{"line_number":44,"context_line":"    def _set_gobal_threadpool_if_none(self):"},{"line_number":45,"context_line":"        global _THREAD_POOL"},{"line_number":46,"context_line":"        if _THREAD_POOL is None:"},{"line_number":47,"context_line":"            _THREAD_POOL \u003d \\"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_5e3667e8","line":44,"updated":"2015-02-03 16:52:27.000000000","message":"Again, this should be a private module-level function. I don\u0027t understand the need for this to be a method.","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"8e7c04b4f5fffd3699f7a2e3b57c410b43f2bbc6","unresolved":false,"context_lines":[{"line_number":41,"context_line":"            self._set_gobal_threadpool_if_none()"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    @lockutils.synchronized(\"tasks_eventlet_pool\")"},{"line_number":44,"context_line":"    def _set_gobal_threadpool_if_none(self):"},{"line_number":45,"context_line":"        global _THREAD_POOL"},{"line_number":46,"context_line":"        if _THREAD_POOL is None:"},{"line_number":47,"context_line":"            _THREAD_POOL \u003d \\"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_f6c8d756","line":44,"in_reply_to":"da86d52c_5e3667e8","updated":"2015-02-05 07:57:07.000000000","message":"Done","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"26841cf71943ac60106c25a270cbb691d195aab6","unresolved":false,"context_lines":[{"line_number":34,"context_line":""},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"@lockutils.synchronized(\"tasks_eventlet_pool\")"},{"line_number":37,"context_line":"def _get_thread_pool():"},{"line_number":38,"context_line":"    \"\"\"Initializes eventlet thread pool.\"\"\""},{"line_number":39,"context_line":"    global _THREAD_POOL"},{"line_number":40,"context_line":"    if _THREAD_POOL is None:"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_7a565307","line":37,"updated":"2015-02-06 12:08:54.000000000","message":"I think this function and the one defined in v1.images could be unified in a function that accepts a lockname and the same lockname could be used to cache the result of the call. A simple memoizer should be enough.","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"cee60c591b95d03b699c9b2d666550321f5646a1","unresolved":false,"context_lines":[{"line_number":34,"context_line":""},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"@lockutils.synchronized(\"tasks_eventlet_pool\")"},{"line_number":37,"context_line":"def _get_thread_pool():"},{"line_number":38,"context_line":"    \"\"\"Initializes eventlet thread pool.\"\"\""},{"line_number":39,"context_line":"    global _THREAD_POOL"},{"line_number":40,"context_line":"    if _THREAD_POOL is None:"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_27ea69ac","line":37,"in_reply_to":"da86d52c_7a565307","updated":"2015-02-11 05:51:07.000000000","message":"Done","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"}],"glance/common/exception.py":[{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"a4424f69142c254822945bf38c3cb3c2af2e8a5c","unresolved":false,"context_lines":[{"line_number":317,"context_line":""},{"line_number":318,"context_line":""},{"line_number":319,"context_line":"class SighupInterrupt(GlanceException):"},{"line_number":320,"context_line":"    message \u003d _(\"Sighup received\")"},{"line_number":321,"context_line":""},{"line_number":322,"context_line":""},{"line_number":323,"context_line":"class RPCError(GlanceException):"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_7ebfabfb","line":320,"updated":"2015-02-03 16:52:27.000000000","message":"The class /could/ be named SIGHUPInterrupt (since we already have RPCError) but I don\u0027t feel strongly about that. I think the message should have \"SIGHUP\" in all caps though since the signal name is all caps. We should also mention that this is a system signal so no one thinks we\u0027re overriding terms here. Something like:\n\n    System SIGHUP signal received","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"8e7c04b4f5fffd3699f7a2e3b57c410b43f2bbc6","unresolved":false,"context_lines":[{"line_number":317,"context_line":""},{"line_number":318,"context_line":""},{"line_number":319,"context_line":"class SighupInterrupt(GlanceException):"},{"line_number":320,"context_line":"    message \u003d _(\"Sighup received\")"},{"line_number":321,"context_line":""},{"line_number":322,"context_line":""},{"line_number":323,"context_line":"class RPCError(GlanceException):"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_16c2cb33","line":320,"in_reply_to":"da86d52c_7ebfabfb","updated":"2015-02-05 07:57:07.000000000","message":"Done","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"}],"glance/common/wsgi.py":[{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"a4424f69142c254822945bf38c3cb3c2af2e8a5c","unresolved":false,"context_lines":[{"line_number":230,"context_line":"    \"\"\""},{"line_number":231,"context_line":"    global ASYNC_EVENTLET_THREAD_POOL_LIST"},{"line_number":232,"context_line":"    if not ASYNC_EVENTLET_THREAD_POOL_LIST:"},{"line_number":233,"context_line":"        ASYNC_EVENTLET_THREAD_POOL_LIST \u003d []"},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"    pool \u003d eventlet.GreenPool(size\u003dsize)"},{"line_number":236,"context_line":"    # Add pool to global ASYNC_EVENTLET_THREAD_POOL_LIST"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_84f32e9d","line":233,"updated":"2015-02-03 16:52:27.000000000","message":"Do we need this to be thread safe or will lockutils take care of that for us?","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"8e7c04b4f5fffd3699f7a2e3b57c410b43f2bbc6","unresolved":false,"context_lines":[{"line_number":230,"context_line":"    \"\"\""},{"line_number":231,"context_line":"    global ASYNC_EVENTLET_THREAD_POOL_LIST"},{"line_number":232,"context_line":"    if not ASYNC_EVENTLET_THREAD_POOL_LIST:"},{"line_number":233,"context_line":"        ASYNC_EVENTLET_THREAD_POOL_LIST \u003d []"},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"    pool \u003d eventlet.GreenPool(size\u003dsize)"},{"line_number":236,"context_line":"    # Add pool to global ASYNC_EVENTLET_THREAD_POOL_LIST"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_76e4e7e0","line":233,"in_reply_to":"da86d52c_84f32e9d","updated":"2015-02-05 07:57:07.000000000","message":"Hi Ian,\n\nlockutils take care of this.","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"26841cf71943ac60106c25a270cbb691d195aab6","unresolved":false,"context_lines":[{"line_number":219,"context_line":"    glance_store.verify_default_store()"},{"line_number":220,"context_line":""},{"line_number":221,"context_line":""},{"line_number":222,"context_line":"@lockutils.synchronized(\"get_async_eventlet_pool\")"},{"line_number":223,"context_line":"def get_asynchronous_eventlet_pool(size\u003d1000):"},{"line_number":224,"context_line":"    \"\"\"Return eventlet pool to caller."},{"line_number":225,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_fa3243f0","line":222,"updated":"2015-02-06 12:08:54.000000000","message":"Why does this function need locking? Is it because of the ASYNC_EVENTLET_THREAD_POOL_LIST initialization? If so, I think we can remove it and just initialize the global var right away.","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"cee60c591b95d03b699c9b2d666550321f5646a1","unresolved":false,"context_lines":[{"line_number":219,"context_line":"    glance_store.verify_default_store()"},{"line_number":220,"context_line":""},{"line_number":221,"context_line":""},{"line_number":222,"context_line":"@lockutils.synchronized(\"get_async_eventlet_pool\")"},{"line_number":223,"context_line":"def get_asynchronous_eventlet_pool(size\u003d1000):"},{"line_number":224,"context_line":"    \"\"\"Return eventlet pool to caller."},{"line_number":225,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_a7d579e6","line":222,"in_reply_to":"da86d52c_fa3243f0","updated":"2015-02-11 05:51:07.000000000","message":"Done","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"26841cf71943ac60106c25a270cbb691d195aab6","unresolved":false,"context_lines":[{"line_number":230,"context_line":"    :returns: eventlet pool"},{"line_number":231,"context_line":"    \"\"\""},{"line_number":232,"context_line":"    global ASYNC_EVENTLET_THREAD_POOL_LIST"},{"line_number":233,"context_line":"    if not ASYNC_EVENTLET_THREAD_POOL_LIST:"},{"line_number":234,"context_line":"        ASYNC_EVENTLET_THREAD_POOL_LIST \u003d []"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":"    pool \u003d eventlet.GreenPool(size\u003dsize)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_1a2e378c","line":233,"updated":"2015-02-06 12:08:54.000000000","message":"I think we can initialize the global variable to [] directly. That way we can remove this if.","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"cee60c591b95d03b699c9b2d666550321f5646a1","unresolved":false,"context_lines":[{"line_number":230,"context_line":"    :returns: eventlet pool"},{"line_number":231,"context_line":"    \"\"\""},{"line_number":232,"context_line":"    global ASYNC_EVENTLET_THREAD_POOL_LIST"},{"line_number":233,"context_line":"    if not ASYNC_EVENTLET_THREAD_POOL_LIST:"},{"line_number":234,"context_line":"        ASYNC_EVENTLET_THREAD_POOL_LIST \u003d []"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":"    pool \u003d eventlet.GreenPool(size\u003dsize)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_e70a1189","line":233,"in_reply_to":"da86d52c_1a2e378c","updated":"2015-02-11 05:51:07.000000000","message":"Done","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"26841cf71943ac60106c25a270cbb691d195aab6","unresolved":false,"context_lines":[{"line_number":247,"context_line":"    glance store needs to be initialized."},{"line_number":248,"context_line":"    \"\"\""},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    def __init__(self, threads\u003d1000, initialize_glance_store\u003dFalse):"},{"line_number":251,"context_line":"        eventlet.wsgi.MAX_HEADER_LINE \u003d CONF.max_header_line"},{"line_number":252,"context_line":"        self.threads \u003d threads"},{"line_number":253,"context_line":"        self.children \u003d []"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_3a505b0a","line":250,"updated":"2015-02-06 12:08:54.000000000","message":"What happens if glance_store\u0027s initialization is called multiple times? As of now, glance_store\u0027s stores are singletons and they would need to be re-init if the configs change.","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"291913c6b5a519ffd2397aeda19561fcf3b34a77","unresolved":false,"context_lines":[{"line_number":247,"context_line":"    glance store needs to be initialized."},{"line_number":248,"context_line":"    \"\"\""},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    def __init__(self, threads\u003d1000, initialize_glance_store\u003dFalse):"},{"line_number":251,"context_line":"        eventlet.wsgi.MAX_HEADER_LINE \u003d CONF.max_header_line"},{"line_number":252,"context_line":"        self.threads \u003d threads"},{"line_number":253,"context_line":"        self.children \u003d []"}],"source_content_type":"text/x-python","patch_set":10,"id":"9a80dd14_d419667a","line":250,"in_reply_to":"9a80dd14_71d28c01","updated":"2015-03-05 20:05:14.000000000","message":"Done","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"737b4426c6214bc3123fab737bd697bfecfd00a7","unresolved":false,"context_lines":[{"line_number":247,"context_line":"    glance store needs to be initialized."},{"line_number":248,"context_line":"    \"\"\""},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    def __init__(self, threads\u003d1000, initialize_glance_store\u003dFalse):"},{"line_number":251,"context_line":"        eventlet.wsgi.MAX_HEADER_LINE \u003d CONF.max_header_line"},{"line_number":252,"context_line":"        self.threads \u003d threads"},{"line_number":253,"context_line":"        self.children \u003d []"}],"source_content_type":"text/x-python","patch_set":10,"id":"ba7be1f8_f2b74a84","line":250,"in_reply_to":"ba7be1f8_24c73d47","updated":"2015-02-24 06:15:14.000000000","message":"Hi Flavio,\n\nGlance registry service doesn\u0027t need glance_store to be initialized, glance_store is required for API service. In order to re-initialize glance_store only for API on SIGHUP, I have added this extra keyword here.","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"e77e488e25d58519084d65a4806750121e0f1672","unresolved":false,"context_lines":[{"line_number":247,"context_line":"    glance store needs to be initialized."},{"line_number":248,"context_line":"    \"\"\""},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    def __init__(self, threads\u003d1000, initialize_glance_store\u003dFalse):"},{"line_number":251,"context_line":"        eventlet.wsgi.MAX_HEADER_LINE \u003d CONF.max_header_line"},{"line_number":252,"context_line":"        self.threads \u003d threads"},{"line_number":253,"context_line":"        self.children \u003d []"}],"source_content_type":"text/x-python","patch_set":10,"id":"9a80dd14_71d28c01","line":250,"in_reply_to":"ba7be1f8_f2b74a84","updated":"2015-03-05 19:43:32.000000000","message":"This seems reasonable. Would you object adding a note to that effect Abhishek, e.g.,\n\n\n    # NOTE(abhishek): Allows us to only re-initialize glance_store when the API\u0027s configuration reloads\n\nOr something like that","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"cee60c591b95d03b699c9b2d666550321f5646a1","unresolved":false,"context_lines":[{"line_number":247,"context_line":"    glance store needs to be initialized."},{"line_number":248,"context_line":"    \"\"\""},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    def __init__(self, threads\u003d1000, initialize_glance_store\u003dFalse):"},{"line_number":251,"context_line":"        eventlet.wsgi.MAX_HEADER_LINE \u003d CONF.max_header_line"},{"line_number":252,"context_line":"        self.threads \u003d threads"},{"line_number":253,"context_line":"        self.children \u003d []"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_47f91d7f","line":250,"in_reply_to":"da86d52c_3a505b0a","updated":"2015-02-11 05:51:07.000000000","message":"Hi Flavio,\n\nIn glance store, store drivers are persisted in \u0027SCHEME_TO_CLS_MAP\u0027 dictionary.\n\nSCHEME_TO_CLS_MAP \u003d {\u0027http\u0027:\n    {\u0027location_class\u0027: \u003cclass \u0027glance_store._drivers.http.StoreLocation\u0027\u003e,\n    \u0027store\u0027: \u003cglance_store._drivers.http.Store object at 0x7fc677ccfbd0\u003e}\n}\n\nAfter receiving the SIGHUP signal, stores are initialized again and the values for given stores were updated in the SCHEME_TO_CLS_MAP.\n\nSCHEME_TO_CLS_MAP \u003d {\u0027http\u0027:\n    {\u0027location_class\u0027: \u003cclass \u0027glance_store._drivers.http.StoreLocation\u0027\u003e,\n    \u0027store\u0027: \u003cglance_store._drivers.http.Store object at 0x7fc677ccf650\u003e}\n}\n\nif glance_store\u0027s initialization is called multiple times, it will replace store object in SCHEME_TO_CLS_MAP dictionary every time.","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"7c4f86d2d35122c82fe5a707b1f0f88eeea7dca2","unresolved":false,"context_lines":[{"line_number":247,"context_line":"    glance store needs to be initialized."},{"line_number":248,"context_line":"    \"\"\""},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    def __init__(self, threads\u003d1000, initialize_glance_store\u003dFalse):"},{"line_number":251,"context_line":"        eventlet.wsgi.MAX_HEADER_LINE \u003d CONF.max_header_line"},{"line_number":252,"context_line":"        self.threads \u003d threads"},{"line_number":253,"context_line":"        self.children \u003d []"}],"source_content_type":"text/x-python","patch_set":10,"id":"ba7be1f8_24c73d47","line":250,"in_reply_to":"da86d52c_47f91d7f","updated":"2015-02-20 13:51:54.000000000","message":"Right, I guess what I wanted to ask was: Is that a problem? I\u0027m questioning the need of this extra keyword.","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"97408497d07456f3504fc4f56c821899737fa86a","unresolved":false,"context_lines":[{"line_number":246,"context_line":"    def __init__(self, threads\u003d1000, initialize_glance_store\u003dFalse):"},{"line_number":247,"context_line":"        eventlet.wsgi.MAX_HEADER_LINE \u003d CONF.max_header_line"},{"line_number":248,"context_line":"        self.threads \u003d threads"},{"line_number":249,"context_line":"        self.children \u003d []"},{"line_number":250,"context_line":"        self.stale_children \u003d []"},{"line_number":251,"context_line":"        self.running \u003d True"},{"line_number":252,"context_line":"        self.initialize_glance_store \u003d initialize_glance_store"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_1d111152","line":249,"updated":"2015-02-11 21:51:00.000000000","message":"Thoughts on turning children and stale_children into sets?","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"bd77a63514bf782f24ea2da849c8bd61ee508714","unresolved":false,"context_lines":[{"line_number":246,"context_line":"    def __init__(self, threads\u003d1000, initialize_glance_store\u003dFalse):"},{"line_number":247,"context_line":"        eventlet.wsgi.MAX_HEADER_LINE \u003d CONF.max_header_line"},{"line_number":248,"context_line":"        self.threads \u003d threads"},{"line_number":249,"context_line":"        self.children \u003d []"},{"line_number":250,"context_line":"        self.stale_children \u003d []"},{"line_number":251,"context_line":"        self.running \u003d True"},{"line_number":252,"context_line":"        self.initialize_glance_store \u003d initialize_glance_store"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_34509931","line":249,"in_reply_to":"da86d52c_1d111152","updated":"2015-02-12 11:18:21.000000000","message":"set is faster than list, I have changed it to set.","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"97408497d07456f3504fc4f56c821899737fa86a","unresolved":false,"context_lines":[{"line_number":319,"context_line":"                pid, status \u003d os.wait()"},{"line_number":320,"context_line":"                if os.WIFEXITED(status) or os.WIFSIGNALED(status):"},{"line_number":321,"context_line":"                    if pid in self.children:"},{"line_number":322,"context_line":"                        LOG.info(_LI(\u0027Removing dead child %s\u0027) % pid)"},{"line_number":323,"context_line":"                        self.children.remove(pid)"},{"line_number":324,"context_line":"                    elif pid in self.stale_children:"},{"line_number":325,"context_line":"                        LOG.info(_LI(\u0027Removing stale child %s\u0027) % pid)"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_fd3a7dcb","line":322,"updated":"2015-02-11 21:51:00.000000000","message":"Thoughts on abstracting parts of this try block into a separate private method (or a couple of them) to make it easier to read?","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"bd77a63514bf782f24ea2da849c8bd61ee508714","unresolved":false,"context_lines":[{"line_number":319,"context_line":"                pid, status \u003d os.wait()"},{"line_number":320,"context_line":"                if os.WIFEXITED(status) or os.WIFSIGNALED(status):"},{"line_number":321,"context_line":"                    if pid in self.children:"},{"line_number":322,"context_line":"                        LOG.info(_LI(\u0027Removing dead child %s\u0027) % pid)"},{"line_number":323,"context_line":"                        self.children.remove(pid)"},{"line_number":324,"context_line":"                    elif pid in self.stale_children:"},{"line_number":325,"context_line":"                        LOG.info(_LI(\u0027Removing stale child %s\u0027) % pid)"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_7446917c","line":322,"in_reply_to":"da86d52c_fd3a7dcb","updated":"2015-02-12 11:18:21.000000000","message":"Done","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"a302bea1aabc80a520c2795b2a1aaf5cb2f83603","unresolved":false,"context_lines":[{"line_number":297,"context_line":"        self._logger \u003d logging.getLogger(\"eventlet.wsgi.server\")"},{"line_number":298,"context_line":"        self._wsgi_logger \u003d logging.WritableLogger(self._logger)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"        if CONF.workers \u003d\u003d 0:"},{"line_number":301,"context_line":"            # Useful for profiling, test, debug etc."},{"line_number":302,"context_line":"            self.pool \u003d self.create_pool()"},{"line_number":303,"context_line":"            self.pool.spawn_n(self._single_run, self.application, self.sock)"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_c72d23ff","line":300,"updated":"2015-02-17 16:18:20.000000000","message":"Could you please explain why didn\u0027t you add SIGHUP handling for single process mode?","commit_id":"8a769e23731f6c954139d01a0fe6524768648cb2"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"fdce0158f255af76bbf725393067e3009a940bf8","unresolved":false,"context_lines":[{"line_number":297,"context_line":"        self._logger \u003d logging.getLogger(\"eventlet.wsgi.server\")"},{"line_number":298,"context_line":"        self._wsgi_logger \u003d logging.WritableLogger(self._logger)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"        if CONF.workers \u003d\u003d 0:"},{"line_number":301,"context_line":"            # Useful for profiling, test, debug etc."},{"line_number":302,"context_line":"            self.pool \u003d self.create_pool()"},{"line_number":303,"context_line":"            self.pool.spawn_n(self._single_run, self.application, self.sock)"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_26d6e14f","line":300,"in_reply_to":"da86d52c_c72d23ff","updated":"2015-02-18 09:35:48.000000000","message":"Hi Elena,\n\nThis design does not support for 0 workers.\n\nIn this design, we are allowing existing workers to complete pending request and exit whereas at the same time spawning new workers with reloaded configuration to process new request.\n\nAlso, I am not sure that anyone configuring workers as 0 is used in production environment.","commit_id":"8a769e23731f6c954139d01a0fe6524768648cb2"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"2bf08809e333d40996fa250c848cfbf56b86228b","unresolved":false,"context_lines":[{"line_number":317,"context_line":""},{"line_number":318,"context_line":"    def _remove_children(self, pid):"},{"line_number":319,"context_line":"        if pid in self.children:"},{"line_number":320,"context_line":"            LOG.info(_LI(\u0027Removing dead child %s\u0027) % pid)"},{"line_number":321,"context_line":"            self.children.remove(pid)"},{"line_number":322,"context_line":"        elif pid in self.stale_children:"},{"line_number":323,"context_line":"            LOG.info(_LI(\u0027Removing stale child %s\u0027) % pid)"}],"source_content_type":"text/x-python","patch_set":15,"id":"9a80dd14_7370700b","line":320,"updated":"2015-03-09 10:53:34.000000000","message":"By the new guidelines these should be logged after and in past format \"Removed dead child %s\". That would count as unit of work ;)","commit_id":"a2d7948b6b9abd76ec351bcea9a0d60c43144380"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"84e6a0c8d6cf52e862cdf4d41ac050428941f15f","unresolved":false,"context_lines":[{"line_number":317,"context_line":""},{"line_number":318,"context_line":"    def _remove_children(self, pid):"},{"line_number":319,"context_line":"        if pid in self.children:"},{"line_number":320,"context_line":"            LOG.info(_LI(\u0027Removing dead child %s\u0027) % pid)"},{"line_number":321,"context_line":"            self.children.remove(pid)"},{"line_number":322,"context_line":"        elif pid in self.stale_children:"},{"line_number":323,"context_line":"            LOG.info(_LI(\u0027Removing stale child %s\u0027) % pid)"}],"source_content_type":"text/x-python","patch_set":15,"id":"9a80dd14_d4174243","line":320,"in_reply_to":"9a80dd14_7370700b","updated":"2015-03-09 13:02:06.000000000","message":"Done","commit_id":"a2d7948b6b9abd76ec351bcea9a0d60c43144380"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"2bf08809e333d40996fa250c848cfbf56b86228b","unresolved":false,"context_lines":[{"line_number":327,"context_line":""},{"line_number":328,"context_line":"    def _verify_and_respawn_children(self, pid, status):"},{"line_number":329,"context_line":"        if len(self.stale_children) \u003d\u003d 0:"},{"line_number":330,"context_line":"            LOG.info(_LI(\u0027No stale children\u0027))"},{"line_number":331,"context_line":"        if os.WIFEXITED(status) and os.WEXITSTATUS(status) !\u003d 0:"},{"line_number":332,"context_line":"            LOG.error(_LE(\u0027Not respawning child %d, cannot \u0027"},{"line_number":333,"context_line":"                          \u0027recover from termination\u0027) % pid)"}],"source_content_type":"text/x-python","patch_set":15,"id":"9a80dd14_f363803f","line":330,"updated":"2015-03-09 10:53:34.000000000","message":"LOG.debug perhaps?","commit_id":"a2d7948b6b9abd76ec351bcea9a0d60c43144380"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"84e6a0c8d6cf52e862cdf4d41ac050428941f15f","unresolved":false,"context_lines":[{"line_number":327,"context_line":""},{"line_number":328,"context_line":"    def _verify_and_respawn_children(self, pid, status):"},{"line_number":329,"context_line":"        if len(self.stale_children) \u003d\u003d 0:"},{"line_number":330,"context_line":"            LOG.info(_LI(\u0027No stale children\u0027))"},{"line_number":331,"context_line":"        if os.WIFEXITED(status) and os.WEXITSTATUS(status) !\u003d 0:"},{"line_number":332,"context_line":"            LOG.error(_LE(\u0027Not respawning child %d, cannot \u0027"},{"line_number":333,"context_line":"                          \u0027recover from termination\u0027) % pid)"}],"source_content_type":"text/x-python","patch_set":15,"id":"9a80dd14_f429a68a","line":330,"in_reply_to":"9a80dd14_f363803f","updated":"2015-03-09 13:02:06.000000000","message":"Done","commit_id":"a2d7948b6b9abd76ec351bcea9a0d60c43144380"}],"glance/tests/functional/test_reload.py":[{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"a4424f69142c254822945bf38c3cb3c2af2e8a5c","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        conf_filepath \u003d os.path.join(conf_dir, \u0027%s.conf\u0027 % service)"},{"line_number":70,"context_line":"        return conf_filepath"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def test_reload_workers(self):"},{"line_number":73,"context_line":"        \"\"\"Test SIGHUP picks up new workers value\"\"\""},{"line_number":74,"context_line":"        def check_pids(pre, post\u003dNone, workers\u003d2):"},{"line_number":75,"context_line":"            if post is None:"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_c4644624","line":72,"updated":"2015-02-03 16:52:27.000000000","message":"So this test could take upwards 2 minutes to complete (each time)? Perhaps we should include this as a comment or in the docstring?","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"8e7c04b4f5fffd3699f7a2e3b57c410b43f2bbc6","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        conf_filepath \u003d os.path.join(conf_dir, \u0027%s.conf\u0027 % service)"},{"line_number":70,"context_line":"        return conf_filepath"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def test_reload_workers(self):"},{"line_number":73,"context_line":"        \"\"\"Test SIGHUP picks up new workers value\"\"\""},{"line_number":74,"context_line":"        def check_pids(pre, post\u003dNone, workers\u003d2):"},{"line_number":75,"context_line":"            if post is None:"}],"source_content_type":"text/x-python","patch_set":9,"id":"da86d52c_56c9a324","line":72,"in_reply_to":"da86d52c_c4644624","updated":"2015-02-05 07:57:07.000000000","message":"Done","commit_id":"5db5224e3dac0b8645cc91c5a8fe32e20df68679"},{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"26841cf71943ac60106c25a270cbb691d195aab6","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                    break"},{"line_number":101,"context_line":"            time.sleep(0.01)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"        for server in \u0027api\u0027, \u0027registry\u0027:"},{"line_number":104,"context_line":"            self.assertTrue(check_pids(pre_pids[server], workers\u003d1))"},{"line_number":105,"context_line":"            # Labour costs have fallen"},{"line_number":106,"context_line":"            set_config_value(self._conffile(server), \u0027workers\u0027, \u00272\u0027)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_5a534f16","line":103,"updated":"2015-02-06 12:08:54.000000000","message":"NIT: could you make this an explicit tuble? (\u0027api\u0027, \u0027registry\u0027)","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"cee60c591b95d03b699c9b2d666550321f5646a1","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                    break"},{"line_number":101,"context_line":"            time.sleep(0.01)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"        for server in \u0027api\u0027, \u0027registry\u0027:"},{"line_number":104,"context_line":"            self.assertTrue(check_pids(pre_pids[server], workers\u003d1))"},{"line_number":105,"context_line":"            # Labour costs have fallen"},{"line_number":106,"context_line":"            set_config_value(self._conffile(server), \u0027workers\u0027, \u00272\u0027)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_e731315b","line":103,"in_reply_to":"da86d52c_5a534f16","updated":"2015-02-11 05:51:07.000000000","message":"Done","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"97408497d07456f3504fc4f56c821899737fa86a","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                    return False"},{"line_number":83,"context_line":"            if len(post) \u003d\u003d workers:"},{"line_number":84,"context_line":"                # Check new children have different pids"},{"line_number":85,"context_line":"                if post \u0026 pre \u003d\u003d set():"},{"line_number":86,"context_line":"                    return True"},{"line_number":87,"context_line":"            return False"},{"line_number":88,"context_line":"        self.api_server.fork_socket \u003d False"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_fd96fd92","line":85,"updated":"2015-02-11 21:51:00.000000000","message":"If post and pre are sets, it will be easier to read (in the future) if you do\n\n    if post.intersection(pre) \u003d\u003d set():","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"bd77a63514bf782f24ea2da849c8bd61ee508714","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                    return False"},{"line_number":83,"context_line":"            if len(post) \u003d\u003d workers:"},{"line_number":84,"context_line":"                # Check new children have different pids"},{"line_number":85,"context_line":"                if post \u0026 pre \u003d\u003d set():"},{"line_number":86,"context_line":"                    return True"},{"line_number":87,"context_line":"            return False"},{"line_number":88,"context_line":"        self.api_server.fork_socket \u003d False"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_d5510431","line":85,"in_reply_to":"da86d52c_fd96fd92","updated":"2015-02-12 11:18:21.000000000","message":"Done","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"97408497d07456f3504fc4f56c821899737fa86a","unresolved":false,"context_lines":[{"line_number":87,"context_line":"            return False"},{"line_number":88,"context_line":"        self.api_server.fork_socket \u003d False"},{"line_number":89,"context_line":"        self.registry_server.fork_socket \u003d False"},{"line_number":90,"context_line":"        self.start_servers(fork_socket\u003dFalse, **self.__dict__.copy())"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"        pre_pids \u003d {}"},{"line_number":93,"context_line":"        post_pids \u003d {}"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_fd4b5d28","line":90,"updated":"2015-02-11 21:51:00.000000000","message":"Why not simply do \n\n    **vars(self)","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"bd77a63514bf782f24ea2da849c8bd61ee508714","unresolved":false,"context_lines":[{"line_number":87,"context_line":"            return False"},{"line_number":88,"context_line":"        self.api_server.fork_socket \u003d False"},{"line_number":89,"context_line":"        self.registry_server.fork_socket \u003d False"},{"line_number":90,"context_line":"        self.start_servers(fork_socket\u003dFalse, **self.__dict__.copy())"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"        pre_pids \u003d {}"},{"line_number":93,"context_line":"        post_pids \u003d {}"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_752778ca","line":90,"in_reply_to":"da86d52c_fd4b5d28","updated":"2015-02-12 11:18:21.000000000","message":"Done","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"97408497d07456f3504fc4f56c821899737fa86a","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        post_pids \u003d {}"},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"        for _ in range(6000):"},{"line_number":96,"context_line":"            for server in (\u0027api\u0027, \u0027registry\u0027):"},{"line_number":97,"context_line":"                pre_pids[server] \u003d self._get_children(server)"},{"line_number":98,"context_line":"            if check_pids(pre_pids[\u0027api\u0027], workers\u003d1):"},{"line_number":99,"context_line":"                if check_pids(pre_pids[\u0027registry\u0027], workers\u003d1):"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_b8a8138d","line":96,"updated":"2015-02-11 21:51:00.000000000","message":"Can we keep this consistent with the rest (or the rest consistent with this one, which I prefer)? Elsewhere you do\n\n    for server in \"api\", \"registry\":\n\nEither change them to use the (slightly more) explicit tuple syntax or change this to use the implicit tuple syntax.","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"bd77a63514bf782f24ea2da849c8bd61ee508714","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        post_pids \u003d {}"},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"        for _ in range(6000):"},{"line_number":96,"context_line":"            for server in (\u0027api\u0027, \u0027registry\u0027):"},{"line_number":97,"context_line":"                pre_pids[server] \u003d self._get_children(server)"},{"line_number":98,"context_line":"            if check_pids(pre_pids[\u0027api\u0027], workers\u003d1):"},{"line_number":99,"context_line":"                if check_pids(pre_pids[\u0027registry\u0027], workers\u003d1):"}],"source_content_type":"text/x-python","patch_set":11,"id":"da86d52c_5059a233","line":96,"in_reply_to":"da86d52c_b8a8138d","updated":"2015-02-12 11:18:21.000000000","message":"Done","commit_id":"0ab6fc365e9436a197802f857e80c9f6a941d51f"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"e1a56bea7b92842cde05a7c7c17d986a616dda2d","unresolved":false,"context_lines":[{"line_number":26,"context_line":"def set_config_value(filepath, key, value):"},{"line_number":27,"context_line":"    \"\"\"Set \u0027key \u003d value\u0027 in config file\"\"\""},{"line_number":28,"context_line":"    f \u003d open(filepath, \u0027r\u0027)"},{"line_number":29,"context_line":"    lines \u003d f.readlines()"},{"line_number":30,"context_line":"    f.close()"},{"line_number":31,"context_line":"    f \u003d open(filepath, \u0027w\u0027)"},{"line_number":32,"context_line":"    for line in lines:"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_a48d92d5","line":29,"updated":"2015-02-17 14:19:12.000000000","message":"Are you trying to avoid indentation by not using a context manager?\n\nYou can open the file fewer times (which is preferable) if you do work it like this:\n\n    f \u003d open(filepath, \u0027rw\u0027)\n    lines \u003d f.readlines()\n    f.seek(0, 0)  # Move the cursor back to the start of the file\n    f.truncate()\n    for line in lines:\n        # ...\n    f.close()\n\nBut you can write it like so:\n\n    with open(filepath, \u0027rw\u0027) as f:\n        lines \u003d f.readlines()\n        f.seek(0,0)\n        f.truncate()\n        for line in lines:\n            match \u003d re.match(\u0027^%s .*\u003d\u0027 % key, line)\n            if match:\n                line \u003d \u0027%s \u003d %s\\n\u0027 % (key, value)\n            f.write(line)\n\nBut also, each time you call re.match the re library compiles a new regular expression, uses it, and throws it away and since key doesn\u0027t change, neither does the expression we\u0027re using. In fact, we don\u0027t need to constantly reinterpolate key and value for line either.\n\nWe also don\u0027t need the regular expression string to be a raw string because there are no \\ in it. Further, I think .* will be too greedy for what you want since I think you want whitespace, not any number of any characters. If what you actually want is any number of characters other than \u003d you should be doing\n\n     ^%s [^\u003d]*\u003d\n\nIf you only care about whitespace (which I think is what you really want)\n\n    ^%s\\s+\u003d\n\nSo we should be doing\n\n    replacement_line \u003d \u0027%s \u003d %s\\n\u0027 % (key, value)\n    match \u003d re.compile(\u0027^%s\\s+\u003d\u0027 % key).match\n    with open(filepath, \u0027rw\u0027) as f:\n        lines \u003d f.readlines()\n        f.seek(0, 0)\n        f.truncate()\n        for line in lines:\n            f.write(line if not match(line) else replacement_line)\n\nBut I can understand if people don\u0027t like the last line, then we should just be doing\n\n    # ...\n        for line in lines:\n            if match(line):\n                line \u003d replacement_line\n            f.write(line)","commit_id":"8a769e23731f6c954139d01a0fe6524768648cb2"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"fdce0158f255af76bbf725393067e3009a940bf8","unresolved":false,"context_lines":[{"line_number":26,"context_line":"def set_config_value(filepath, key, value):"},{"line_number":27,"context_line":"    \"\"\"Set \u0027key \u003d value\u0027 in config file\"\"\""},{"line_number":28,"context_line":"    f \u003d open(filepath, \u0027r\u0027)"},{"line_number":29,"context_line":"    lines \u003d f.readlines()"},{"line_number":30,"context_line":"    f.close()"},{"line_number":31,"context_line":"    f \u003d open(filepath, \u0027w\u0027)"},{"line_number":32,"context_line":"    for line in lines:"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_c6726549","line":29,"in_reply_to":"da86d52c_a48d92d5","updated":"2015-02-18 09:35:48.000000000","message":"Done","commit_id":"8a769e23731f6c954139d01a0fe6524768648cb2"},{"author":{"_account_id":2537,"name":"Nikhil Komawar","email":"nik.komawar@gmail.com","username":"nikhil-komawar"},"change_message_id":"ddaec215d755cca3a87ac4241ee7cbaf14752278","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2014 Hewlett-Packard Development Company, L.P."},{"line_number":2,"context_line":"# All Rights Reserved."},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a80dd14_a409402e","line":1,"updated":"2015-03-11 18:20:07.000000000","message":"Year, can be changed as an amendment.","commit_id":"ea2252b4fd4eb5b2888b5dc57dd9b9cfe4388bdf"}],"glance/tests/unit/api/test_cmd.py":[{"author":{"_account_id":6159,"name":"Flavio Percoco Premoli","display_name":"flaper87","email":"flavio.percoco@flyrlabs.com","username":"flaper87"},"change_message_id":"26841cf71943ac60106c25a270cbb691d195aab6","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        glance.cmd.api.main()"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def test_unsupported_default_store(self):"},{"line_number":71,"context_line":"        self.stubs.UnsetAll()"},{"line_number":72,"context_line":"        self.config(group\u003d\u0027glance_store\u0027, default_store\u003d\u0027shouldnotexist\u0027)"},{"line_number":73,"context_line":"        exit \u003d self.assertRaises(SystemExit, glance.cmd.api.main)"},{"line_number":74,"context_line":"        self.assertEqual(1, exit.code)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_9a594737","line":71,"updated":"2015-02-06 12:08:54.000000000","message":"why is this change needed? Can this be moved to the tearDown method?","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"},{"author":{"_account_id":9303,"name":"Abhishek Kekane","email":"akekane@redhat.com","username":"abhishekkekane"},"change_message_id":"cee60c591b95d03b699c9b2d666550321f5646a1","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        glance.cmd.api.main()"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def test_unsupported_default_store(self):"},{"line_number":71,"context_line":"        self.stubs.UnsetAll()"},{"line_number":72,"context_line":"        self.config(group\u003d\u0027glance_store\u0027, default_store\u003d\u0027shouldnotexist\u0027)"},{"line_number":73,"context_line":"        exit \u003d self.assertRaises(SystemExit, glance.cmd.api.main)"},{"line_number":74,"context_line":"        self.assertEqual(1, exit.code)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_a743b9ad","line":71,"in_reply_to":"da86d52c_9a594737","updated":"2015-02-11 05:51:07.000000000","message":"Hi Flavio,\n\nIn SetUp method \u0027start\u0027 method of wsgi.Server is stubbed and It\u0027s not doing anything, As we have moved store initialization call to start method of wsgi.Server I need to unset the stub otherwise it does not raise SystemExit if invaild store is configured.","commit_id":"8d65f42bbe523b48df67d53db5074c1840314d4c"}]}
