)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"e84f838280f26be7b7ede60da8c6f3ad9788d211","unresolved":false,"context_lines":[{"line_number":5,"context_line":"CommitDate: 2019-06-28 14:58:29 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Reduce the query time of the instances when call get_instance_list()"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I797ad934a0f8496dbcbf65798e28b0443f238137"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9fb8cfa7_1a08d28f","line":8,"updated":"2019-06-28 18:07:33.000000000","message":"I\u0027ve reported a bug for this we can use:\n\nhttps://bugs.launchpad.net/watcher/+bug/1834679","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"9e2a80f2daba7140aacb128e010114e3b2ae5fc5","unresolved":false,"context_lines":[{"line_number":5,"context_line":"CommitDate: 2019-06-28 14:58:29 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Reduce the query time of the instances when call get_instance_list()"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I797ad934a0f8496dbcbf65798e28b0443f238137"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9fb8cfa7_69dd8adb","line":8,"in_reply_to":"9fb8cfa7_1a08d28f","updated":"2019-06-29 02:53:23.000000000","message":"Done","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"b44111cb6e1f213649f9e3a30c93cf3e8f96415c","unresolved":false,"context_lines":[{"line_number":5,"context_line":"CommitDate: 2019-06-28 14:58:29 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Reduce the query time of the instances when call get_instance_list()"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I797ad934a0f8496dbcbf65798e28b0443f238137"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9fb8cfa7_a97aa220","line":8,"in_reply_to":"9fb8cfa7_1a08d28f","updated":"2019-06-29 01:40:33.000000000","message":"I will update this.","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f3b7da7137c9a5e077e4c262afc221ba264dc4e1","unresolved":false,"context_lines":[{"line_number":13,"context_line":"https://github.com/openstack/python-novaclient/blob/13.0.1/novaclient/v2/servers.py#L896"},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"If we can determine before we list servers that there are only a"},{"line_number":16,"context_line":"certain number - 4 in this example - we should just pass the"},{"line_number":17,"context_line":"limit\u003dlen(servers) to novaclient and avoid the second call for"},{"line_number":18,"context_line":"paging which takes extra time and yields no results."},{"line_number":19,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"9fb8cfa7_b3067fcd","line":16,"range":{"start_line":16,"start_character":15,"end_line":16,"end_character":36},"updated":"2019-07-01 14:20:53.000000000","message":"I\u0027d remove this from the commit message sine it\u0027s out of context (just leave it in the bug report).","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"003385db2fed72c58436f8f1605c2011bf73e420","unresolved":false,"context_lines":[{"line_number":13,"context_line":"https://github.com/openstack/python-novaclient/blob/13.0.1/novaclient/v2/servers.py#L896"},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"If we can determine before we list servers that there are only a"},{"line_number":16,"context_line":"certain number - 4 in this example - we should just pass the"},{"line_number":17,"context_line":"limit\u003dlen(servers) to novaclient and avoid the second call for"},{"line_number":18,"context_line":"paging which takes extra time and yields no results."},{"line_number":19,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"7faddb67_cd69fa8b","line":16,"range":{"start_line":16,"start_character":15,"end_line":16,"end_character":36},"in_reply_to":"9fb8cfa7_537aa323","updated":"2019-07-04 02:49:05.000000000","message":"Done","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"18f2c9d3941aabaec9cdd214f75d78849781293b","unresolved":false,"context_lines":[{"line_number":13,"context_line":"https://github.com/openstack/python-novaclient/blob/13.0.1/novaclient/v2/servers.py#L896"},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"If we can determine before we list servers that there are only a"},{"line_number":16,"context_line":"certain number - 4 in this example - we should just pass the"},{"line_number":17,"context_line":"limit\u003dlen(servers) to novaclient and avoid the second call for"},{"line_number":18,"context_line":"paging which takes extra time and yields no results."},{"line_number":19,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"9fb8cfa7_537aa323","line":16,"range":{"start_line":16,"start_character":15,"end_line":16,"end_character":36},"in_reply_to":"9fb8cfa7_b3067fcd","updated":"2019-07-01 14:27:25.000000000","message":"Ok.","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f3b7da7137c9a5e077e4c262afc221ba264dc4e1","unresolved":false,"context_lines":[{"line_number":18,"context_line":"paging which takes extra time and yields no results."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I797ad934a0f8496dbcbf65798e28b0443f238137"},{"line_number":21,"context_line":"Closes-Bug: #1833665"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"9fb8cfa7_33fa8fbc","line":21,"range":{"start_line":21,"start_character":13,"end_line":21,"end_character":20},"updated":"2019-07-01 14:20:53.000000000","message":"This should be 1834679.","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"18f2c9d3941aabaec9cdd214f75d78849781293b","unresolved":false,"context_lines":[{"line_number":18,"context_line":"paging which takes extra time and yields no results."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I797ad934a0f8496dbcbf65798e28b0443f238137"},{"line_number":21,"context_line":"Closes-Bug: #1833665"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"9fb8cfa7_d393f34d","line":21,"range":{"start_line":21,"start_character":13,"end_line":21,"end_character":20},"in_reply_to":"9fb8cfa7_33fa8fbc","updated":"2019-07-01 14:27:25.000000000","message":"Ok.","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"003385db2fed72c58436f8f1605c2011bf73e420","unresolved":false,"context_lines":[{"line_number":18,"context_line":"paging which takes extra time and yields no results."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I797ad934a0f8496dbcbf65798e28b0443f238137"},{"line_number":21,"context_line":"Closes-Bug: #1833665"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"7faddb67_ed72b67c","line":21,"range":{"start_line":21,"start_character":13,"end_line":21,"end_character":20},"in_reply_to":"9fb8cfa7_d393f34d","updated":"2019-07-04 02:49:05.000000000","message":"Done","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"}],"watcher/common/nova_helper.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0c540e5636f9464122c909a739d2d39ad0047953","unresolved":false,"context_lines":[{"line_number":82,"context_line":"            LOG.exception(exc)"},{"line_number":83,"context_line":"            raise exception.ComputeNodeNotFound(name\u003dnode_hostname)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def get_instance_list(self, filters\u003dNone, limit\u003d-1):"},{"line_number":86,"context_line":"        \"\"\"List servers for all tenants with details."},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"        This always gets servers with the all_tenants\u003dTrue filter."}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_baf506cd","line":85,"range":{"start_line":85,"start_character":46,"end_line":85,"end_character":54},"updated":"2019-06-28 17:53:38.000000000","message":"We should document this with a :param: in the docstring of the method. Mention that -1 means page until no more servers are returned.\n\nNote that we might also need to pass a marker here if we\u0027re going to page client-side, i.e. let\u0027s say we\u0027re asking for instances across all_tenants (no host filtering or anything) and there are \u003e1000 servers in the deployment. By default the compute API will limit the response to 1000 servers and then the client will need to page using the last-seen item from the previous page as the marker to get another set of servers.\n\nFor the add_instance_node code where we\u0027re filtering by compute service host, there should definitely be far less than that many servers in the response so we should be OK, but it\u0027s still something to consider for later.","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"9e2a80f2daba7140aacb128e010114e3b2ae5fc5","unresolved":false,"context_lines":[{"line_number":82,"context_line":"            LOG.exception(exc)"},{"line_number":83,"context_line":"            raise exception.ComputeNodeNotFound(name\u003dnode_hostname)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def get_instance_list(self, filters\u003dNone, limit\u003d-1):"},{"line_number":86,"context_line":"        \"\"\"List servers for all tenants with details."},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"        This always gets servers with the all_tenants\u003dTrue filter."}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_89dc7ee4","line":85,"range":{"start_line":85,"start_character":46,"end_line":85,"end_character":54},"in_reply_to":"9fb8cfa7_baf506cd","updated":"2019-06-29 02:53:23.000000000","message":"Done","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"b44111cb6e1f213649f9e3a30c93cf3e8f96415c","unresolved":false,"context_lines":[{"line_number":82,"context_line":"            LOG.exception(exc)"},{"line_number":83,"context_line":"            raise exception.ComputeNodeNotFound(name\u003dnode_hostname)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def get_instance_list(self, filters\u003dNone, limit\u003d-1):"},{"line_number":86,"context_line":"        \"\"\"List servers for all tenants with details."},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"        This always gets servers with the all_tenants\u003dTrue filter."}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_c98116fd","line":85,"range":{"start_line":85,"start_character":46,"end_line":85,"end_character":54},"in_reply_to":"9fb8cfa7_baf506cd","updated":"2019-06-29 01:40:33.000000000","message":"Ok. Thank you for your reminder, I will update it.","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":29911,"name":"Dantali0n","email":"info@dantalion.nl","username":"Dantali0n"},"change_message_id":"665400e2f8488407567606d9171b76bde9c487db","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        This always gets servers with the all_tenants\u003dTrue filter."},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        :param filters: dict of additional filters (optional)."},{"line_number":91,"context_line":"        :param limit: Maximum number of servers to return (optional)."},{"line_number":92,"context_line":"                      If limit \u003d\u003d -1, all servers will be returned."},{"line_number":93,"context_line":"        :returns: list of novaclient Server objects"},{"line_number":94,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"9fb8cfa7_0af15795","line":91,"updated":"2019-07-01 06:50:59.000000000","message":"Maybe we can add here as well that -1 has a performance penalty.","commit_id":"6332fb01835e092c5de5a030b4c605468200ed30"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"81ae33182114fdc099a056f78a68760e1f8f64d2","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        This always gets servers with the all_tenants\u003dTrue filter."},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        :param filters: dict of additional filters (optional)."},{"line_number":91,"context_line":"        :param limit: Maximum number of servers to return (optional)."},{"line_number":92,"context_line":"                      If limit \u003d\u003d -1, all servers will be returned."},{"line_number":93,"context_line":"        :returns: list of novaclient Server objects"},{"line_number":94,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"9fb8cfa7_1dd2fa00","line":91,"in_reply_to":"9fb8cfa7_0af15795","updated":"2019-07-01 13:08:46.000000000","message":"Good idea.","commit_id":"6332fb01835e092c5de5a030b4c605468200ed30"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"90d450e5b491242aee82b3a4d9269ec4a20d9102","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        This always gets servers with the all_tenants\u003dTrue filter."},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        :param filters: dict of additional filters (optional)."},{"line_number":91,"context_line":"        :param limit: Maximum number of servers to return (optional)."},{"line_number":92,"context_line":"                      If limit \u003d\u003d -1, all servers will be returned."},{"line_number":93,"context_line":"        :returns: list of novaclient Server objects"},{"line_number":94,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"9fb8cfa7_9df10a6e","line":91,"in_reply_to":"9fb8cfa7_1dd2fa00","updated":"2019-07-01 13:18:13.000000000","message":"Done","commit_id":"6332fb01835e092c5de5a030b4c605468200ed30"}],"watcher/decision_engine/model/collector/nova.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0c540e5636f9464122c909a739d2d39ad0047953","unresolved":false,"context_lines":[{"line_number":326,"context_line":"        compute_node \u003d self.model.get_node_by_uuid(host)"},{"line_number":327,"context_line":"        len_instances \u003d len(instances)"},{"line_number":328,"context_line":"        filters \u003d {\u0027host\u0027: host}"},{"line_number":329,"context_line":"        # Get all servers on this compute host."},{"line_number":330,"context_line":"        instances \u003d self.nova_helper.get_instance_list("},{"line_number":331,"context_line":"            filters\u003dfilters,"},{"line_number":332,"context_line":"            limit\u003dlen_instances)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_dada3a49","line":329,"updated":"2019-06-28 17:53:38.000000000","message":"Update this comment to mention why we are passing a limit (so that novaclient will not unnecessarily page).","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"9e2a80f2daba7140aacb128e010114e3b2ae5fc5","unresolved":false,"context_lines":[{"line_number":326,"context_line":"        compute_node \u003d self.model.get_node_by_uuid(host)"},{"line_number":327,"context_line":"        len_instances \u003d len(instances)"},{"line_number":328,"context_line":"        filters \u003d {\u0027host\u0027: host}"},{"line_number":329,"context_line":"        # Get all servers on this compute host."},{"line_number":330,"context_line":"        instances \u003d self.nova_helper.get_instance_list("},{"line_number":331,"context_line":"            filters\u003dfilters,"},{"line_number":332,"context_line":"            limit\u003dlen_instances)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_a9d702bf","line":329,"in_reply_to":"9fb8cfa7_dada3a49","updated":"2019-06-29 02:53:23.000000000","message":"Done","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"b44111cb6e1f213649f9e3a30c93cf3e8f96415c","unresolved":false,"context_lines":[{"line_number":326,"context_line":"        compute_node \u003d self.model.get_node_by_uuid(host)"},{"line_number":327,"context_line":"        len_instances \u003d len(instances)"},{"line_number":328,"context_line":"        filters \u003d {\u0027host\u0027: host}"},{"line_number":329,"context_line":"        # Get all servers on this compute host."},{"line_number":330,"context_line":"        instances \u003d self.nova_helper.get_instance_list("},{"line_number":331,"context_line":"            filters\u003dfilters,"},{"line_number":332,"context_line":"            limit\u003dlen_instances)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9fb8cfa7_e9841a0d","line":329,"in_reply_to":"9fb8cfa7_dada3a49","updated":"2019-06-29 01:40:33.000000000","message":"Ok.","commit_id":"322598e61f92f20cc407cc00619835c9bdc30c5f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f3b7da7137c9a5e077e4c262afc221ba264dc4e1","unresolved":false,"context_lines":[{"line_number":325,"context_line":"        host \u003d node.service[\"host\"]"},{"line_number":326,"context_line":"        compute_node \u003d self.model.get_node_by_uuid(host)"},{"line_number":327,"context_line":"        filters \u003d {\u0027host\u0027: host}"},{"line_number":328,"context_line":"        limit \u003d len(instances) if len(instances) \u003c\u003d 1000 else -1"},{"line_number":329,"context_line":"        # Get all servers on this compute host."},{"line_number":330,"context_line":"        # Note that the advantage of passing the limit parameter is"},{"line_number":331,"context_line":"        # that it can speed up the call time of novaclient. 1000 is"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_13142be8","line":328,"updated":"2019-07-01 14:20:53.000000000","message":"Should probably have a unit test for the logic where len(instances) is \u003e 1000.\n\nThis is also probably OK for now since I don\u0027t think we\u0027d get anywhere near that many servers on a single (non-baremetal) compute node, but it doesn\u0027t mean the actual deployment being used has the limit set to 1000, they could have it set to 100 or something and we wouldn\u0027t know - that\u0027s what the marker would be for paging. Anyway, this is OK for now but you should probably have that unit test wrinkle.","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"003385db2fed72c58436f8f1605c2011bf73e420","unresolved":false,"context_lines":[{"line_number":325,"context_line":"        host \u003d node.service[\"host\"]"},{"line_number":326,"context_line":"        compute_node \u003d self.model.get_node_by_uuid(host)"},{"line_number":327,"context_line":"        filters \u003d {\u0027host\u0027: host}"},{"line_number":328,"context_line":"        limit \u003d len(instances) if len(instances) \u003c\u003d 1000 else -1"},{"line_number":329,"context_line":"        # Get all servers on this compute host."},{"line_number":330,"context_line":"        # Note that the advantage of passing the limit parameter is"},{"line_number":331,"context_line":"        # that it can speed up the call time of novaclient. 1000 is"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_6d0486c7","line":328,"in_reply_to":"9fb8cfa7_13142be8","updated":"2019-07-04 02:49:05.000000000","message":"Done","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"18f2c9d3941aabaec9cdd214f75d78849781293b","unresolved":false,"context_lines":[{"line_number":325,"context_line":"        host \u003d node.service[\"host\"]"},{"line_number":326,"context_line":"        compute_node \u003d self.model.get_node_by_uuid(host)"},{"line_number":327,"context_line":"        filters \u003d {\u0027host\u0027: host}"},{"line_number":328,"context_line":"        limit \u003d len(instances) if len(instances) \u003c\u003d 1000 else -1"},{"line_number":329,"context_line":"        # Get all servers on this compute host."},{"line_number":330,"context_line":"        # Note that the advantage of passing the limit parameter is"},{"line_number":331,"context_line":"        # that it can speed up the call time of novaclient. 1000 is"}],"source_content_type":"text/x-python","patch_set":3,"id":"9fb8cfa7_f3c2b733","line":328,"in_reply_to":"9fb8cfa7_13142be8","updated":"2019-07-01 14:27:25.000000000","message":"Yep. Adding unit tests is always good. I will update it.","commit_id":"aa7eee55d38045dc2499cc3b4f0f0099fdf36f3c"}],"watcher/tests/decision_engine/cluster/test_nova_cdmc.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"59d71a6e4e948d409bea72f22090fe69091b6705","unresolved":false,"context_lines":[{"line_number":132,"context_line":"            filters\u003d{\u0027host\u0027: mock_host}, limit\u003d1)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        # verify that when len(instances) \u003e 1000, limit \u003d\u003d -1."},{"line_number":135,"context_line":"        mock_instances \u003d [mock.Mock() for i in range(1001)]"},{"line_number":136,"context_line":"        model_builder.add_instance_node(mock_node, mock_instances)"},{"line_number":137,"context_line":"        model_builder.nova_helper.get_instance_list.assert_called_with("},{"line_number":138,"context_line":"            filters\u003d{\u0027host\u0027: mock_host}, limit\u003d-1)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7faddb67_74f67192","line":135,"range":{"start_line":135,"start_character":26,"end_line":135,"end_character":37},"updated":"2019-07-05 22:21:01.000000000","message":"Rather than create 1001 individual mock objects, it might be more efficient to do this:\n\n    mock_instance \u003d mock.Mock()\n    mock_instances \u003d [mock_instance] * 1001\n\nIt\u0027s not realistic that the servers in the list would be the same, but this test doesn\u0027t care about that.\n\nIn fact, you don\u0027t even need the list to be mocks, it could just be:\n\n   mock_instances \u003d [\u0027fake\u0027] * 1001\n\nSince the model is a mock it doesn\u0027t matter what these are.\n\nAnyway, the test is fast as-is so it\u0027s just a suggestion if you want to change it.\n\n2019-07-04 05:33:49.595809 | ubuntu-bionic | {5} watcher.tests.decision_engine.cluster.test_nova_cdmc.TestModelBuilder.test_add_instance_node [0.055976s] ... ok\n\n2019-07-04 05:20:17.876287 | ubuntu-bionic | {6} watcher.tests.decision_engine.cluster.test_nova_cdmc.TestModelBuilder.test_add_instance_node [0.080633s] ... ok\n\n2019-07-04 05:32:58.814317 | ubuntu-bionic | {5} watcher.tests.decision_engine.cluster.test_nova_cdmc.TestModelBuilder.test_add_instance_node [0.044519s] ... ok","commit_id":"415a4268b3039f2062d7b2a3c1972543d4bfa8b1"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"df210ab7750f903cae259cc0c3989432e8d1008b","unresolved":false,"context_lines":[{"line_number":132,"context_line":"            filters\u003d{\u0027host\u0027: mock_host}, limit\u003d1)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        # verify that when len(instances) \u003e 1000, limit \u003d\u003d -1."},{"line_number":135,"context_line":"        mock_instances \u003d [mock.Mock() for i in range(1001)]"},{"line_number":136,"context_line":"        model_builder.add_instance_node(mock_node, mock_instances)"},{"line_number":137,"context_line":"        model_builder.nova_helper.get_instance_list.assert_called_with("},{"line_number":138,"context_line":"            filters\u003d{\u0027host\u0027: mock_host}, limit\u003d-1)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7faddb67_56f9f57d","line":135,"range":{"start_line":135,"start_character":26,"end_line":135,"end_character":37},"in_reply_to":"7faddb67_74f67192","updated":"2019-07-08 02:00:43.000000000","message":"Done","commit_id":"415a4268b3039f2062d7b2a3c1972543d4bfa8b1"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"2a729f6861605cbb3da5f46d93257b9978f90230","unresolved":false,"context_lines":[{"line_number":132,"context_line":"            filters\u003d{\u0027host\u0027: mock_host}, limit\u003d1)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        # verify that when len(instances) \u003e 1000, limit \u003d\u003d -1."},{"line_number":135,"context_line":"        mock_instances \u003d [mock.Mock() for i in range(1001)]"},{"line_number":136,"context_line":"        model_builder.add_instance_node(mock_node, mock_instances)"},{"line_number":137,"context_line":"        model_builder.nova_helper.get_instance_list.assert_called_with("},{"line_number":138,"context_line":"            filters\u003d{\u0027host\u0027: mock_host}, limit\u003d-1)"}],"source_content_type":"text/x-python","patch_set":5,"id":"7faddb67_d6dc051a","line":135,"range":{"start_line":135,"start_character":26,"end_line":135,"end_character":37},"in_reply_to":"7faddb67_74f67192","updated":"2019-07-08 01:55:52.000000000","message":"Thank you for helping to test the execution time of the function. Indeed, \n    mock_instance \u003d mock.Mock()\n    mock_instances \u003d [mock_instance] * 1001\nis faster than\n    mock_instances \u003d [mock.Mock() for i in range(1001)]\nlike 9.10758972168e-05 and 0.10635304451, fast is always better.\nbut I think the mock object should be retained, which helps others to understand this part of the code faster, even though [\u0027fake\u0027] is also ok.","commit_id":"415a4268b3039f2062d7b2a3c1972543d4bfa8b1"}]}
