)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"932c9587105a2dc0719ad4e50508691bbad5afd0","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Boden R \u003cbodenvmw@gmail.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-07-14 12:35:01 -0600"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"WIP: Rework callback API"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"DO NOT MERGE: This is a PoC/WIP"},{"line_number":10,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"dada55a8_7f3d0ec3","line":7,"updated":"2016-07-22 01:19:24.000000000","message":"btw I would have expected the bulk of this work (the one about formalizing the registry) to happen in neutron-lib","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"75be882995cda7d8e026a8daf297d1a326bf475f","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Boden R \u003cbodenvmw@gmail.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-07-14 12:35:01 -0600"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"WIP: Rework callback API"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"DO NOT MERGE: This is a PoC/WIP"},{"line_number":10,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"dada55a8_467303e8","line":7,"in_reply_to":"dada55a8_7f3d0ec3","updated":"2016-07-22 10:51:10.000000000","message":"I intentionally started here (in neutron) to get additional eyes/input on the patch. I\u0027m fine with doing the actual work in lib if that\u0027s what we think is the correct approach. As we discussed [1] baking in lib vs neutron is somewhat subjective.\n\n[1] http://goo.gl/6zlCPQ","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"932c9587105a2dc0719ad4e50508691bbad5afd0","unresolved":false,"context_lines":[{"line_number":11,"context_line":"While rehoming neutron\u0027s callback package/modules  into"},{"line_number":12,"context_line":"neutron-lib we decided that the callback APIs needed some"},{"line_number":13,"context_line":"rework before being made public in neutron-lib [1][2]. In particular,"},{"line_number":14,"context_line":" the use of **kwargs for notifications is error prone."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"While [2] attempted to scope notification resource/args to an"},{"line_number":17,"context_line":"OVO, there are existing usages of callbacks in our codebase"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"dada55a8_ff28de87","line":14,"updated":"2016-07-22 01:19:24.000000000","message":"Rather than being error prone, it lacks the required structure to make the callbacks/notifiers interface well defined. Now one can say that lead to errors :)","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"}],"neutron/callbacks/manager.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0410c2ea7de6e831987e023338a3267861cdf784","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        elif cb:"},{"line_number":160,"context_line":"            self.unsubscribe_all(cb)"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    # TODO(boden): make private in favor of unsubscribe_event()"},{"line_number":163,"context_line":"    def unsubscribe(self, callback, resource, event):"},{"line_number":164,"context_line":"        \"\"\"Unsubscribe callback from the registry."},{"line_number":165,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"1aa78d24_f9d9ccf5","line":162,"updated":"2016-07-14 18:02:00.000000000","message":"maybe you can have a decorator here that will overwrite the resource with the resource name. then upi can save line 170","commit_id":"8acedffa87eef6e4c6524e2de8715fbfc6f40896"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0410c2ea7de6e831987e023338a3267861cdf784","unresolved":false,"context_lines":[{"line_number":186,"context_line":"            value \u003d \u0027%s,%s\u0027 % (resource, event)"},{"line_number":187,"context_line":"            raise exceptions.Invalid(element\u003d\u0027resource,event\u0027, value\u003dvalue)"},{"line_number":188,"context_line":""},{"line_number":189,"context_line":"    # TODO(boden): make private in favor of unsubscribe_event()"},{"line_number":190,"context_line":"    def unsubscribe_by_resource(self, callback, resource):"},{"line_number":191,"context_line":"        \"\"\"Unsubscribe callback for any event associated to the resource."},{"line_number":192,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"1aa78d24_39e4f4aa","line":189,"updated":"2016-07-14 18:02:00.000000000","message":"ditto","commit_id":"8acedffa87eef6e4c6524e2de8715fbfc6f40896"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"932c9587105a2dc0719ad4e50508691bbad5afd0","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def _is_event_callback(callback):"},{"line_number":36,"context_line":"    arg_len \u003d 2 if inspect.ismethod(callback) else 1"},{"line_number":37,"context_line":"    return len(inspect.getargspec(callback).args) \u003d\u003d arg_len"}],"source_content_type":"text/x-python","patch_set":2,"id":"dada55a8_bfe66641","line":34,"updated":"2016-07-22 01:19:24.000000000","message":"I think the syntactic sugar of this file is largely unnecessary. As I said in a previous comment, encapsulation here is not serving a practical purpose. I\u0027d rather formalize the interface between notifiers and callbacks as far as payload goes. I was personally thinking more along the lines of [1]. This needs to be expanded for the other types of events, but nailing down the data store events will catch most of our use cases.\n\nThoughts?\n\n[1] https://review.openstack.org/#/c/345718/","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"75be882995cda7d8e026a8daf297d1a326bf475f","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"def _is_event_callback(callback):"},{"line_number":36,"context_line":"    arg_len \u003d 2 if inspect.ismethod(callback) else 1"},{"line_number":37,"context_line":"    return len(inspect.getargspec(callback).args) \u003d\u003d arg_len"}],"source_content_type":"text/x-python","patch_set":2,"id":"dada55a8_818cc580","line":34,"in_reply_to":"dada55a8_bfe66641","updated":"2016-07-22 10:51:10.000000000","message":"IMO this patch is serving its purpose; obtain a greater understanding of the real problem(s) we seek to solve and generate discussion as what our potential approaches are.\n\n\nThank you for 345718. I quickly parsed it, but need a little time to let it settle in. I haven\u0027t even finished my 1st cup of coffee so it\u0027s too early to be making any kind of decisions ;)","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"}],"neutron/callbacks/registry.py":[{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"35d7e283c3db72680f9b2244e00e82f2825b816a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"1aa78d24_f93f0cb3","updated":"2016-07-14 17:48:37.000000000","message":"If we decide we like the PoC approach, IMHO this how registry module seems to be overkill to provide access to a singleton.\n\nI\u0027d opt to just create a singleton manager.CallbackManager in __init__.py and have consumers access/use it directly rather than the wrapper API in here (registry.py)","commit_id":"8acedffa87eef6e4c6524e2de8715fbfc6f40896"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3df79976f0c1ca3e783d263879e98ad8a44cdb34","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"1aa78d24_03a1c646","updated":"2016-07-14 19:03:45.000000000","message":"If we decide we like the PoC approach, IMHO this how registry module seems to be overkill to provide access to a singleton.\nI\u0027d opt to just create a singleton manager.CallbackManager in __init__.py and have consumers access/use it directly rather than the wrapper API in here (registry.py)","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"b461396852312dda6747c0fb1741f21f06cb3f8e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"1aa78d24_06b6f4f8","in_reply_to":"1aa78d24_03a1c646","updated":"2016-07-14 19:24:15.000000000","message":"the registry is handy to simplify the import/use process.\n\nI only gave a quick glance to this and I am going to take more time to look into it, but at first it seems to me that you haven\u0027t really solved the the crux of the matter, which is how to express the payload of the \u0027message\u0027.\n\nYou encapsulated callbacks, triggers, events and resources which arguably are the ones that need the encapsulation the least. So the PoC leads to a more cumbersome registry usage IMO, as shown but the changes needed.","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"b5af7392d5824ee263175d1631f97fa9fe98b617","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"1aa78d24_ea342be0","in_reply_to":"1aa78d24_06b6f4f8","updated":"2016-07-15 10:41:38.000000000","message":"Armando: thx for initial feedback.\n\n\nBased on the discussions in the previous patches in this space (see commit message for refs), I was under the impression the main problem was passing arbitrary **kwargs and the potential for their naming collisions. This patch IMHO does solve that problem.\n\n\nI\u0027ll take another look through our existing usage of the callback API and see if any payload standardization pops out to me. As mentioned in the commit message I question if something like OVO is too \"strict\" of a (payload) requirement for consumers wanting to notify().\n\n\nI look forward to your additional comments (when you get time) so that we can work to address any and all \"matters\" here.","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"a915efafb40463c21022aae5aebb3911fb8a06d0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"fad55976_447ca220","in_reply_to":"1aa78d24_ea342be0","updated":"2016-07-15 15:51:50.000000000","message":"The use of kwargs and naming collision is not where the usability issue lies. Both can be solved with testing. I mentioned that to Paul when he proposed something similar [1].\n\n[1] https://review.openstack.org/#/c/265997/","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"23df7d4cc446c7e5a4a55a051ee79e92a1e07ee0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"fad55976_c134f6df","in_reply_to":"fad55976_447ca220","updated":"2016-07-15 21:26:42.000000000","message":"Ack.\n\nThis approach in this patch supports using OVO (or any other object) as the \u0027resource\u0027 which is then directly accessible to the caller, but took a general approach by not putting a hard requirement on OVO as the payload. It\u0027s use of the \u0027extras\u0027 dict is more-so something to use while perhaps phasing to a standardized payload (OVO or other).\n\nSo this patch doesn\u0027t propose anything as a standardized payload per say, rather it enables callbacks to support any object as that payload and an optional \u0027extras\u0027 dict for those who just aren\u0027t ready yet.\n\nWhat I was really hoping to drive with this patch initially is a discussion as to if OVO is really the right payload.","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"d35fce2ef5818bf8626dae4fcf276a2725aa0acb","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"dada55a8_ced1b3fd","in_reply_to":"fad55976_61654ae0","updated":"2016-07-18 14:52:30.000000000","message":"This is probably obvious, but just so it\u0027s explicit; the idea here is that OVO could be used where it makes sense.\n\nFor example from [1]:\n----\n# subscriber code:\n# subscribe for both SubPort and SubPorts events\nregistry.subscribe_event(CallbackSubscription(subport_create, [trunk_objects.SubPort], events.AFTER_CREATE))\n\ndef subport_create(notification_event):\n    for subport_ovo in notification_event.resource:\n        # something useful with subport ovo\n\n\n# notifier code (ex: [1]):\n# notify on subports create\nregistry.notify(added_subports, events.AFTER_CREATE, self)\n----\n\nAs shown above, the OVO refs are used as the resource in the notification event and are directly available to the subscribers.\n\n\n\n\nOr, in cases where OVO perhaps doesn\u0027t make sense such as [2]:\n----\n\n# subscriber code:\nregistry.subscribe_event(CallbackSubscription(worker_init, neutron_worker.NeutronWorker, events.AFTER_INIT))\n\ndef worker_init(notification_event):\n    worker \u003d notification_event.resource\n\n\n# notifier code (ex: [2]):\nregistry.notify(self, events.AFTER_INIT, self)\n----\n\n\n\nSo to (re)summarize:\n- This patch allows OVO or any other object to be used as both the payload and resource \"key\", but doesn\u0027t force any particular type.\n- It\u0027s backwards compatible; allows us to phase-in a new approach.\n- IF we could agree OVO is a good standard event resource, we can begin to update neutron code as it\u0027s OVO becomes available (where applicable).\n\n\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/services/trunk/plugin.py#L143\n[2] https://github.com/openstack/neutron/blob/master/neutron/worker.py#L92","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"63facca5dcbbe9382afbbb23aab5da4f3ae41121","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"fad55976_61654ae0","in_reply_to":"fad55976_c134f6df","updated":"2016-07-15 21:28:34.000000000","message":"Note: \"caller\" in my previous comment probably should\u0027ve been \"subscription callback\".","commit_id":"a224cfe52002aa41216fc5c9e44566a2fd631840"}]}
