)]}'
{"placement/objects/research_context.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b0c2df55f49058ce38c079fa9ecc4112211a23d5","unresolved":false,"context_lines":[{"line_number":88,"context_line":"            LOG.debug(\"getting allocation candidates in the same tree \""},{"line_number":89,"context_line":"                      \"with the root provider %s\", tree_ids.root_uuid)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"        self.rps_with_resource \u003d {}"},{"line_number":92,"context_line":"        for rc_id, amount in self.resources.items():"},{"line_number":93,"context_line":"            provs_with_resource \u003d get_providers_with_resource("},{"line_number":94,"context_line":"                context, rc_id, amount, tree_root_id\u003dself.tree_root_id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"bfb3d3c7_5c3caf92","line":91,"range":{"start_line":91,"start_character":13,"end_line":91,"end_character":30},"updated":"2019-05-20 20:32:34.000000000","message":"I\u0027d be tempted to make this a method instead of allowing direct access to the dict (which would then be private).","commit_id":"5cd88064ff5887e5b84eefd44bebbd6d91ea3f49"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"eda0e196536286e661f14611a401a50dfa8c8865","unresolved":false,"context_lines":[{"line_number":94,"context_line":"                context, rc_id, amount, tree_root_id\u003dself.tree_root_id)"},{"line_number":95,"context_line":"            if not provs_with_resource:"},{"line_number":96,"context_line":"                raise exception.ResourceProviderNotFound()"},{"line_number":97,"context_line":"            self.rps_with_resource[rc_id] \u003d provs_with_resource"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"        # a dict, keyed by resource class ID, of the set of resource"},{"line_number":100,"context_line":"        # provider IDs that share some inventory for each resource class"}],"source_content_type":"text/x-python","patch_set":1,"id":"bfb3d3c7_eed7f422","line":97,"updated":"2019-05-20 13:36:12.000000000","message":"How are you choosing how you order the three different clauses in __init__ which could raise ResourceProviderNotFound?\n\nIt seems like there might be an ideal order which can avoid extraneous calculation when no results are going to eventually be returned.\n\nFor example \u0027provider_ids_from_uuid\u0027 could probably be run first. If in_tree is set to a non-existent provider, may as well exit before mapping traits and rcs, and checking aggregates.\n\nThe others are less clear. Finding aggregate members is much cheaper than get_providers_with_resource, but at the same time it makes no sense to think about aggregates if there are no providers.\n\nOne thing you might do is extract each sub-initialization to its own private method and then we can a) experiment with ordering, b) clearly see their impact when profiling.","commit_id":"5cd88064ff5887e5b84eefd44bebbd6d91ea3f49"}]}
