)]}'
{"nova/objects/instance.py":[{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"7a8e58880e52ef6a99c901bd784d7b816ee24e38","unresolved":false,"context_lines":[{"line_number":1164,"context_line":"    @base.remotable_classmethod"},{"line_number":1165,"context_line":"    def get_all(cls, context, expected_attrs\u003dNone):"},{"line_number":1166,"context_line":"        \"\"\"Returns all instances on all nodes.\"\"\""},{"line_number":1167,"context_line":"        db_instances \u003d db.instance_get_all(context)"},{"line_number":1168,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1169,"context_line":"                                   expected_attrs)"},{"line_number":1170,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_90a4b558","line":1167,"updated":"2015-03-04 10:07:19.000000000","message":"What is the range of instances can be expected here ?","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"83120a69c550b9aa512b1ace0f55a7939f098068","unresolved":false,"context_lines":[{"line_number":1164,"context_line":"    @base.remotable_classmethod"},{"line_number":1165,"context_line":"    def get_all(cls, context, expected_attrs\u003dNone):"},{"line_number":1166,"context_line":"        \"\"\"Returns all instances on all nodes.\"\"\""},{"line_number":1167,"context_line":"        db_instances \u003d db.instance_get_all(context)"},{"line_number":1168,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1169,"context_line":"                                   expected_attrs)"},{"line_number":1170,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_d971f178","line":1167,"in_reply_to":"9a80dd14_90a4b558","updated":"2015-03-04 13:40:28.000000000","message":"It would be the total number of instances that nova knows about. Yes, it could be very large.","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"7a8e58880e52ef6a99c901bd784d7b816ee24e38","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"        \"\"\"Returns the Instance object whose uuid matches the specified value,"},{"line_number":1260,"context_line":"        or None if there is no match."},{"line_number":1261,"context_line":"        \"\"\""},{"line_number":1262,"context_line":"        inst_list \u003d [inst for inst in self.objects if inst.uuid \u003d\u003d uuid]"},{"line_number":1263,"context_line":"        return inst_list[0] if inst_list else None"},{"line_number":1264,"context_line":""},{"line_number":1265,"context_line":"    def pop_by_uuid(self, uuid):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_50f31d73","line":1262,"updated":"2015-03-04 10:07:19.000000000","message":"how may instances here ? where this method will be used ? can we use a map or sort the list by uuid to use a binary search here?","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"ef2e600d9f4f207220c1a4a71ee102ad7743ea56","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"        \"\"\"Returns the Instance object whose uuid matches the specified value,"},{"line_number":1260,"context_line":"        or None if there is no match."},{"line_number":1261,"context_line":"        \"\"\""},{"line_number":1262,"context_line":"        inst_list \u003d [inst for inst in self.objects if inst.uuid \u003d\u003d uuid]"},{"line_number":1263,"context_line":"        return inst_list[0] if inst_list else None"},{"line_number":1264,"context_line":""},{"line_number":1265,"context_line":"    def pop_by_uuid(self, uuid):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_6c2baa94","line":1262,"in_reply_to":"9a80dd14_32475b21","updated":"2015-03-05 13:43:05.000000000","message":"OK, I discussed this with Dan Smith on IRC and he was fine with the idea, but I\u0027ll remove these methods.","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"d68551e40669ad53c0cd98549b7c9c41b8f69f16","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"        \"\"\"Returns the Instance object whose uuid matches the specified value,"},{"line_number":1260,"context_line":"        or None if there is no match."},{"line_number":1261,"context_line":"        \"\"\""},{"line_number":1262,"context_line":"        inst_list \u003d [inst for inst in self.objects if inst.uuid \u003d\u003d uuid]"},{"line_number":1263,"context_line":"        return inst_list[0] if inst_list else None"},{"line_number":1264,"context_line":""},{"line_number":1265,"context_line":"    def pop_by_uuid(self, uuid):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_32475b21","line":1262,"in_reply_to":"9a80dd14_4cf28a9b","updated":"2015-03-05 08:03:38.000000000","message":"I actually agree with Sahid on his point about O(n) vs. O(1) performance. That said, I don\u0027t actually believe these two methods belong on the InstanceList object itself. I would prefer to see methods in the scheduler\u0027s HostStateManager that maintains a hashmap of uuid -\u003e Instance objects and pops/gets Instance objects from that hashmap. I don\u0027t believe these methods should be on the InstanceList object here.","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"83120a69c550b9aa512b1ace0f55a7939f098068","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"        \"\"\"Returns the Instance object whose uuid matches the specified value,"},{"line_number":1260,"context_line":"        or None if there is no match."},{"line_number":1261,"context_line":"        \"\"\""},{"line_number":1262,"context_line":"        inst_list \u003d [inst for inst in self.objects if inst.uuid \u003d\u003d uuid]"},{"line_number":1263,"context_line":"        return inst_list[0] if inst_list else None"},{"line_number":1264,"context_line":""},{"line_number":1265,"context_line":"    def pop_by_uuid(self, uuid):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_79d80554","line":1262,"in_reply_to":"9a80dd14_50f31d73","updated":"2015-03-04 13:40:28.000000000","message":"This searches within the InstanceList object itself. In the use case this and the pop_by_uuid are written for, it will be to update the InstanceList for a host based on changes in compute.","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"0b75c008ec26411587b90942c2452d00e5d98d5f","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"        \"\"\"Returns the Instance object whose uuid matches the specified value,"},{"line_number":1260,"context_line":"        or None if there is no match."},{"line_number":1261,"context_line":"        \"\"\""},{"line_number":1262,"context_line":"        inst_list \u003d [inst for inst in self.objects if inst.uuid \u003d\u003d uuid]"},{"line_number":1263,"context_line":"        return inst_list[0] if inst_list else None"},{"line_number":1264,"context_line":""},{"line_number":1265,"context_line":"    def pop_by_uuid(self, uuid):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_9c8207ff","line":1262,"in_reply_to":"9a80dd14_79d80554","updated":"2015-03-04 14:27:58.000000000","message":"We can easily make this O(n) algorithm to a O(1) by maintaining a map here. I do not believe it will be efficient to parse that list each time we need to match uuid.","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"c8f89f1038a0b60259fa80f84d55374151c75888","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"        \"\"\"Returns the Instance object whose uuid matches the specified value,"},{"line_number":1260,"context_line":"        or None if there is no match."},{"line_number":1261,"context_line":"        \"\"\""},{"line_number":1262,"context_line":"        inst_list \u003d [inst for inst in self.objects if inst.uuid \u003d\u003d uuid]"},{"line_number":1263,"context_line":"        return inst_list[0] if inst_list else None"},{"line_number":1264,"context_line":""},{"line_number":1265,"context_line":"    def pop_by_uuid(self, uuid):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_ff2135b5","line":1262,"in_reply_to":"9a80dd14_9c8207ff","updated":"2015-03-04 14:45:37.000000000","message":"The objects attribute can be manipulated directly; it is a simple list. To do what you suggest would require a change to the ObjectListBase class to forbid direct manipulation of the objects list, and only allow adding or removing objects via accessor methods that would maintain that map.\n\nI also feel that this is extremely premature optimization. List comprehensions are highly optimized, and this will certainly not be a bottleneck in the process.","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"4accfed61436ff23a4bfdb9dd2ff3db64ae208e8","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"        \"\"\"Returns the Instance object whose uuid matches the specified value,"},{"line_number":1260,"context_line":"        or None if there is no match."},{"line_number":1261,"context_line":"        \"\"\""},{"line_number":1262,"context_line":"        inst_list \u003d [inst for inst in self.objects if inst.uuid \u003d\u003d uuid]"},{"line_number":1263,"context_line":"        return inst_list[0] if inst_list else None"},{"line_number":1264,"context_line":""},{"line_number":1265,"context_line":"    def pop_by_uuid(self, uuid):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_4cf28a9b","line":1262,"in_reply_to":"9a80dd14_a8a4e557","updated":"2015-03-04 22:09:47.000000000","message":"This is a perfect use case for list comprehensions. You are not proposing a better alogrithm; you are proposing changing the nature of the ObjectListBase class itself, which would affect every place in nova that uses objects. If we have to maintain a map of all key values in all ObjectList classes, this complicates the code tremendously. I strongly prefer to leave the `objects` attribute as a simple list.","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"911dea4efab7376dfa1b8f80a9ba62e8f7a0abb7","unresolved":false,"context_lines":[{"line_number":1259,"context_line":"        \"\"\"Returns the Instance object whose uuid matches the specified value,"},{"line_number":1260,"context_line":"        or None if there is no match."},{"line_number":1261,"context_line":"        \"\"\""},{"line_number":1262,"context_line":"        inst_list \u003d [inst for inst in self.objects if inst.uuid \u003d\u003d uuid]"},{"line_number":1263,"context_line":"        return inst_list[0] if inst_list else None"},{"line_number":1264,"context_line":""},{"line_number":1265,"context_line":"    def pop_by_uuid(self, uuid):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a80dd14_a8a4e557","line":1262,"in_reply_to":"9a80dd14_ff2135b5","updated":"2015-03-04 15:40:43.000000000","message":"What do you mean by \"List comprehensions are highly optimized\" for this case ? - I don\u0027t think we can call my suggestion an optimization, we are trying to use good algorithms for cases by giving advises and ideas. What you are trying to make merged is something no viable at all since it\u0027s a O(n) algorithm with n something can grow up a lot.","commit_id":"fc924db3ba9c08920435827de008306ab759027b"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"93f7921eda2e2153cac58d69cddd13a21dcb3485","unresolved":false,"context_lines":[{"line_number":1157,"context_line":""},{"line_number":1158,"context_line":"    @base.remotable_classmethod"},{"line_number":1159,"context_line":"    def get_all(cls, context, expected_attrs\u003dNone):"},{"line_number":1160,"context_line":"        \"\"\"Returns all instances on all nodes.\"\"\""},{"line_number":1161,"context_line":"        db_instances \u003d db.instance_get_all(context)"},{"line_number":1162,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1163,"context_line":"                                   expected_attrs)"}],"source_content_type":"text/x-python","patch_set":8,"id":"9a80dd14_9685f608","line":1160,"updated":"2015-03-06 22:14:44.000000000","message":"Technically this returns all non-deleted instances on all nodes, but OK :)","commit_id":"432b6d9183c329de6ee37bfc9bca408e19e99f9f"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"8283db4e84d47ee2ad2acbad376649253548733c","unresolved":false,"context_lines":[{"line_number":1157,"context_line":""},{"line_number":1158,"context_line":"    @base.remotable_classmethod"},{"line_number":1159,"context_line":"    def get_all(cls, context, expected_attrs\u003dNone):"},{"line_number":1160,"context_line":"        \"\"\"Returns all instances on all nodes.\"\"\""},{"line_number":1161,"context_line":"        db_instances \u003d db.instance_get_all(context)"},{"line_number":1162,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1163,"context_line":"                                   expected_attrs)"}],"source_content_type":"text/x-python","patch_set":8,"id":"9a80dd14_82c0e2e1","line":1160,"in_reply_to":"9a80dd14_9685f608","updated":"2015-03-10 20:09:05.000000000","message":"It will return deleted instances if you pass a context with read_deleted\u003dyes.","commit_id":"432b6d9183c329de6ee37bfc9bca408e19e99f9f"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"69fd85da2e308ee194d9159a9c3a0690430bb7bc","unresolved":false,"context_lines":[{"line_number":1087,"context_line":"    # Version 1.13: Instance \u003c\u003d version 1.17"},{"line_number":1088,"context_line":"    # Version 1.14: Instance \u003c\u003d version 1.18"},{"line_number":1089,"context_line":"    # Version 1.15: Instance \u003c\u003d version 1.19"},{"line_number":1090,"context_line":"    # Version 1.16: Added get_all(), find_by_uuid(), and pop_by_uuid() methods"},{"line_number":1091,"context_line":"    VERSION \u003d \u00271.16\u0027"},{"line_number":1092,"context_line":""},{"line_number":1093,"context_line":"    fields \u003d {"}],"source_content_type":"text/x-python","patch_set":9,"id":"9a80dd14_06446bb5","line":1090,"updated":"2015-03-07 18:51:51.000000000","message":"I only see get_all() being added below.","commit_id":"9d04ff9f8707264d81eb3843b557148915baceb1"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"d42b3120a8d9f853902fb935a6d5a7c833f74644","unresolved":false,"context_lines":[{"line_number":1087,"context_line":"    # Version 1.13: Instance \u003c\u003d version 1.17"},{"line_number":1088,"context_line":"    # Version 1.14: Instance \u003c\u003d version 1.18"},{"line_number":1089,"context_line":"    # Version 1.15: Instance \u003c\u003d version 1.19"},{"line_number":1090,"context_line":"    # Version 1.16: Added get_all(), find_by_uuid(), and pop_by_uuid() methods"},{"line_number":1091,"context_line":"    VERSION \u003d \u00271.16\u0027"},{"line_number":1092,"context_line":""},{"line_number":1093,"context_line":"    fields \u003d {"}],"source_content_type":"text/x-python","patch_set":9,"id":"9a80dd14_7428569a","line":1090,"in_reply_to":"9a80dd14_06446bb5","updated":"2015-03-09 15:43:35.000000000","message":"Ah, good catch. The original PS added the other methods to the InstanceList, but others felt it more efficient to add them to the HostManager. Done.","commit_id":"9d04ff9f8707264d81eb3843b557148915baceb1"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"69fd85da2e308ee194d9159a9c3a0690430bb7bc","unresolved":false,"context_lines":[{"line_number":1158,"context_line":"    @base.remotable_classmethod"},{"line_number":1159,"context_line":"    def get_all(cls, context, expected_attrs\u003dNone):"},{"line_number":1160,"context_line":"        \"\"\"Returns all instances on all nodes.\"\"\""},{"line_number":1161,"context_line":"        db_instances \u003d db.instance_get_all(context)"},{"line_number":1162,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1163,"context_line":"                                   expected_attrs)"},{"line_number":1164,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"9a80dd14_461903d6","line":1161,"updated":"2015-03-07 18:51:51.000000000","message":"The db call should pass on the expected_attrs:\n\n  columns_to_join\u003d_expected_cols(expected_attrs)","commit_id":"9d04ff9f8707264d81eb3843b557148915baceb1"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"aac5b15c197a53da7cdb2156031e0d9dc994b1e2","unresolved":false,"context_lines":[{"line_number":1158,"context_line":"    @base.remotable_classmethod"},{"line_number":1159,"context_line":"    def get_all(cls, context, expected_attrs\u003dNone):"},{"line_number":1160,"context_line":"        \"\"\"Returns all instances on all nodes.\"\"\""},{"line_number":1161,"context_line":"        db_instances \u003d db.instance_get_all(context)"},{"line_number":1162,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1163,"context_line":"                                   expected_attrs)"},{"line_number":1164,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"9a80dd14_25feb26b","line":1161,"in_reply_to":"9a80dd14_461903d6","updated":"2015-03-09 09:51:39.000000000","message":"+1 - This is a good optimization to specified columns we want to retrieve from the database.","commit_id":"9d04ff9f8707264d81eb3843b557148915baceb1"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"d42b3120a8d9f853902fb935a6d5a7c833f74644","unresolved":false,"context_lines":[{"line_number":1158,"context_line":"    @base.remotable_classmethod"},{"line_number":1159,"context_line":"    def get_all(cls, context, expected_attrs\u003dNone):"},{"line_number":1160,"context_line":"        \"\"\"Returns all instances on all nodes.\"\"\""},{"line_number":1161,"context_line":"        db_instances \u003d db.instance_get_all(context)"},{"line_number":1162,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1163,"context_line":"                                   expected_attrs)"},{"line_number":1164,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"9a80dd14_940a2a24","line":1161,"in_reply_to":"9a80dd14_461903d6","updated":"2015-03-09 15:43:35.000000000","message":"Done","commit_id":"9d04ff9f8707264d81eb3843b557148915baceb1"},{"author":{"_account_id":7543,"name":"Yongli He","email":"yongli.he@intel.com","username":"yongli.he"},"change_message_id":"0536334427244cb9eb79b235423807ee17092f69","unresolved":false,"context_lines":[{"line_number":1161,"context_line":"    def get_all(cls, context, expected_attrs\u003dNone):"},{"line_number":1162,"context_line":"        \"\"\"Returns all instances on all nodes.\"\"\""},{"line_number":1163,"context_line":"        db_instances \u003d db.instance_get_all("},{"line_number":1164,"context_line":"                context, columns_to_join\u003d_expected_cols(expected_attrs))"},{"line_number":1165,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1166,"context_line":"                                   expected_attrs)"},{"line_number":1167,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"9a80dd14_0a9997c3","line":1164,"updated":"2015-03-10 01:44:19.000000000","message":"suggest vertical align  line break (some one suggest, it\u0027s minor)","commit_id":"4bf4fb916eada6b807e84cc4bca8f4fbbdadb31b"},{"author":{"_account_id":7543,"name":"Yongli He","email":"yongli.he@intel.com","username":"yongli.he"},"change_message_id":"0536334427244cb9eb79b235423807ee17092f69","unresolved":false,"context_lines":[{"line_number":1163,"context_line":"        db_instances \u003d db.instance_get_all("},{"line_number":1164,"context_line":"                context, columns_to_join\u003d_expected_cols(expected_attrs))"},{"line_number":1165,"context_line":"        return _make_instance_list(context, cls(), db_instances,"},{"line_number":1166,"context_line":"                                   expected_attrs)"},{"line_number":1167,"context_line":""},{"line_number":1168,"context_line":"    @base.remotable_classmethod"},{"line_number":1169,"context_line":"    def get_hung_in_rebooting(cls, context, reboot_window,"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a80dd14_ea7e0369","line":1166,"updated":"2015-03-10 01:44:19.000000000","message":"indent.","commit_id":"4bf4fb916eada6b807e84cc4bca8f4fbbdadb31b"}],"nova/tests/unit/objects/test_instance.py":[{"author":{"_account_id":8247,"name":"Thang Pham","email":"thang.g.pham@gmail.com","username":"thang.pham"},"change_message_id":"0d542a9147d69ce5f55905176e9322418b3f3f49","unresolved":false,"context_lines":[{"line_number":1498,"context_line":"        self.assertEqual(len(inst_list.objects), 1)"},{"line_number":1499,"context_line":"        popped \u003d inst_list.pop_by_uuid(\u0027does not exist\u0027)"},{"line_number":1500,"context_line":"        self.assertIsNone(popped)"},{"line_number":1501,"context_line":"        self.assertEqual(len(inst_list.objects), 1)"},{"line_number":1502,"context_line":""},{"line_number":1503,"context_line":""},{"line_number":1504,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"ba7be1f8_6ea1a093","line":1501,"updated":"2015-03-03 01:43:32.000000000","message":"pep8 error: ./nova/tests/unit/objects/test_instance.py:1505:1: E303 too many blank lines (3)","commit_id":"0b7dbd99c358e4ba03dd1971b6ef7f411888ef66"}]}
