)]}'
{"nova/objects/resource_provider.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"4b79f30946815a32312dbbf517b0c1950d924937","unresolved":false,"context_lines":[{"line_number":797,"context_line":""},{"line_number":798,"context_line":"@db_api.api_context_manager.reader"},{"line_number":799,"context_line":"def _get_provider_ids_with_any_trait(ctx, traits, rp_ids\u003dNone):"},{"line_number":800,"context_line":"    \"\"\"This method will filter out a list of resource porviders which have any"},{"line_number":801,"context_line":"    trait in the `traits` parameter. So when the `rp_ids` specified, the"},{"line_number":802,"context_line":"    filtering will be limitted to those resource providers."},{"line_number":803,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_8eff4400","line":800,"range":{"start_line":800,"start_character":24,"end_line":800,"end_character":41},"updated":"2017-10-12 12:50:29.000000000","message":"I think I understand what you are doing with this method, but \u0027filter out a list\u0027 doesn\u0027t describe that. Maybe something like:\n\nReturns the resource providers which have any of the specified traits. This will be a dictionary with the resource_provider_id as the keys, and a set containing the matching trait_ids for that provider. If `rp_ids` is specified, only those providers will be considered; otherwise, all RPs will be queried.","commit_id":"03429f0e73de70bca2913b8172f0e232dea6d248"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"4b79f30946815a32312dbbf517b0c1950d924937","unresolved":false,"context_lines":[{"line_number":799,"context_line":"def _get_provider_ids_with_any_trait(ctx, traits, rp_ids\u003dNone):"},{"line_number":800,"context_line":"    \"\"\"This method will filter out a list of resource porviders which have any"},{"line_number":801,"context_line":"    trait in the `traits` parameter. So when the `rp_ids` specified, the"},{"line_number":802,"context_line":"    filtering will be limitted to those resource providers."},{"line_number":803,"context_line":"    \"\"\""},{"line_number":804,"context_line":"    rtt \u003d sa.alias(_RP_TRAIT_TBL, name\u003d\u0027rp_trait\u0027)"},{"line_number":805,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027trait\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f4e5783_53357945","line":802,"range":{"start_line":802,"start_character":22,"end_line":802,"end_character":30},"updated":"2017-10-12 12:50:29.000000000","message":"limited","commit_id":"03429f0e73de70bca2913b8172f0e232dea6d248"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"928d39848325f7b537e30ed9640b66824a3b5dda","unresolved":false,"context_lines":[{"line_number":802,"context_line":"    filtering will be limitted to those resource providers."},{"line_number":803,"context_line":"    \"\"\""},{"line_number":804,"context_line":"    rtt \u003d sa.alias(_RP_TRAIT_TBL, name\u003d\u0027rp_trait\u0027)"},{"line_number":805,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027trait\u0027)"},{"line_number":806,"context_line":""},{"line_number":807,"context_line":"    query \u003d sa.select([rtt.c.resource_provider_id, rtt.c.trait_id])"},{"line_number":808,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3f4b6375_e78f1121","line":805,"updated":"2017-10-20 14:20:31.000000000","message":"I know that it seems to be a style here to use short abbreviated variable names but rtt, and tt next to each other makes my head hurt during decoding. I think we have enough space to say rp_trait_table and trait_table instead.","commit_id":"03429f0e73de70bca2913b8172f0e232dea6d248"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f1133ecef195725cf0783e13e02abd9aec469c29","unresolved":false,"context_lines":[{"line_number":904,"context_line":""},{"line_number":905,"context_line":""},{"line_number":906,"context_line":"@db_api.api_context_manager.reader"},{"line_number":907,"context_line":"def _get_provider_ids_with_any_trait(ctx, traits, rp_ids\u003dNone):"},{"line_number":908,"context_line":"    \"\"\"This method will filter out a list of resource porviders which have any"},{"line_number":909,"context_line":"    trait in the `traits` parameter. So when the `rp_ids` specified, the"},{"line_number":910,"context_line":"    filtering will be limitted to those resource providers."}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_cf8aa7bd","line":907,"range":{"start_line":907,"start_character":42,"end_line":907,"end_character":48},"updated":"2017-10-24 10:51:35.000000000","message":"please document in the docstring that the traits argument to this function is a list of *string trait names*.","commit_id":"3ea0d4fe9b348753e94d09c2cd895ca52ff79f06"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f1133ecef195725cf0783e13e02abd9aec469c29","unresolved":false,"context_lines":[{"line_number":905,"context_line":""},{"line_number":906,"context_line":"@db_api.api_context_manager.reader"},{"line_number":907,"context_line":"def _get_provider_ids_with_any_trait(ctx, traits, rp_ids\u003dNone):"},{"line_number":908,"context_line":"    \"\"\"This method will filter out a list of resource porviders which have any"},{"line_number":909,"context_line":"    trait in the `traits` parameter. So when the `rp_ids` specified, the"},{"line_number":910,"context_line":"    filtering will be limitted to those resource providers."},{"line_number":911,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_0f9d5f09","line":908,"range":{"start_line":908,"start_character":54,"end_line":908,"end_character":63},"updated":"2017-10-24 10:51:35.000000000","message":"providers","commit_id":"3ea0d4fe9b348753e94d09c2cd895ca52ff79f06"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f1133ecef195725cf0783e13e02abd9aec469c29","unresolved":false,"context_lines":[{"line_number":905,"context_line":""},{"line_number":906,"context_line":"@db_api.api_context_manager.reader"},{"line_number":907,"context_line":"def _get_provider_ids_with_any_trait(ctx, traits, rp_ids\u003dNone):"},{"line_number":908,"context_line":"    \"\"\"This method will filter out a list of resource porviders which have any"},{"line_number":909,"context_line":"    trait in the `traits` parameter. So when the `rp_ids` specified, the"},{"line_number":910,"context_line":"    filtering will be limitted to those resource providers."},{"line_number":911,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_4ff23772","line":908,"range":{"start_line":908,"start_character":24,"end_line":908,"end_character":30},"updated":"2017-10-24 10:51:35.000000000","message":"this function isn\u0027t filtering out a list. It\u0027s returning a dict of sets :)","commit_id":"3ea0d4fe9b348753e94d09c2cd895ca52ff79f06"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f1133ecef195725cf0783e13e02abd9aec469c29","unresolved":false,"context_lines":[{"line_number":907,"context_line":"def _get_provider_ids_with_any_trait(ctx, traits, rp_ids\u003dNone):"},{"line_number":908,"context_line":"    \"\"\"This method will filter out a list of resource porviders which have any"},{"line_number":909,"context_line":"    trait in the `traits` parameter. So when the `rp_ids` specified, the"},{"line_number":910,"context_line":"    filtering will be limitted to those resource providers."},{"line_number":911,"context_line":"    \"\"\""},{"line_number":912,"context_line":"    rtt \u003d sa.alias(_RP_TRAIT_TBL, name\u003d\u0027rp_trait\u0027)"},{"line_number":913,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027trait\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_2ff7fb61","line":910,"range":{"start_line":910,"start_character":22,"end_line":910,"end_character":30},"updated":"2017-10-24 10:51:35.000000000","message":"limited","commit_id":"3ea0d4fe9b348753e94d09c2cd895ca52ff79f06"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f1133ecef195725cf0783e13e02abd9aec469c29","unresolved":false,"context_lines":[{"line_number":927,"context_line":"        )"},{"line_number":928,"context_line":"    )"},{"line_number":929,"context_line":""},{"line_number":930,"context_line":"    to_return \u003d collections.defaultdict(set)"},{"line_number":931,"context_line":"    for r in ctx.session.execute(query):"},{"line_number":932,"context_line":"        to_return[r[0]].add(r[1])"},{"line_number":933,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_6f7bb3bd","line":930,"range":{"start_line":930,"start_character":4,"end_line":930,"end_character":13},"updated":"2017-10-24 10:51:35.000000000","message":"I think a better variable name might be \"prov_traits\" to indicate what is stored in the variable.","commit_id":"3ea0d4fe9b348753e94d09c2cd895ca52ff79f06"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"e6362b155b64835afe1af88bbb17171ee05a19d8","unresolved":false,"context_lines":[{"line_number":901,"context_line":""},{"line_number":902,"context_line":"@db_api.api_context_manager.reader"},{"line_number":903,"context_line":"def _get_traits_by_rp_ids(ctx, rp_ids):"},{"line_number":904,"context_line":"    \"\"\"This method returns all the traits for a list of resource providers\"\"\""},{"line_number":905,"context_line":""},{"line_number":906,"context_line":"    rtt \u003d sa.alias(_RP_TRAIT_TBL, name\u003d\u0027rp_trait\u0027)"},{"line_number":907,"context_line":"    tt \u003d sa.alias(_TRAIT_TBL, name\u003d\u0027trait\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f4b6375_586af1ec","line":904,"updated":"2017-10-24 17:52:55.000000000","message":"Document the return type, which appears to be a dict of RP ID to a set of tuples of trait ID and name:\n\n { rp_id: { (trait_id, trait_name), ... }, ... }","commit_id":"548327c6b07b428fe635f27cdf96f16991beb640"}],"nova/tests/functional/db/test_resource_provider.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"928d39848325f7b537e30ed9640b66824a3b5dda","unresolved":false,"context_lines":[{"line_number":3159,"context_line":"        rp_dict \u003d rp_obj._get_provider_ids_with_any_trait("},{"line_number":3160,"context_line":"            self.ctx, [\u0027CUSTOM_TRAIT_A\u0027, \u0027CUSTOM_TRAIT_B\u0027])"},{"line_number":3161,"context_line":""},{"line_number":3162,"context_line":"        self.assertEqual(set(), rp_dict[cn1.id])"},{"line_number":3163,"context_line":"        self.assertEqual(set([t_a.id]), rp_dict[cn2.id])"},{"line_number":3164,"context_line":"        self.assertEqual(set([t_a.id, t_b.id]), rp_dict[cn3.id])"},{"line_number":3165,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3f4b6375_a7b8f975","line":3162,"updated":"2017-10-20 14:20:31.000000000","message":"If the intended behavior is to return only those rp ids that has at least one trait from the provided trait list then we should not return cn1 as it has not traits.","commit_id":"03429f0e73de70bca2913b8172f0e232dea6d248"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"928d39848325f7b537e30ed9640b66824a3b5dda","unresolved":false,"context_lines":[{"line_number":3166,"context_line":"        rp_dict \u003d rp_obj._get_provider_ids_with_any_trait(self.ctx,"},{"line_number":3167,"context_line":"            [\u0027CUSTOM_TRAIT_A\u0027, \u0027CUSTOM_TRAIT_B\u0027], rp_ids\u003d[cn1.id, cn3.id])"},{"line_number":3168,"context_line":""},{"line_number":3169,"context_line":"        self.assertEqual(set(), rp_dict[cn1.id])"},{"line_number":3170,"context_line":"        self.assertEqual(set(), rp_dict[cn2.id])"},{"line_number":3171,"context_line":"        self.assertEqual(set([t_a.id, t_b.id]), rp_dict[cn3.id])"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f4b6375_077c6db3","line":3171,"range":{"start_line":3169,"start_character":1,"end_line":3171,"end_character":1},"updated":"2017-10-20 14:20:31.000000000","message":"If the intended behavior is to return only those RPs that are provided rp_ids list then we should not return cn2.id","commit_id":"03429f0e73de70bca2913b8172f0e232dea6d248"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f1133ecef195725cf0783e13e02abd9aec469c29","unresolved":false,"context_lines":[{"line_number":2436,"context_line":"        self.assertEqual(expected_res, sorted(res_list))"},{"line_number":2437,"context_line":""},{"line_number":2438,"context_line":"    def test_get_provider_ids_with_any_trait(self):"},{"line_number":2439,"context_line":"        rp_obj._ensure_rc_cache(self.ctx)"},{"line_number":2440,"context_line":"        # Create the three providers"},{"line_number":2441,"context_line":"        cn1_uuid \u003d uuidsentinel.cn1"},{"line_number":2442,"context_line":"        cn1 \u003d rp_obj.ResourceProvider("}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_8f2cafac","line":2439,"range":{"start_line":2439,"start_character":8,"end_line":2439,"end_character":41},"updated":"2017-10-24 10:51:35.000000000","message":"the RC cache isn\u0027t used in the _get_provider_ids_with_any_trait() function or in this test method.","commit_id":"3ea0d4fe9b348753e94d09c2cd895ca52ff79f06"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f1133ecef195725cf0783e13e02abd9aec469c29","unresolved":false,"context_lines":[{"line_number":2489,"context_line":"            [\u0027CUSTOM_TRAIT_A\u0027, \u0027CUSTOM_TRAIT_B\u0027], rp_ids\u003d[cn1.id, cn3.id])"},{"line_number":2490,"context_line":""},{"line_number":2491,"context_line":"        self.assertEqual(set(), rp_dict[cn1.id])"},{"line_number":2492,"context_line":"        self.assertEqual(set(), rp_dict[cn2.id])"},{"line_number":2493,"context_line":""},{"line_number":2494,"context_line":""},{"line_number":2495,"context_line":"class AllocationCandidatesTestCase(ResourceProviderBaseCase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f4b6375_fa063f1c","line":2492,"updated":"2017-10-24 10:51:35.000000000","message":"ack. good tests.","commit_id":"3ea0d4fe9b348753e94d09c2cd895ca52ff79f06"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"e6362b155b64835afe1af88bbb17171ee05a19d8","unresolved":false,"context_lines":[{"line_number":2471,"context_line":"        self.assertEqual(set(), rp_dict[cn1.id])"},{"line_number":2472,"context_line":"        self.assertEqual(set([(t_a.id, t_a.name)]), rp_dict[cn2.id])"},{"line_number":2473,"context_line":"        self.assertEqual(set([(t_a.id, t_a.name), (t_b.id, t_b.name)]),"},{"line_number":2474,"context_line":"            rp_dict[cn3.id])"},{"line_number":2475,"context_line":""},{"line_number":2476,"context_line":""},{"line_number":2477,"context_line":"class AllocationCandidatesTestCase(ResourceProviderBaseCase):"}],"source_content_type":"text/x-python","patch_set":4,"id":"3f4b6375_f80bdd26","line":2474,"updated":"2017-10-24 17:52:55.000000000","message":"Wouldn\u0027t offend me if you populated the database with a fourth RP (with traits) that you don\u0027t include in your request, so you can make sure it doesn\u0027t show up in the results.","commit_id":"548327c6b07b428fe635f27cdf96f16991beb640"}]}
