)]}'
{"nova/api/openstack/placement/exception.py":[{"author":{"_account_id":9172,"name":"Radoslav Gerganov","email":"rgerganov@vmware.com","username":"rgerganov"},"change_message_id":"75520a804dd971a2b288a765dce41223bac584ce","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"class ResourceProviderConcurrentUpdateDetected(ConcurrentUpdateDetected):"},{"line_number":89,"context_line":"    msg_fmt \u003d _(\"Another thread concurrently updated the data. \""},{"line_number":90,"context_line":"                \"Please retry your update\")"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_5f3a0335","line":89,"updated":"2018-07-27 11:53:06.000000000","message":"do we need to this given it is the same as in the base class?","commit_id":"bb80a4c866f41ceff8577333092d97ae466f22ec"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"83b8314fd6053eb2c4fe93be363e05b9155b1942","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"class ResourceProviderConcurrentUpdateDetected(ConcurrentUpdateDetected):"},{"line_number":89,"context_line":"    msg_fmt \u003d _(\"Another thread concurrently updated the data. \""},{"line_number":90,"context_line":"                \"Please retry your update\")"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_fff0af68","line":89,"in_reply_to":"5f7c97a3_5f3a0335","updated":"2018-07-27 12:01:06.000000000","message":"No, but I was assuming someone would suggest it be different, but that hasn\u0027t happened yet, so yeah, could be removed.","commit_id":"bb80a4c866f41ceff8577333092d97ae466f22ec"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"906b95604def5a95f3a385ce8740a6be9f43834c","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"class ResourceProviderConcurrentUpdateDetected(ConcurrentUpdateDetected):"},{"line_number":89,"context_line":"    msg_fmt \u003d _(\"Another thread concurrently updated the data. \""},{"line_number":90,"context_line":"                \"Please retry your update\")"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_f63770fc","line":89,"range":{"start_line":89,"start_character":53,"end_line":89,"end_character":61},"updated":"2018-07-27 21:53:17.000000000","message":"the resource provider data?","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"492eda1f38bc83906513d8a455d9663963ef72fa","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"class ResourceProviderConcurrentUpdateDetected(ConcurrentUpdateDetected):"},{"line_number":89,"context_line":"    msg_fmt \u003d _(\"Another thread concurrently updated the data. \""},{"line_number":90,"context_line":"                \"Please retry your update\")"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_f9fc4172","line":89,"range":{"start_line":89,"start_character":53,"end_line":89,"end_character":61},"in_reply_to":"5f7c97a3_f63770fc","updated":"2018-07-27 22:47:36.000000000","message":"yeah, will do. see conversation between gibi and me on earlier patch","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8e0ceeb2d4aaa9fd6fcd0f0a5384b67c0c126e3f","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"class ResourceProviderConcurrentUpdateDetected(ConcurrentUpdateDetected):"},{"line_number":89,"context_line":"    msg_fmt \u003d _(\"Another thread concurrently updated the data. \""},{"line_number":90,"context_line":"                \"Please retry your update\")"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_e6123afe","line":89,"range":{"start_line":89,"start_character":53,"end_line":89,"end_character":61},"in_reply_to":"5f7c97a3_f9fc4172","updated":"2018-07-30 20:01:27.000000000","message":"You mean with Rado [1]? I definitely see why we want them to be different exception classes - but was the point that we don\u0027t need to repeat msg_fmt unless it\u0027s different from that of its parent? Anyway, I\u0027m a fan of making the message more specific, and the duplication doesn\u0027t bother me.\n\n[1] https://review.openstack.org/#/c/586048/2/nova/api/openstack/placement/exception.py@89","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"}],"nova/api/openstack/placement/objects/resource_provider.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"8299a9ef46791ed9634c63268b687e5150d96959","unresolved":false,"context_lines":[{"line_number":278,"context_line":""},{"line_number":279,"context_line":"    res \u003d ctx.session.execute(upd_stmt)"},{"line_number":280,"context_line":"    if res.rowcount !\u003d 1:"},{"line_number":281,"context_line":"        raise exception.ConcurrentUpdateDetected"},{"line_number":282,"context_line":"    return new_generation"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_f596a63d","side":"PARENT","line":281,"updated":"2018-07-26 15:48:25.000000000","message":"ohh it raised the class?!","commit_id":"d687e7d29b37b3cdc9e1bc429dec3a01be298f80"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"8299a9ef46791ed9634c63268b687e5150d96959","unresolved":false,"context_lines":[{"line_number":278,"context_line":""},{"line_number":279,"context_line":"    res \u003d ctx.session.execute(upd_stmt)"},{"line_number":280,"context_line":"    if res.rowcount !\u003d 1:"},{"line_number":281,"context_line":"        raise exception.ResourceProviderConcurrentUpdateDetected()"},{"line_number":282,"context_line":"    return new_generation"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_95f4128a","line":281,"updated":"2018-07-26 15:48:25.000000000","message":"We don\u0027t have to change the API handlers to handle this as this new exception derives from the original ConcurrentUpdateDetected.","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"ca8d12166927cf0d6b6f1825614f1c08f4b3a28c","unresolved":false,"context_lines":[{"line_number":278,"context_line":""},{"line_number":279,"context_line":"    res \u003d ctx.session.execute(upd_stmt)"},{"line_number":280,"context_line":"    if res.rowcount !\u003d 1:"},{"line_number":281,"context_line":"        raise exception.ResourceProviderConcurrentUpdateDetected()"},{"line_number":282,"context_line":"    return new_generation"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d8407f62","line":281,"in_reply_to":"5f7c97a3_95f4128a","updated":"2018-07-26 16:41:33.000000000","message":"yup, I figured it was best to leave that for later","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"8299a9ef46791ed9634c63268b687e5150d96959","unresolved":false,"context_lines":[{"line_number":1924,"context_line":"@base.VersionedObjectRegistry.register_if(False)"},{"line_number":1925,"context_line":"class AllocationList(base.ObjectListBase, base.VersionedObject):"},{"line_number":1926,"context_line":""},{"line_number":1927,"context_line":"    # The number of times to retry set_allocations if there has"},{"line_number":1928,"context_line":"    # been a resource provider (not consumer) generation coflict."},{"line_number":1929,"context_line":"    ALLOCATION_RETRY_COUNT \u003d 10"},{"line_number":1930,"context_line":""},{"line_number":1931,"context_line":"    fields \u003d {"},{"line_number":1932,"context_line":"        \u0027objects\u0027: fields.ListOfObjectsField(\u0027Allocation\u0027),"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d52feaf2","line":1929,"range":{"start_line":1927,"start_character":0,"end_line":1929,"end_character":31},"updated":"2018-07-26 15:48:25.000000000","message":"maybe the RP_CONFLICT_RETRY_COUNT name would made the code comment unnecessary.","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"ca8d12166927cf0d6b6f1825614f1c08f4b3a28c","unresolved":false,"context_lines":[{"line_number":1924,"context_line":"@base.VersionedObjectRegistry.register_if(False)"},{"line_number":1925,"context_line":"class AllocationList(base.ObjectListBase, base.VersionedObject):"},{"line_number":1926,"context_line":""},{"line_number":1927,"context_line":"    # The number of times to retry set_allocations if there has"},{"line_number":1928,"context_line":"    # been a resource provider (not consumer) generation coflict."},{"line_number":1929,"context_line":"    ALLOCATION_RETRY_COUNT \u003d 10"},{"line_number":1930,"context_line":""},{"line_number":1931,"context_line":"    fields \u003d {"},{"line_number":1932,"context_line":"        \u0027objects\u0027: fields.ListOfObjectsField(\u0027Allocation\u0027),"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_b8558321","line":1929,"range":{"start_line":1927,"start_character":0,"end_line":1929,"end_character":31},"in_reply_to":"5f7c97a3_d52feaf2","updated":"2018-07-26 16:41:33.000000000","message":"that\u0027s a good idea","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"8299a9ef46791ed9634c63268b687e5150d96959","unresolved":false,"context_lines":[{"line_number":2143,"context_line":"            # information from the allocations is not coherent as this"},{"line_number":2144,"context_line":"            # could be multiple consumers and providers."},{"line_number":2145,"context_line":"            LOG.warning(\u0027Exceeded retry limit on allocations write\u0027)"},{"line_number":2146,"context_line":"            raise exception.ResourceProviderConcurrentUpdateDetected()"},{"line_number":2147,"context_line":""},{"line_number":2148,"context_line":"    def delete_all(self):"},{"line_number":2149,"context_line":"        consumer_uuids \u003d set(alloc.consumer.uuid for alloc in self.objects)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_35609e34","line":2146,"range":{"start_line":2146,"start_character":28,"end_line":2146,"end_character":68},"updated":"2018-07-26 15:48:25.000000000","message":"we are lost the original exception context in the loop so need to create a new but I think we don\u0027t too much to worth storing one of the original exception in the loop.","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"ca8d12166927cf0d6b6f1825614f1c08f4b3a28c","unresolved":false,"context_lines":[{"line_number":2143,"context_line":"            # information from the allocations is not coherent as this"},{"line_number":2144,"context_line":"            # could be multiple consumers and providers."},{"line_number":2145,"context_line":"            LOG.warning(\u0027Exceeded retry limit on allocations write\u0027)"},{"line_number":2146,"context_line":"            raise exception.ResourceProviderConcurrentUpdateDetected()"},{"line_number":2147,"context_line":""},{"line_number":2148,"context_line":"    def delete_all(self):"},{"line_number":2149,"context_line":"        consumer_uuids \u003d set(alloc.consumer.uuid for alloc in self.objects)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_f838dbed","line":2146,"range":{"start_line":2146,"start_character":28,"end_line":2146,"end_character":68},"in_reply_to":"5f7c97a3_35609e34","updated":"2018-07-26 16:41:33.000000000","message":"The original ResourceProviderConcurrentUpdateDetected has no info (except the location) other than that it happened, so I figured it was useless to try to keep as it would add nothing to a debugging scenario","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"6525d32c9543c731c72159e63fcab44313e43532","unresolved":false,"context_lines":[{"line_number":2143,"context_line":"            # information from the allocations is not coherent as this"},{"line_number":2144,"context_line":"            # could be multiple consumers and providers."},{"line_number":2145,"context_line":"            LOG.warning(\u0027Exceeded retry limit on allocations write\u0027)"},{"line_number":2146,"context_line":"            raise exception.ResourceProviderConcurrentUpdateDetected()"},{"line_number":2147,"context_line":""},{"line_number":2148,"context_line":"    def delete_all(self):"},{"line_number":2149,"context_line":"        consumer_uuids \u003d set(alloc.consumer.uuid for alloc in self.objects)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_2b3fcdb2","line":2146,"range":{"start_line":2146,"start_character":28,"end_line":2146,"end_character":68},"in_reply_to":"5f7c97a3_f838dbed","updated":"2018-07-27 07:35:43.000000000","message":"I agree.","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"906b95604def5a95f3a385ce8740a6be9f43834c","unresolved":false,"context_lines":[{"line_number":2116,"context_line":"        # and try again. For sake of simplicity (and because we don\u0027t have"},{"line_number":2117,"context_line":"        # easy access to the information) we reload all the resource"},{"line_number":2118,"context_line":"        # providers that may be present."},{"line_number":2119,"context_line":"        retries \u003d self.RP_CONFLICT_RETRY_COUNT"},{"line_number":2120,"context_line":"        while retries:"},{"line_number":2121,"context_line":"            retries -\u003d 1"},{"line_number":2122,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_d60b542a","line":2119,"updated":"2018-07-27 21:53:17.000000000","message":"Is there a reason not to use @retrying here?\n\nI mean other than the fact that it\u0027s underocumented and complicated.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"492eda1f38bc83906513d8a455d9663963ef72fa","unresolved":false,"context_lines":[{"line_number":2116,"context_line":"        # and try again. For sake of simplicity (and because we don\u0027t have"},{"line_number":2117,"context_line":"        # easy access to the information) we reload all the resource"},{"line_number":2118,"context_line":"        # providers that may be present."},{"line_number":2119,"context_line":"        retries \u003d self.RP_CONFLICT_RETRY_COUNT"},{"line_number":2120,"context_line":"        while retries:"},{"line_number":2121,"context_line":"            retries -\u003d 1"},{"line_number":2122,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_99c74d47","line":2119,"in_reply_to":"5f7c97a3_d60b542a","updated":"2018-07-27 22:47:36.000000000","message":"Because of that, because I wanted visibility and explicitness, and because I copied the code elsewhere in the stack where resource class ids are created.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"906b95604def5a95f3a385ce8740a6be9f43834c","unresolved":false,"context_lines":[{"line_number":2142,"context_line":"            # Attempting to extract specific consumer or resource provider"},{"line_number":2143,"context_line":"            # information from the allocations is not coherent as this"},{"line_number":2144,"context_line":"            # could be multiple consumers and providers."},{"line_number":2145,"context_line":"            LOG.warning(\u0027Exceeded retry limit on allocations write\u0027)"},{"line_number":2146,"context_line":"            raise exception.ResourceProviderConcurrentUpdateDetected()"},{"line_number":2147,"context_line":""},{"line_number":2148,"context_line":"    def delete_all(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_792a7178","line":2145,"range":{"start_line":2145,"start_character":25,"end_line":2145,"end_character":66},"updated":"2018-07-27 21:53:17.000000000","message":"This should probably say how many retries that is. Because the reader (of the log) will want to know regardless; and in case we make the sucker configurable some day.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"492eda1f38bc83906513d8a455d9663963ef72fa","unresolved":false,"context_lines":[{"line_number":2142,"context_line":"            # Attempting to extract specific consumer or resource provider"},{"line_number":2143,"context_line":"            # information from the allocations is not coherent as this"},{"line_number":2144,"context_line":"            # could be multiple consumers and providers."},{"line_number":2145,"context_line":"            LOG.warning(\u0027Exceeded retry limit on allocations write\u0027)"},{"line_number":2146,"context_line":"            raise exception.ResourceProviderConcurrentUpdateDetected()"},{"line_number":2147,"context_line":""},{"line_number":2148,"context_line":"    def delete_all(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_59bd35b0","line":2145,"range":{"start_line":2145,"start_character":25,"end_line":2145,"end_character":66},"in_reply_to":"5f7c97a3_792a7178","updated":"2018-07-27 22:47:36.000000000","message":"fair enough","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"}],"nova/tests/functional/api/openstack/placement/db/test_resource_provider.py":[{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"34b73b9d7aae8e587c0d49a229d9d9f12b9d042b","unresolved":false,"context_lines":[{"line_number":1779,"context_line":"                except StopIteration:"},{"line_number":1780,"context_line":"                    return unmocked_set(*args, **kwargs)"},{"line_number":1781,"context_line":""},{"line_number":1782,"context_line":"            mock_set.side_effect \u003d side_effect"},{"line_number":1783,"context_line":"            alloc_list.replace_all()"},{"line_number":1784,"context_line":"            self.assertEqual(2, mock_log.debug.call_count)"},{"line_number":1785,"context_line":"            mock_log.debug.called_with("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_cbfad90f","line":1782,"range":{"start_line":1782,"start_character":12,"end_line":1782,"end_character":46},"updated":"2018-07-27 07:31:43.000000000","message":"...or we can use less mock by adding some inventory to rp1 and intentionally have the concurrent update error just once.\n\n        rp1_clone \u003d rp_obj.ResourceProvider.get_by_uuid(self.ctx, rp1.uuid)\n        tb.add_inventory(rp1_clone, fields.ResourceClass.DISK_GB, 1000,\n                         min_unit\u003d10,\n                         max_unit\u003d1000,\n                         step_size\u003d10)\n        self.assertGreater(rp1_clone.generation, rp1.generation)\n        alloc_list.replace_all()\n        ...\n\nBut, meh, this also works for me. Thanks!","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"8299a9ef46791ed9634c63268b687e5150d96959","unresolved":false,"context_lines":[{"line_number":1790,"context_line":"        # and that it has a higher generation."},{"line_number":1791,"context_line":"        new_rp \u003d alloc_list[0].resource_provider"},{"line_number":1792,"context_line":"        self.assertEqual(original_generation, rp1.generation)"},{"line_number":1793,"context_line":"        self.assertEqual(original_generation + 1, new_rp.generation)"},{"line_number":1794,"context_line":""},{"line_number":1795,"context_line":""},{"line_number":1796,"context_line":"class UsageListTestCase(tb.PlacementDbBaseTestCase):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_5572fa4b","line":1793,"updated":"2018-07-26 15:48:25.000000000","message":"I would check that there was 3 calls on mock_set to ensure that the 3rd, successful call was made by the code under test after the two unsuccessful calls.","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"ca8d12166927cf0d6b6f1825614f1c08f4b3a28c","unresolved":false,"context_lines":[{"line_number":1790,"context_line":"        # and that it has a higher generation."},{"line_number":1791,"context_line":"        new_rp \u003d alloc_list[0].resource_provider"},{"line_number":1792,"context_line":"        self.assertEqual(original_generation, rp1.generation)"},{"line_number":1793,"context_line":"        self.assertEqual(original_generation + 1, new_rp.generation)"},{"line_number":1794,"context_line":""},{"line_number":1795,"context_line":""},{"line_number":1796,"context_line":"class UsageListTestCase(tb.PlacementDbBaseTestCase):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_b81a637d","line":1793,"in_reply_to":"5f7c97a3_5572fa4b","updated":"2018-07-26 16:41:33.000000000","message":"good idea, will add","commit_id":"d0a558e73936bacef5633fce5548077fad78bec8"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"906b95604def5a95f3a385ce8740a6be9f43834c","unresolved":false,"context_lines":[{"line_number":1705,"context_line":"    @mock.patch(\u0027nova.api.openstack.placement.objects.resource_provider.LOG\u0027)"},{"line_number":1706,"context_line":"    def test_set_allocations_retry(self, mock_log):"},{"line_number":1707,"context_line":"        \"\"\"Test server side allocation write retry handling.\"\"\""},{"line_number":1708,"context_line":"        # Make sure we set the retry count back to normal, not matter"},{"line_number":1709,"context_line":"        # what happens in these tests."},{"line_number":1710,"context_line":"        saved_retry_count \u003d rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT"},{"line_number":1711,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_f9052110","line":1708,"range":{"start_line":1708,"start_character":59,"end_line":1708,"end_character":62},"updated":"2018-07-27 21:53:17.000000000","message":"no","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"906b95604def5a95f3a385ce8740a6be9f43834c","unresolved":false,"context_lines":[{"line_number":1706,"context_line":"    def test_set_allocations_retry(self, mock_log):"},{"line_number":1707,"context_line":"        \"\"\"Test server side allocation write retry handling.\"\"\""},{"line_number":1708,"context_line":"        # Make sure we set the retry count back to normal, not matter"},{"line_number":1709,"context_line":"        # what happens in these tests."},{"line_number":1710,"context_line":"        saved_retry_count \u003d rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT"},{"line_number":1711,"context_line":""},{"line_number":1712,"context_line":"        def _cleanup():"},{"line_number":1713,"context_line":"            rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT \u003d saved_retry_count"},{"line_number":1714,"context_line":""},{"line_number":1715,"context_line":"        self.addCleanup(_cleanup)"},{"line_number":1716,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_b90b2920","line":1713,"range":{"start_line":1709,"start_character":0,"end_line":1713,"end_character":77},"updated":"2018-07-27 21:53:17.000000000","message":"The mock.patch.object context manager was designed to obviate the need for this kind of goofiness.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"492eda1f38bc83906513d8a455d9663963ef72fa","unresolved":false,"context_lines":[{"line_number":1706,"context_line":"    def test_set_allocations_retry(self, mock_log):"},{"line_number":1707,"context_line":"        \"\"\"Test server side allocation write retry handling.\"\"\""},{"line_number":1708,"context_line":"        # Make sure we set the retry count back to normal, not matter"},{"line_number":1709,"context_line":"        # what happens in these tests."},{"line_number":1710,"context_line":"        saved_retry_count \u003d rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT"},{"line_number":1711,"context_line":""},{"line_number":1712,"context_line":"        def _cleanup():"},{"line_number":1713,"context_line":"            rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT \u003d saved_retry_count"},{"line_number":1714,"context_line":""},{"line_number":1715,"context_line":"        self.addCleanup(_cleanup)"},{"line_number":1716,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_d9de250e","line":1713,"range":{"start_line":1709,"start_character":0,"end_line":1713,"end_character":77},"in_reply_to":"5f7c97a3_b90b2920","updated":"2018-07-27 22:47:36.000000000","message":"Since I want it to be once for the entirety of this multi-stage test and because I want to avoid nested (both in the sense of within one another and indented) context managers I did this instead.\n\nIn the original version of the collection of tests there were three of them. Now that it has boiled down to one it matters less, but to me at least, the clean up works fine as well.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"906b95604def5a95f3a385ce8740a6be9f43834c","unresolved":false,"context_lines":[{"line_number":1750,"context_line":"            ])"},{"line_number":1751,"context_line":""},{"line_number":1752,"context_line":"        # Make sure the right exception happens when the retry loop expires."},{"line_number":1753,"context_line":"        rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT \u003d 0"},{"line_number":1754,"context_line":"        self.assertRaises("},{"line_number":1755,"context_line":"            exception.ResourceProviderConcurrentUpdateDetected,"},{"line_number":1756,"context_line":"            alloc_list.replace_all)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_d9194576","line":1753,"range":{"start_line":1753,"start_character":0,"end_line":1753,"end_character":57},"updated":"2018-07-27 21:53:17.000000000","message":"So like\n\n with mock.patch.object(rp_obj.AllocationList, \u0027RP_CONFLICT_RETRY_COUNT\u0027, 0):\n     ...do the stuff that relies on it being zero\n ...and then when you get here, it\u0027s restored to its original value.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"90b31948278cbb9dbef10b0200694e00bb5f1322","unresolved":false,"context_lines":[{"line_number":1750,"context_line":"            ])"},{"line_number":1751,"context_line":""},{"line_number":1752,"context_line":"        # Make sure the right exception happens when the retry loop expires."},{"line_number":1753,"context_line":"        rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT \u003d 0"},{"line_number":1754,"context_line":"        self.assertRaises("},{"line_number":1755,"context_line":"            exception.ResourceProviderConcurrentUpdateDetected,"},{"line_number":1756,"context_line":"            alloc_list.replace_all)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_66adcaa2","line":1753,"range":{"start_line":1753,"start_character":0,"end_line":1753,"end_character":57},"in_reply_to":"5f7c97a3_266fd293","updated":"2018-07-30 20:05:06.000000000","message":"We clearly read tests differently, but that\u0027s cool, I don\u0027t mind changing it.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"8e0ceeb2d4aaa9fd6fcd0f0a5384b67c0c126e3f","unresolved":false,"context_lines":[{"line_number":1750,"context_line":"            ])"},{"line_number":1751,"context_line":""},{"line_number":1752,"context_line":"        # Make sure the right exception happens when the retry loop expires."},{"line_number":1753,"context_line":"        rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT \u003d 0"},{"line_number":1754,"context_line":"        self.assertRaises("},{"line_number":1755,"context_line":"            exception.ResourceProviderConcurrentUpdateDetected,"},{"line_number":1756,"context_line":"            alloc_list.replace_all)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_266fd293","line":1753,"range":{"start_line":1753,"start_character":0,"end_line":1753,"end_character":57},"in_reply_to":"5f7c97a3_79cfd153","updated":"2018-07-30 20:01:27.000000000","message":"\u003e fact that the cleanup happens matters up there, where we want it to\n \u003e be clear, not so much here.\n\nI feel the opposite; seeing this line without the others could make a guy worry about the side effects of dorking with globals.\n\n \u003e Happy to change it\n\nIf you don\u0027t mind, I would prefer it, thanks.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"492eda1f38bc83906513d8a455d9663963ef72fa","unresolved":false,"context_lines":[{"line_number":1750,"context_line":"            ])"},{"line_number":1751,"context_line":""},{"line_number":1752,"context_line":"        # Make sure the right exception happens when the retry loop expires."},{"line_number":1753,"context_line":"        rp_obj.AllocationList.RP_CONFLICT_RETRY_COUNT \u003d 0"},{"line_number":1754,"context_line":"        self.assertRaises("},{"line_number":1755,"context_line":"            exception.ResourceProviderConcurrentUpdateDetected,"},{"line_number":1756,"context_line":"            alloc_list.replace_all)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_79cfd153","line":1753,"range":{"start_line":1753,"start_character":0,"end_line":1753,"end_character":57},"in_reply_to":"5f7c97a3_d9194576","updated":"2018-07-27 22:47:36.000000000","message":"Yeah, I dig and know, but see above\n\nIt\u0027s sort of a form of laziness combined with explicitness. The fact that the cleanup happens matters up there, where we want it to be clear, not so much here.\n\nHappy to change it though, if you care.","commit_id":"d48e2cf0191bad7c17b09af8ae5cdb972611a952"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"32eb97d3144265c555bf583a9ad192ef264d6425","unresolved":false,"context_lines":[{"line_number":1755,"context_line":"        # both do some side effects on _set_allocations as well as have the"},{"line_number":1756,"context_line":"        # real behavior. Two generation conflicts and then a success."},{"line_number":1757,"context_line":"        mock_log.reset_mock()"},{"line_number":1758,"context_line":"        with mock.patch.object(rp_obj.AllocationList,"},{"line_number":1759,"context_line":"                               \u0027RP_CONFLICT_RETRY_COUNT\u0027, 3):"},{"line_number":1760,"context_line":"            unmocked_set \u003d functools.partial("},{"line_number":1761,"context_line":"                rp_obj.AllocationList._set_allocations, alloc_list)"},{"line_number":1762,"context_line":"            with mock.patch("},{"line_number":1763,"context_line":"                \u0027nova.api.openstack.placement.objects.resource_provider.\u0027"},{"line_number":1764,"context_line":"                \u0027AllocationList._set_allocations\u0027) as mock_set:"},{"line_number":1765,"context_line":"                exceptions \u003d iter(["},{"line_number":1766,"context_line":"                    exception.ResourceProviderConcurrentUpdateDetected(),"},{"line_number":1767,"context_line":"                    exception.ResourceProviderConcurrentUpdateDetected(),"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_82cec055","line":1764,"range":{"start_line":1758,"start_character":0,"end_line":1764,"end_character":63},"updated":"2018-07-31 13:54:16.000000000","message":"FYI, if nesting `with` statements bothers you, since py27 you\u0027re allowed to combine them [1]. Unfortunately the formatting sucks - parens don\u0027t work, you have to use backslashes - but it\u0027s there.\n\n[1] https://stackoverflow.com/questions/893333/multiple-variables-in-python-with-statement","commit_id":"72e4c4c8d7fb146862b899337626485dad10f15b"}]}
