)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"1e80d049c023ca5089c0c4a056d97ba48253cdd0","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"* None of the objects involved here need a context member. Wherever"},{"line_number":29,"context_line":"  context is used it is supplied by the callers."},{"line_number":30,"context_line":"* Type checking is gone. In this particular context it should matter:"},{"line_number":31,"context_line":"  there\u0027s no external interface to these objects. An argument could"},{"line_number":32,"context_line":"  be made that the type checking is of use to developers, but we have"},{"line_number":33,"context_line":"  type checking at both the DB and HTTP API levels (and tests, of"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9fdfeff1_4728e0e0","line":30,"range":{"start_line":30,"start_character":55,"end_line":30,"end_character":61},"updated":"2019-02-13 23:31:53.000000000","message":"shouldn\u0027t?","commit_id":"2b96a2c4179f278c8e5b38e084a0618e6d8320c2"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"718bc896ab05fb2b1149476a15e4b0795d97adb9","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Chris Dent \u003ccdent@anticdent.org\u003e"},{"line_number":5,"context_line":"CommitDate: 2019-02-14 12:27:50 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"DNM: Don\u0027t use OVO with allocation candidates"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"I did some fairly basic benchmarking a while back which indicated"},{"line_number":10,"context_line":"that apart from time spent in the database, the value coercing"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_cf14d046","line":7,"range":{"start_line":7,"start_character":0,"end_line":7,"end_character":5},"updated":"2019-02-14 20:44:30.000000000","message":"If you\u0027re going to block with a -2, get rid of this so we can approve it without having to worry about quibbles in the commit message.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"718bc896ab05fb2b1149476a15e4b0795d97adb9","unresolved":false,"context_lines":[{"line_number":22,"context_line":"* Is more maintainable"},{"line_number":23,"context_line":"* Doesn\u0027t remove functionality"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"Don\u0027t know yet, this is just an experiment."},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"Things to watch out for/question/be aware of:"},{"line_number":28,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_8fc7a864","line":25,"range":{"start_line":25,"start_character":0,"end_line":25,"end_character":43},"updated":"2019-02-14 20:44:30.000000000","message":"I think you can update this now, yah?","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"b212d65a254702c71cac11d76cf5191848986440","unresolved":false,"context_lines":[{"line_number":22,"context_line":"* Is more maintainable"},{"line_number":23,"context_line":"* Doesn\u0027t remove functionality"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"Don\u0027t know yet, this is just an experiment."},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"Things to watch out for/question/be aware of:"},{"line_number":28,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_2f855c07","line":25,"range":{"start_line":25,"start_character":0,"end_line":25,"end_character":43},"in_reply_to":"9fdfeff1_8fc7a864","updated":"2019-02-14 20:59:46.000000000","message":"\u0027xpect so","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"718bc896ab05fb2b1149476a15e4b0795d97adb9","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"* None of the objects involved here need a context member. Wherever"},{"line_number":30,"context_line":"  context is used it is supplied by the callers."},{"line_number":31,"context_line":"* Type checking is gone. In this particular context it shouldn\u0027tx"},{"line_number":32,"context_line":"  normally matter: there\u0027s no external interface to these objects."},{"line_number":33,"context_line":"  An argument could be made that the type checking is of use to"},{"line_number":34,"context_line":"  developers, but we have type checking at both the DB and HTTP"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_4f2a207f","line":31,"range":{"start_line":31,"start_character":64,"end_line":31,"end_character":65},"updated":"2019-02-14 20:44:30.000000000","message":":)","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"b212d65a254702c71cac11d76cf5191848986440","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"* None of the objects involved here need a context member. Wherever"},{"line_number":30,"context_line":"  context is used it is supplied by the callers."},{"line_number":31,"context_line":"* Type checking is gone. In this particular context it shouldn\u0027tx"},{"line_number":32,"context_line":"  normally matter: there\u0027s no external interface to these objects."},{"line_number":33,"context_line":"  An argument could be made that the type checking is of use to"},{"line_number":34,"context_line":"  developers, but we have type checking at both the DB and HTTP"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_cf7ff012","line":31,"range":{"start_line":31,"start_character":64,"end_line":31,"end_character":65},"in_reply_to":"9fdfeff1_4f2a207f","updated":"2019-02-14 20:59:46.000000000","message":"crikey trevor","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"718bc896ab05fb2b1149476a15e4b0795d97adb9","unresolved":false,"context_lines":[{"line_number":42,"context_line":"  for the \u0027used\u0027 value that shows up in allocation candidate"},{"line_number":43,"context_line":"  results. Note that this problem doesn\u0027t show up in functional"},{"line_number":44,"context_line":"  tests, just tempest and grenade, because it needs MySQL to"},{"line_number":45,"context_line":"  happen."},{"line_number":46,"context_line":"* If we wanted to do, this could go further, to named tuples, attrs,"},{"line_number":47,"context_line":"  a superclass which does the field management, but so far that seems"},{"line_number":48,"context_line":"  overkill for the classes changed thus far."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_afb86c10","line":45,"updated":"2019-02-14 20:44:30.000000000","message":"I\u0027m good with these coercions being explicit, though I agree it\u0027s a bit ooky that it took MySQL to flush this one out.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"718bc896ab05fb2b1149476a15e4b0795d97adb9","unresolved":false,"context_lines":[{"line_number":43,"context_line":"  results. Note that this problem doesn\u0027t show up in functional"},{"line_number":44,"context_line":"  tests, just tempest and grenade, because it needs MySQL to"},{"line_number":45,"context_line":"  happen."},{"line_number":46,"context_line":"* If we wanted to do, this could go further, to named tuples, attrs,"},{"line_number":47,"context_line":"  a superclass which does the field management, but so far that seems"},{"line_number":48,"context_line":"  overkill for the classes changed thus far."},{"line_number":49,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_8f48085c","line":46,"range":{"start_line":46,"start_character":62,"end_line":46,"end_character":67},"updated":"2019-02-14 20:44:30.000000000","message":"?\n\nIsn\u0027t this what you\u0027re doing in this series?","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3108920b6e4788670880cb75dffd290b3634309c","unresolved":false,"context_lines":[{"line_number":43,"context_line":"  results. Note that this problem doesn\u0027t show up in functional"},{"line_number":44,"context_line":"  tests, just tempest and grenade, because it needs MySQL to"},{"line_number":45,"context_line":"  happen."},{"line_number":46,"context_line":"* If we wanted to do, this could go further, to named tuples, attrs,"},{"line_number":47,"context_line":"  a superclass which does the field management, but so far that seems"},{"line_number":48,"context_line":"  overkill for the classes changed thus far."},{"line_number":49,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_2a478a79","line":46,"range":{"start_line":46,"start_character":62,"end_line":46,"end_character":67},"in_reply_to":"9fdfeff1_0f97383c","updated":"2019-02-14 22:28:05.000000000","message":"Ah, I didn\u0027t know about \u0027attrs\u0027. Does that bring with it the danger of reinstating overhead we don\u0027t need?\n\nAs you say, let\u0027s not bother.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"b212d65a254702c71cac11d76cf5191848986440","unresolved":false,"context_lines":[{"line_number":43,"context_line":"  results. Note that this problem doesn\u0027t show up in functional"},{"line_number":44,"context_line":"  tests, just tempest and grenade, because it needs MySQL to"},{"line_number":45,"context_line":"  happen."},{"line_number":46,"context_line":"* If we wanted to do, this could go further, to named tuples, attrs,"},{"line_number":47,"context_line":"  a superclass which does the field management, but so far that seems"},{"line_number":48,"context_line":"  overkill for the classes changed thus far."},{"line_number":49,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9fdfeff1_0f97383c","line":46,"range":{"start_line":46,"start_character":62,"end_line":46,"end_character":67},"in_reply_to":"9fdfeff1_8f48085c","updated":"2019-02-14 20:59:46.000000000","message":"I mean that instead of making the classes be\n\n    class Foo(object):\n\nthey could instead be named tuples, or https://pypi.org/project/attrs/\n\nBut as I say that would be overkill.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"}],"placement/objects/resource_provider.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"718bc896ab05fb2b1149476a15e4b0795d97adb9","unresolved":false,"context_lines":[{"line_number":2716,"context_line":"        # Whether all AllocationRequestResources in this AllocationRequest are"},{"line_number":2717,"context_line":"        # required to be satisfied by the same provider (based on the"},{"line_number":2718,"context_line":"        # corresponding RequestGroup\u0027s use_same_provider attribute). Internal"},{"line_number":2719,"context_line":"        # use only, not included when the object is serialized for output."},{"line_number":2720,"context_line":"        self.use_same_provider \u003d use_same_provider"},{"line_number":2721,"context_line":"        self.resource_requests \u003d resource_requests or []"},{"line_number":2722,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_4f9d40ba","line":2719,"range":{"start_line":2719,"start_character":20,"end_line":2719,"end_character":74},"updated":"2019-02-14 20:44:30.000000000","message":"yet, mwahaha","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"718bc896ab05fb2b1149476a15e4b0795d97adb9","unresolved":false,"context_lines":[{"line_number":2723,"context_line":"    def __repr__(self):"},{"line_number":2724,"context_line":"        anchor \u003d (self.anchor_root_provider_uuid[-8:]"},{"line_number":2725,"context_line":"                  if self.anchor_root_provider_uuid else \u0027\u003c?\u003e\u0027)"},{"line_number":2726,"context_line":"        usp \u003d self.use_same_provider if self.use_same_provider else \u0027\u003c?\u003e\u0027"},{"line_number":2727,"context_line":"        repr_str \u003d (\u0027%s(anchor\u003d...%s, same_provider\u003d%s, \u0027"},{"line_number":2728,"context_line":"                    \u0027resource_requests\u003d[%s])\u0027 %"},{"line_number":2729,"context_line":"                    (self.__class__.__name__, anchor, usp,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_2f7f9c66","line":2726,"range":{"start_line":2726,"start_character":40,"end_line":2726,"end_character":62},"updated":"2019-02-14 20:44:30.000000000","message":"...is not None","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"833d719033fce39d2ce4d3160b4ba2a35b40c111","unresolved":false,"context_lines":[{"line_number":2723,"context_line":"    def __repr__(self):"},{"line_number":2724,"context_line":"        anchor \u003d (self.anchor_root_provider_uuid[-8:]"},{"line_number":2725,"context_line":"                  if self.anchor_root_provider_uuid else \u0027\u003c?\u003e\u0027)"},{"line_number":2726,"context_line":"        usp \u003d self.use_same_provider if self.use_same_provider else \u0027\u003c?\u003e\u0027"},{"line_number":2727,"context_line":"        repr_str \u003d (\u0027%s(anchor\u003d...%s, same_provider\u003d%s, \u0027"},{"line_number":2728,"context_line":"                    \u0027resource_requests\u003d[%s])\u0027 %"},{"line_number":2729,"context_line":"                    (self.__class__.__name__, anchor, usp,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_53d718c0","line":2726,"range":{"start_line":2726,"start_character":40,"end_line":2726,"end_character":62},"in_reply_to":"9fdfeff1_0555d9f9","updated":"2019-02-15 17:23:34.000000000","message":"Done","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"b212d65a254702c71cac11d76cf5191848986440","unresolved":false,"context_lines":[{"line_number":2723,"context_line":"    def __repr__(self):"},{"line_number":2724,"context_line":"        anchor \u003d (self.anchor_root_provider_uuid[-8:]"},{"line_number":2725,"context_line":"                  if self.anchor_root_provider_uuid else \u0027\u003c?\u003e\u0027)"},{"line_number":2726,"context_line":"        usp \u003d self.use_same_provider if self.use_same_provider else \u0027\u003c?\u003e\u0027"},{"line_number":2727,"context_line":"        repr_str \u003d (\u0027%s(anchor\u003d...%s, same_provider\u003d%s, \u0027"},{"line_number":2728,"context_line":"                    \u0027resource_requests\u003d[%s])\u0027 %"},{"line_number":2729,"context_line":"                    (self.__class__.__name__, anchor, usp,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_8fd8081e","line":2726,"range":{"start_line":2726,"start_character":40,"end_line":2726,"end_character":62},"in_reply_to":"9fdfeff1_2f7f9c66","updated":"2019-02-14 20:59:46.000000000","message":"yeah there\u0027s quite a few places where that\u0027s relevant. I\u0027m not sure I got them all\n\nAnother option is to \u0027or False\u0027 in __init__\u0027s body, or \u003dFalse in the signature.\n\nMy \"not really too sure\" on those kinds of things is why I think a close review of the whole stack is important.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3108920b6e4788670880cb75dffd290b3634309c","unresolved":false,"context_lines":[{"line_number":2723,"context_line":"    def __repr__(self):"},{"line_number":2724,"context_line":"        anchor \u003d (self.anchor_root_provider_uuid[-8:]"},{"line_number":2725,"context_line":"                  if self.anchor_root_provider_uuid else \u0027\u003c?\u003e\u0027)"},{"line_number":2726,"context_line":"        usp \u003d self.use_same_provider if self.use_same_provider else \u0027\u003c?\u003e\u0027"},{"line_number":2727,"context_line":"        repr_str \u003d (\u0027%s(anchor\u003d...%s, same_provider\u003d%s, \u0027"},{"line_number":2728,"context_line":"                    \u0027resource_requests\u003d[%s])\u0027 %"},{"line_number":2729,"context_line":"                    (self.__class__.__name__, anchor, usp,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_0555d9f9","line":2726,"range":{"start_line":2726,"start_character":40,"end_line":2726,"end_character":62},"in_reply_to":"9fdfeff1_8fd8081e","updated":"2019-02-14 22:28:05.000000000","message":"\u003e yeah there\u0027s quite a few places where that\u0027s relevant. I\u0027m not sure\n \u003e I got them all\n\nI\u0027ll keep an eye out. This is the only one I noticed in this patch.\n\n \u003e Another option is to \u0027or False\u0027 in __init__\u0027s body, or \u003dFalse in\n \u003e the signature.\n\nWell, no, I think those are behavior changes too. We may want to do those kinds of refactors later, but outside of this series. IMO this series should focus on exact parity as much as possible.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"718bc896ab05fb2b1149476a15e4b0795d97adb9","unresolved":false,"context_lines":[{"line_number":3405,"context_line":"        rpsr \u003d ProviderSummaryResource("},{"line_number":3406,"context_line":"            resource_class\u003drc_name,"},{"line_number":3407,"context_line":"            capacity\u003dcap,"},{"line_number":3408,"context_line":"            # FIXME(cdent): This might be a decimal"},{"line_number":3409,"context_line":"            used\u003dint(used),"},{"line_number":3410,"context_line":"            max_unit\u003dusage[\u0027max_unit\u0027],"},{"line_number":3411,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_6fc12454","line":3408,"range":{"start_line":3408,"start_character":12,"end_line":3408,"end_character":51},"updated":"2019-02-14 20:44:30.000000000","message":"You mean not an integer? I don\u0027t think so.\n\nThe ovo field was a NonNegativeInteger, which was coercing this to int(), so at worst this is backward compatible.\n\nBut the db field is defined as Integer as well, and the only operation we\u0027re ever doing on it is sum().\n\nSo I don\u0027t think there\u0027s anything to fix here.\n\nYou could change your comment to note that we have to coerce this because of weird db engine behavior. And I would also put the coercion in the ProviderSummaryResource class itself, so we don\u0027t have to worry about future usages (so to speak).","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"833d719033fce39d2ce4d3160b4ba2a35b40c111","unresolved":false,"context_lines":[{"line_number":3405,"context_line":"        rpsr \u003d ProviderSummaryResource("},{"line_number":3406,"context_line":"            resource_class\u003drc_name,"},{"line_number":3407,"context_line":"            capacity\u003dcap,"},{"line_number":3408,"context_line":"            # FIXME(cdent): This might be a decimal"},{"line_number":3409,"context_line":"            used\u003dint(used),"},{"line_number":3410,"context_line":"            max_unit\u003dusage[\u0027max_unit\u0027],"},{"line_number":3411,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_13f6705e","line":3408,"range":{"start_line":3408,"start_character":12,"end_line":3408,"end_character":51},"in_reply_to":"9fdfeff1_053f1987","updated":"2019-02-15 17:23:34.000000000","message":"BTW: The difference with the other queries is that they do not send output to JSON.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3108920b6e4788670880cb75dffd290b3634309c","unresolved":false,"context_lines":[{"line_number":3405,"context_line":"        rpsr \u003d ProviderSummaryResource("},{"line_number":3406,"context_line":"            resource_class\u003drc_name,"},{"line_number":3407,"context_line":"            capacity\u003dcap,"},{"line_number":3408,"context_line":"            # FIXME(cdent): This might be a decimal"},{"line_number":3409,"context_line":"            used\u003dint(used),"},{"line_number":3410,"context_line":"            max_unit\u003dusage[\u0027max_unit\u0027],"},{"line_number":3411,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_053f1987","line":3408,"range":{"start_line":3408,"start_character":12,"end_line":3408,"end_character":51},"in_reply_to":"9fdfeff1_0f5ad881","updated":"2019-02-14 22:28:05.000000000","message":"\u003e I don\u0027t know what you mean by \"I don\u0027t think so\".\n\nBecause the database field is Integer and the only thing we\u0027re doing to it is sum(), which will only ever give us an integer, mysql-returned datatype notwithstanding. I.e. casting to int() should be 100% safe.\n\n \u003e In mysql \u0027used\u0027\n \u003e comes to us as a Decimal (the class from decimal.Decimal) as a\n \u003e result of there being a func.sum in the query and OVO had been\n \u003e casting that to an int because of the field type.\n\nOkay, I get why sum(whatever) would just always return a decimal, but it wouldn\u0027t be unreasonable to expect sum(all integers) to return an integer.\n\n \u003e I\u0027m not inclined to be paranoid about this in the class. I want us\n \u003e to be paranoid at the source of the data, so either here or in the\n \u003e query itself.\n\nOkay, I could buy doing it in the query methods, but there\u0027s a bunch of those. I was looking for a single place we could control this, knowing it\u0027s an issue. (Yes, this is a single place right now, but what\u0027s to stop the next guy from reintroducing the bug?)","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"b212d65a254702c71cac11d76cf5191848986440","unresolved":false,"context_lines":[{"line_number":3405,"context_line":"        rpsr \u003d ProviderSummaryResource("},{"line_number":3406,"context_line":"            resource_class\u003drc_name,"},{"line_number":3407,"context_line":"            capacity\u003dcap,"},{"line_number":3408,"context_line":"            # FIXME(cdent): This might be a decimal"},{"line_number":3409,"context_line":"            used\u003dint(used),"},{"line_number":3410,"context_line":"            max_unit\u003dusage[\u0027max_unit\u0027],"},{"line_number":3411,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_0f5ad881","line":3408,"range":{"start_line":3408,"start_character":12,"end_line":3408,"end_character":51},"in_reply_to":"9fdfeff1_6f8fe429","updated":"2019-02-14 20:59:46.000000000","message":"I don\u0027t know what you mean by \"I don\u0027t think so\". In mysql \u0027used\u0027 comes to us as a Decimal (the class from decimal.Decimal) as a result of there being a func.sum in the query and OVO had been casting that to an int because of the field type.\n\nNone us knew mysql was doing that because OVO was \"handling it\".\n\nI\u0027m not inclined to be paranoid about this in the class. I want us to be paranoid at the source of the data, so either here or in the query itself.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"0cd36bffda9898ebaaa6ee10221a3d57adb85e10","unresolved":false,"context_lines":[{"line_number":3405,"context_line":"        rpsr \u003d ProviderSummaryResource("},{"line_number":3406,"context_line":"            resource_class\u003drc_name,"},{"line_number":3407,"context_line":"            capacity\u003dcap,"},{"line_number":3408,"context_line":"            # FIXME(cdent): This might be a decimal"},{"line_number":3409,"context_line":"            used\u003dint(used),"},{"line_number":3410,"context_line":"            max_unit\u003dusage[\u0027max_unit\u0027],"},{"line_number":3411,"context_line":"        )"}],"source_content_type":"text/x-python","patch_set":4,"id":"9fdfeff1_6f8fe429","line":3408,"range":{"start_line":3408,"start_character":12,"end_line":3408,"end_character":51},"in_reply_to":"9fdfeff1_6fc12454","updated":"2019-02-14 20:47:20.000000000","message":"\u003e You could change your comment to note that we have to coerce this\n \u003e because of weird db engine behavior. And I would also put the\n \u003e coercion in the ProviderSummaryResource class itself, so we don\u0027t\n \u003e have to worry about future usages (so to speak).\n\nIf you wanted to be paranoid about this, you could make ProviderSummaryResource._usage private and add @property setter and getter methods to ensure the coercion happens even when the field is set outside of __init__. Then the \"weird db behavior\" note could be in the docstring of the setter.","commit_id":"cdb14e5f6564af3e8ab69a1eec134879a9b87f10"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f9a2808abf01cf1ec1606001b29fe2353b529684","unresolved":false,"context_lines":[{"line_number":3399,"context_line":"            continue"},{"line_number":3400,"context_line":"        # NOTE(jaypipes): usage[\u0027used\u0027] may be None due to the LEFT JOIN of"},{"line_number":3401,"context_line":"        # the usages subquery, so we coerce NULL values to 0 here. It may"},{"line_number":3402,"context_line":"        # also be a Decimal, as that\u0027s the type that mysql tends to return"},{"line_number":3403,"context_line":"        # when func.sum is used in a query. We need an int, otherwise later"},{"line_number":3404,"context_line":"        # JSON serialization will not work."},{"line_number":3405,"context_line":"        used \u003d int(usage[\u0027used\u0027] or 0)"}],"source_content_type":"text/x-python","patch_set":5,"id":"9fdfeff1_c22d598f","line":3402,"range":{"start_line":3402,"start_character":53,"end_line":3402,"end_character":58},"updated":"2019-02-18 11:54:09.000000000","message":"tis it only MySQL, or is this for all RDBMS?","commit_id":"b54733af92e94e1b29448662f426dda50331662e"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"f19f08257eb9a03ed7392894e6107f4d920cda1c","unresolved":false,"context_lines":[{"line_number":3399,"context_line":"            continue"},{"line_number":3400,"context_line":"        # NOTE(jaypipes): usage[\u0027used\u0027] may be None due to the LEFT JOIN of"},{"line_number":3401,"context_line":"        # the usages subquery, so we coerce NULL values to 0 here. It may"},{"line_number":3402,"context_line":"        # also be a Decimal, as that\u0027s the type that mysql tends to return"},{"line_number":3403,"context_line":"        # when func.sum is used in a query. We need an int, otherwise later"},{"line_number":3404,"context_line":"        # JSON serialization will not work."},{"line_number":3405,"context_line":"        used \u003d int(usage[\u0027used\u0027] or 0)"}],"source_content_type":"text/x-python","patch_set":5,"id":"9fdfeff1_02e36106","line":3402,"range":{"start_line":3402,"start_character":53,"end_line":3402,"end_character":58},"in_reply_to":"9fdfeff1_c22d598f","updated":"2019-02-18 12:09:20.000000000","message":"Insufficient data. Based on my scrubbing round the internet, it seems to be at least mysql, definitely not sqlite, but not clear on postgresql.","commit_id":"b54733af92e94e1b29448662f426dda50331662e"}]}
