)]}'
{"placement/resource_class_cache.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3358e5be48410b1c11b1553d0b78e7e2b5eb84aa","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from placement import db_api"},{"line_number":18,"context_line":"from placement import exception"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"RC_CACHE \u003d None"},{"line_number":21,"context_line":"_RC_TBL \u003d models.ResourceClass.__table__"},{"line_number":22,"context_line":"_LOCKNAME \u003d \u0027rc_cache\u0027"},{"line_number":23,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_393fd325","line":20,"range":{"start_line":20,"start_character":0,"end_line":20,"end_character":15},"updated":"2019-02-28 17:21:20.000000000","message":"Hm, rather than making this public, could ensure_rc_cache return it?","commit_id":"59858faf8374211487a2bc8132b6e27dfd63e5de"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"a372382624f1de97342c70b68b7ba8770f2ea410","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from placement import db_api"},{"line_number":18,"context_line":"from placement import exception"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"RC_CACHE \u003d None"},{"line_number":21,"context_line":"_RC_TBL \u003d models.ResourceClass.__table__"},{"line_number":22,"context_line":"_LOCKNAME \u003d \u0027rc_cache\u0027"},{"line_number":23,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_7caea981","line":20,"range":{"start_line":20,"start_character":0,"end_line":20,"end_character":15},"in_reply_to":"9fdfeff1_393fd325","updated":"2019-02-28 17:51:35.000000000","message":"How would that work from the calling standpoint? Wouldn\u0027t we still need a global in the one real place where ensure_rc_cache is called (in deploy.py)?\n\nI feel like I\u0027m missing something.","commit_id":"59858faf8374211487a2bc8132b6e27dfd63e5de"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"e7e705f21bda530fd569ef566e9963f4b7aba6ef","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from placement import db_api"},{"line_number":18,"context_line":"from placement import exception"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"RC_CACHE \u003d None"},{"line_number":21,"context_line":"_RC_TBL \u003d models.ResourceClass.__table__"},{"line_number":22,"context_line":"_LOCKNAME \u003d \u0027rc_cache\u0027"},{"line_number":23,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_ed3185a3","line":20,"range":{"start_line":20,"start_character":0,"end_line":20,"end_character":15},"in_reply_to":"9fdfeff1_4713d25c","updated":"2019-02-28 20:09:09.000000000","message":"We only want to ensure it once. We went to some effort quite a while ago to ensure that the cache was only ensured once and that it can be \"assumed\". I don\u0027t want to back that out.\n\nOr maybe I\u0027m still misunderstanding you.","commit_id":"59858faf8374211487a2bc8132b6e27dfd63e5de"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"9e144ffc8ada2b406fcb91113543b603a708a354","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from placement import db_api"},{"line_number":18,"context_line":"from placement import exception"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"RC_CACHE \u003d None"},{"line_number":21,"context_line":"_RC_TBL \u003d models.ResourceClass.__table__"},{"line_number":22,"context_line":"_LOCKNAME \u003d \u0027rc_cache\u0027"},{"line_number":23,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_4713d25c","line":20,"range":{"start_line":20,"start_character":0,"end_line":20,"end_character":15},"in_reply_to":"9fdfeff1_7caea981","updated":"2019-02-28 18:11:33.000000000","message":"Yes, I\u0027m saying keep the global, but keep it private, and everyone who needs it should access it via the (public) getter in this module that ensures it is populated first.\n\nOtherwise you\u0027re counting on the context that\u0027s using the cache having ensured it at some point previously.\n\ndeploy.py would call it without using the return value.\n\nIf the name is the problem, have a get_rc_cache that calls ensure and then returns the global.","commit_id":"59858faf8374211487a2bc8132b6e27dfd63e5de"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"3cb42d0f48f5cdc8a2fce0fbd3a73ae01a40fc8c","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from placement import db_api"},{"line_number":18,"context_line":"from placement import exception"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"RC_CACHE \u003d None"},{"line_number":21,"context_line":"_RC_TBL \u003d models.ResourceClass.__table__"},{"line_number":22,"context_line":"_LOCKNAME \u003d \u0027rc_cache\u0027"},{"line_number":23,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9fdfeff1_725b2d85","line":20,"range":{"start_line":20,"start_character":0,"end_line":20,"end_character":15},"in_reply_to":"9fdfeff1_ed3185a3","updated":"2019-02-28 23:56:35.000000000","message":"I mean this [1]. So we don\u0027t have to assume anything. Interestingly, that guy fails a couple of unit tests because in those code paths we haven\u0027t \"ensured\" (fakely, presumably) the cache yet.\n\nHaving actually done this, I recognize it\u0027s a bit icky; could be better putting some kind of\n\n RC_CACHE \u003d rc_cache.get_rc_cache(ctx_where_did_I_come_from)\n\nat the top of each module that needs it.\n\n[1] https://review.openstack.org/#/c/640226/","commit_id":"59858faf8374211487a2bc8132b6e27dfd63e5de"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"50e3891ee03b3ce90403cb9e46ad86143279735a","unresolved":false,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":26,"context_line":"def ensure_rc_cache(ctx):"},{"line_number":27,"context_line":"    \"\"\"Ensures that a singleton resource class cache has been created in the"},{"line_number":28,"context_line":"    module\u0027s scope."},{"line_number":29,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9fdfeff1_7260c0d0","line":26,"range":{"start_line":26,"start_character":4,"end_line":26,"end_character":19},"updated":"2019-03-05 14:18:45.000000000","message":"could just call this \"ensure\". Since it\u0027s redundant as the name of the module is \"resource_class_cache\"...","commit_id":"763fe86fa09e3a1d6ac0a92fb5bfa6ad50821a1b"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"81e791262a5637c4b7a7691b12ad00bff7bd1060","unresolved":false,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"@db_api.placement_context_manager.reader"},{"line_number":26,"context_line":"def ensure_rc_cache(ctx):"},{"line_number":27,"context_line":"    \"\"\"Ensures that a singleton resource class cache has been created in the"},{"line_number":28,"context_line":"    module\u0027s scope."},{"line_number":29,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"5fc1f717_1b4eab96","line":26,"range":{"start_line":26,"start_character":4,"end_line":26,"end_character":19},"in_reply_to":"9fdfeff1_7260c0d0","updated":"2019-03-26 22:51:52.000000000","message":"https://review.openstack.org/647946","commit_id":"763fe86fa09e3a1d6ac0a92fb5bfa6ad50821a1b"}]}
