)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":5313,"name":"David Peraza","email":"david_peraza@persistentsys.com","username":"dperaza"},"change_message_id":"1ea13370f5edfc5da3ea65440d48e2b50d6c7b72","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"The get_resources() will use the FileResourceLoader to load the"},{"line_number":29,"context_line":"resources from the file /foo/bar. For the other resource"},{"line_number":30,"context_line":"\u0027ipmi://1.2.3.4\u0027 since there is no mapping resource loader can be found,"},{"line_number":31,"context_line":"it will assume it\u0027s the actual resource to be return. So the returned"},{"line_number":32,"context_line":"list of get_resources() is: [\u0027snmp://1.1.1.1\u0027, \u0027snmp://2.2.2.2\u0027,"},{"line_number":33,"context_line":"\u0027ipmi://1.2.3.4\u0027]."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"AAAATn%2F90vI%3D","line":30,"updated":"2013-12-05 15:11:32.000000000","message":"nit: \"can be found\" or \"there is no\"  clean this sentence","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"3c62d41ac8132c779d2efd89e2d1eff614a62401","unresolved":false,"context_lines":[{"line_number":27,"context_line":""},{"line_number":28,"context_line":"The get_resources() will use the FileResourceLoader to load the"},{"line_number":29,"context_line":"resources from the file /foo/bar. For the other resource"},{"line_number":30,"context_line":"\u0027ipmi://1.2.3.4\u0027 since there is no mapping resource loader can be found,"},{"line_number":31,"context_line":"it will assume it\u0027s the actual resource to be return. So the returned"},{"line_number":32,"context_line":"list of get_resources() is: [\u0027snmp://1.1.1.1\u0027, \u0027snmp://2.2.2.2\u0027,"},{"line_number":33,"context_line":"\u0027ipmi://1.2.3.4\u0027]."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"AAAATn%2F9X2A%3D","line":30,"in_reply_to":"AAAATn%2F90vI%3D","updated":"2013-12-12 05:36:35.000000000","message":"Done","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"}],"ceilometer/central/manager.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"28c8affa745e31db65d686cac576473a77cce2ae","unresolved":false,"context_lines":[{"line_number":43,"context_line":"                try:"},{"line_number":44,"context_line":"                    LOG.info(\"Polling pollster %s\", pollster.name)"},{"line_number":45,"context_line":"                    resources \u003d list(self.resources[pollster.name])"},{"line_number":46,"context_line":"                    # using resource loader to dynamically load resources"},{"line_number":47,"context_line":"                    resources \u003d resourceloader.get_resources(resources)"},{"line_number":48,"context_line":"                    pollster.obj.verify_resources(self.manager, resources)"},{"line_number":49,"context_line":"                    samples \u003d list(pollster.obj.get_samples("}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BK3Y%3D","line":46,"updated":"2013-11-29 23:36:23.000000000","message":"Do we want to re-scan the resources (and reload any from separate files or wherever they come from) every single time we wake up to poll, and for every pollster? That\u0027s going to mean re-processing the file(s) many many times when they haven\u0027t changed.","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"9b77ba2d23fd434ecfc24e7b5dae87ea5105aa09","unresolved":false,"context_lines":[{"line_number":43,"context_line":"                try:"},{"line_number":44,"context_line":"                    LOG.info(\"Polling pollster %s\", pollster.name)"},{"line_number":45,"context_line":"                    resources \u003d list(self.resources[pollster.name])"},{"line_number":46,"context_line":"                    # using resource loader to dynamically load resources"},{"line_number":47,"context_line":"                    resources \u003d resourceloader.get_resources(resources)"},{"line_number":48,"context_line":"                    pollster.obj.verify_resources(self.manager, resources)"},{"line_number":49,"context_line":"                    samples \u003d list(pollster.obj.get_samples("}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BIvg%3D","line":46,"in_reply_to":"AAAATn%2F%2BK3Y%3D","updated":"2013-12-03 03:25:17.000000000","message":"ok, I\u0027ll put a PollingTask scope cache of resources here.","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"}],"ceilometer/resourceloader/__init__.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"28c8affa745e31db65d686cac576473a77cce2ae","unresolved":false,"context_lines":[{"line_number":40,"context_line":"    :param clean_cache: True indicating clean the whole cache"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    \"\"\""},{"line_number":43,"context_line":"    global _LOADER_CACHE"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    loaded_resources \u003d []"},{"line_number":46,"context_line":"    for res in resources:"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BK3M%3D","line":43,"updated":"2013-11-29 23:36:23.000000000","message":"_LOADER_CACHE only needs to be declared as a global if something is going to be assigned to the name. I don\u0027t see that happening in this function.","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"28c8affa745e31db65d686cac576473a77cce2ae","unresolved":false,"context_lines":[{"line_number":73,"context_line":"    :param namespace: Namespace to use to look for drivers."},{"line_number":74,"context_line":"    \"\"\""},{"line_number":75,"context_line":"    parse_result \u003d network_utils.urlsplit(url)"},{"line_number":76,"context_line":"    loaded_driver \u003d driver.DriverManager(namespace, parse_result.scheme)"},{"line_number":77,"context_line":"    return loaded_driver.driver(parse_result)"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BK3U%3D","line":76,"updated":"2013-11-29 23:36:23.000000000","message":"I\u0027m not sure you\u0027re using the right manager here. I think you want a single ExtensionManager that you load one time, and then access as mgr[parse_result.scheme] to get the one plugin that you want for the given URL. Otherwise you end up scanning the plugin set every time you go to process a URL, and that is going to be very expensive. Doing it that way would mean you don\u0027t need the _LOADER_CACHE above, I think, since the plugin would stay in the ExtensionManager.","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"9b77ba2d23fd434ecfc24e7b5dae87ea5105aa09","unresolved":false,"context_lines":[{"line_number":73,"context_line":"    :param namespace: Namespace to use to look for drivers."},{"line_number":74,"context_line":"    \"\"\""},{"line_number":75,"context_line":"    parse_result \u003d network_utils.urlsplit(url)"},{"line_number":76,"context_line":"    loaded_driver \u003d driver.DriverManager(namespace, parse_result.scheme)"},{"line_number":77,"context_line":"    return loaded_driver.driver(parse_result)"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BJCw%3D","line":76,"in_reply_to":"AAAATn%2F%2BK3U%3D","updated":"2013-12-03 03:25:17.000000000","message":"Done","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"},{"author":{"_account_id":5313,"name":"David Peraza","email":"david_peraza@persistentsys.com","username":"dperaza"},"change_message_id":"1ea13370f5edfc5da3ea65440d48e2b50d6c7b72","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            from_cache \u003d False"},{"line_number":73,"context_line":"            parsed_url \u003d network_utils.urlsplit(res)"},{"line_number":74,"context_line":"            try:"},{"line_number":75,"context_line":"                loader \u003d _resloadermgr[parsed_url.scheme].obj"},{"line_number":76,"context_line":"            except KeyError:"},{"line_number":77,"context_line":"                pass"},{"line_number":78,"context_line":"            if loader:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F90rc%3D","line":75,"updated":"2013-12-05 15:11:32.000000000","message":"I prefer using key in dictionary construct rather than let it except and swallow exception.","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"3c62d41ac8132c779d2efd89e2d1eff614a62401","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            from_cache \u003d False"},{"line_number":73,"context_line":"            parsed_url \u003d network_utils.urlsplit(res)"},{"line_number":74,"context_line":"            try:"},{"line_number":75,"context_line":"                loader \u003d _resloadermgr[parsed_url.scheme].obj"},{"line_number":76,"context_line":"            except KeyError:"},{"line_number":77,"context_line":"                pass"},{"line_number":78,"context_line":"            if loader:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F9X20%3D","line":75,"in_reply_to":"AAAATn%2F90rc%3D","updated":"2013-12-12 05:36:35.000000000","message":"_resloadermgr is an object of class extension.ExtensionManager, not a dict. It doesn\u0027t support operator in.","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"},{"author":{"_account_id":5313,"name":"David Peraza","email":"david_peraza@persistentsys.com","username":"dperaza"},"change_message_id":"ae9486f1781828831396c8191f1c8f49e2bd7942","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            from_cache \u003d False"},{"line_number":73,"context_line":"            parsed_url \u003d network_utils.urlsplit(res)"},{"line_number":74,"context_line":"            try:"},{"line_number":75,"context_line":"                loader \u003d _resloadermgr[parsed_url.scheme].obj"},{"line_number":76,"context_line":"            except KeyError:"},{"line_number":77,"context_line":"                pass"},{"line_number":78,"context_line":"            if loader:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F9VfM%3D","line":75,"in_reply_to":"AAAATn%2F9X20%3D","updated":"2013-12-12 15:00:09.000000000","message":"oh I see","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"607fc69a64b2d57fc75d15c7fabf6a1aa5a65ed2","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    _resloadermgr \u003d extension.ExtensionManager(namespace\u003dnamespace,"},{"line_number":41,"context_line":"                                               invoke_on_load\u003dTrue)"},{"line_number":42,"context_line":"    if not list(_resloadermgr):"},{"line_number":43,"context_line":"        LOG.warning(_(\u0027Failed to load any notification handlers for %s\u0027),"},{"line_number":44,"context_line":"                    namespace)"},{"line_number":45,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAATn%2F9CtM%3D","line":42,"updated":"2013-12-17 11:59:11.000000000","message":"is it a valid message? I guess it should be \u0027Failed to load any resource loaders\u0027","commit_id":"17ada6c1804e505cb9754d8395b04473114ef68a"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"5129e9cab85c551bef2a385a3efcff386ae22da9","unresolved":false,"context_lines":[{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    _resloadermgr \u003d extension.ExtensionManager(namespace\u003dnamespace,"},{"line_number":41,"context_line":"                                               invoke_on_load\u003dTrue)"},{"line_number":42,"context_line":"    if not list(_resloadermgr):"},{"line_number":43,"context_line":"        LOG.warning(_(\u0027Failed to load any notification handlers for %s\u0027),"},{"line_number":44,"context_line":"                    namespace)"},{"line_number":45,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAATn%2F8%2BdY%3D","line":42,"in_reply_to":"AAAATn%2F9CtM%3D","updated":"2013-12-18 07:47:57.000000000","message":"Good catch. Sorry for the silly mistake","commit_id":"17ada6c1804e505cb9754d8395b04473114ef68a"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"fbfa2a7e28563695c78976ef4057d815b948aebb","unresolved":false,"context_lines":[{"line_number":35,"context_line":"    global _resloadermgr"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    namespace \u003d \u0027ceilometer.resourceloader\u0027"},{"line_number":38,"context_line":"    LOG.debug(_(\u0027loading resource loaders from %s\u0027), namespace)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    _resloadermgr \u003d extension.ExtensionManager(namespace\u003dnamespace,"},{"line_number":41,"context_line":"                                               invoke_on_load\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FSAA%3D","line":38,"updated":"2014-01-15 14:54:38.000000000","message":"s/loading/Loading/","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"baa5665fe871338c37b819fa6bc8b363d43b2aad","unresolved":false,"context_lines":[{"line_number":35,"context_line":"    global _resloadermgr"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    namespace \u003d \u0027ceilometer.resourceloader\u0027"},{"line_number":38,"context_line":"    LOG.debug(_(\u0027loading resource loaders from %s\u0027), namespace)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    _resloadermgr \u003d extension.ExtensionManager(namespace\u003dnamespace,"},{"line_number":41,"context_line":"                                               invoke_on_load\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FPGA%3D","line":38,"in_reply_to":"AAAAUH%2F%2FSAA%3D","updated":"2014-01-16 03:32:43.000000000","message":"Done","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"fbfa2a7e28563695c78976ef4057d815b948aebb","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                LOG.debug(_(\"No loader for resource %s\") % res)"},{"line_number":83,"context_line":"                cached_resources.extend([res])"},{"line_number":84,"context_line":"            # save to cache"},{"line_number":85,"context_line":"            cache[res] \u003d cached_resources"},{"line_number":86,"context_line":"        loaded_resources.extend(cached_resources)"},{"line_number":87,"context_line":"    return (from_cache, loaded_resources)"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FR9Y%3D","line":85,"updated":"2014-01-15 14:54:38.000000000","message":"is it possible to have a resource defined in pipeline.yaml and a \u0027loader\u0027 at the same time? how does that work?... it seems like here it\u0027ll end up adding it as duplicate...\n\nmaybe have a test for this to ensure whatever expected result is stays the same.","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"baa5665fe871338c37b819fa6bc8b363d43b2aad","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                LOG.debug(_(\"No loader for resource %s\") % res)"},{"line_number":83,"context_line":"                cached_resources.extend([res])"},{"line_number":84,"context_line":"            # save to cache"},{"line_number":85,"context_line":"            cache[res] \u003d cached_resources"},{"line_number":86,"context_line":"        loaded_resources.extend(cached_resources)"},{"line_number":87,"context_line":"    return (from_cache, loaded_resources)"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FPEA%3D","line":85,"in_reply_to":"AAAAUH%2F%2FR9Y%3D","updated":"2014-01-16 03:32:43.000000000","message":"yes, it\u0027s possible. For any arbitrary resource defined in the pipeline, if we can find a corresponding resource loader we\u0027ll use that resource loader to load the actual resources to be used by pollster later; if NOT, we assume the resource itself is the actual resource to be used by the pollster.\n\nI think the current test already covered this by setting the resources list in the pipeline as one fake loader and one fake res. Please see tests/resourceloader/test_loader.TestResourceLoader.test_get_resources()","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"eb0e48b36f137d01b9162d9d6c18578ad89ae747","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"LOG \u003d log.getLogger(__name__)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"_resloadermgr \u003d None"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"def _init_resourceloader_manager():"}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAUH%2F%2FLtQ%3D","line":31,"updated":"2014-01-16 17:07:54.000000000","message":"I\u0027m tired of global variable, no more please. :)","commit_id":"790a7f0e9eb2c1fdf935a2e932fb67476447ec2f"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"885a694cd992d00b34b450808a1dce0ed35989bb","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"LOG \u003d log.getLogger(__name__)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"_resloadermgr \u003d None"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"def _init_resourceloader_manager():"}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAUH%2F%2FI6Y%3D","line":31,"in_reply_to":"AAAAUH%2F%2FLtQ%3D","updated":"2014-01-17 02:50:51.000000000","message":"ok, i\u0027ll move it into central agent.","commit_id":"790a7f0e9eb2c1fdf935a2e932fb67476447ec2f"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"49832746394a0ff0494c0ada42275f1622a04b08","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                # We only save the resources NOT from loader into cache."},{"line_number":83,"context_line":"                # Resource loader should be used every time for dynamic"},{"line_number":84,"context_line":"                # loading the resources."},{"line_number":85,"context_line":"                cache[res] \u003d cached_resources"},{"line_number":86,"context_line":"        loaded_resources.extend(cached_resources)"},{"line_number":87,"context_line":"    return loaded_resources"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAUH%2F%2FMNs%3D","line":85,"updated":"2014-01-16 16:00:27.000000000","message":"the scenario i was thinking was this:\nif we have a loader and a resource defined in pipeline.yaml:\n- loader://file\n- res1\n\nbut in loader file, it also contains res1 as a resource. is this a scenario that we need to cover?","commit_id":"790a7f0e9eb2c1fdf935a2e932fb67476447ec2f"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"885a694cd992d00b34b450808a1dce0ed35989bb","unresolved":false,"context_lines":[{"line_number":82,"context_line":"                # We only save the resources NOT from loader into cache."},{"line_number":83,"context_line":"                # Resource loader should be used every time for dynamic"},{"line_number":84,"context_line":"                # loading the resources."},{"line_number":85,"context_line":"                cache[res] \u003d cached_resources"},{"line_number":86,"context_line":"        loaded_resources.extend(cached_resources)"},{"line_number":87,"context_line":"    return loaded_resources"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAUH%2F%2FI8A%3D","line":85,"in_reply_to":"AAAAUH%2F%2FMNs%3D","updated":"2014-01-17 02:50:51.000000000","message":"Ah, I got what you mean. Yes, we need to cover that by using set(). Thanks for finding this.","commit_id":"790a7f0e9eb2c1fdf935a2e932fb67476447ec2f"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"b9eea6437aac3093a76227cbf0f4d7518e8f3193","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# -*- encoding: utf-8 -*-"},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"# Copyright © 2013 Intel Corp."},{"line_number":4,"context_line":"#"},{"line_number":5,"context_line":"# Author: Lianhao Lu \u003clianhao.lu@intel.com\u003e"},{"line_number":6,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAUH%2F%2FGvw%3D","line":3,"updated":"2014-01-17 12:08:38.000000000","message":"s/2013/2014/g","commit_id":"1054209f51f61f06ec6edec6ea72c93654d06c71"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"b9eea6437aac3093a76227cbf0f4d7518e8f3193","unresolved":false,"context_lines":[{"line_number":40,"context_line":"    return resloadermgr"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"def get_resources(mgr, resources, cache\u003d{}):"},{"line_number":44,"context_line":"    \"\"\"Using appropriate resources loader to load the resources. Return the"},{"line_number":45,"context_line":"    resources loaded by the resource loaders."},{"line_number":46,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAUH%2F%2FGtE%3D","line":43,"updated":"2014-01-17 12:08:38.000000000","message":"Re:\n\n  ..., cache\u003d{})\n\nA mutable default is generally a very bad idea, because counter-intuitively any modifications persist across method calls, e.g.:\n\n  def foo(d\u003d{}):\n      print \u0027d: %s\u0027 % d\n      d[\u0027bar\u0027] \u003d \u0027snafu\u0027\n\n  \u003e\u003e\u003e foo()\n  d: {}\n  \u003e\u003e\u003e foo()\n  d: {\u0027bar\u0027: \u0027snafu\u0027}\n\nThis is generally either not the effect intended or else too subtle a side-effect for subsequent maintainers of the code.","commit_id":"1054209f51f61f06ec6edec6ea72c93654d06c71"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"b9eea6437aac3093a76227cbf0f4d7518e8f3193","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    for res in resources:"},{"line_number":57,"context_line":"        cached \u003d cache.get(res, set())"},{"line_number":58,"context_line":"        if cached:"},{"line_number":59,"context_line":"            LOG.debug(_(\"Cache found for resource %s\") % res)"},{"line_number":60,"context_line":"        else:"},{"line_number":61,"context_line":"            # no cache found"},{"line_number":62,"context_line":"            loader \u003d None"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAUH%2F%2FGqQ%3D","line":59,"updated":"2014-01-17 12:08:38.000000000","message":"Even if cached resources exist, should we also have the loader check to see if a reload is necessary?\n\nFor example by checking the file timestamp in the case of a fileloader.\n\nOr in the case of a URL loader, using an ETag \u0026 If-None-Match to check if an explicit reload is required.\n\n(In the latter example, that would seem to imply that the cache should be available to the loader to stash ancillary data such as the ETag.","commit_id":"1054209f51f61f06ec6edec6ea72c93654d06c71"}],"ceilometer/resourceloader/file.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"28c8affa745e31db65d686cac576473a77cce2ae","unresolved":false,"context_lines":[{"line_number":38,"context_line":"            counters:"},{"line_number":39,"context_line":"                - \"*\""},{"line_number":40,"context_line":"            resources:"},{"line_number":41,"context_line":"                - fileloader:///foo/bar"},{"line_number":42,"context_line":"            transformers:"},{"line_number":43,"context_line":"            publishers:"},{"line_number":44,"context_line":"                - rpc://"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BK3I%3D","line":41,"updated":"2013-11-29 23:36:23.000000000","message":"How about just \"file\" instead of \"fileloader\"?","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"9b77ba2d23fd434ecfc24e7b5dae87ea5105aa09","unresolved":false,"context_lines":[{"line_number":38,"context_line":"            counters:"},{"line_number":39,"context_line":"                - \"*\""},{"line_number":40,"context_line":"            resources:"},{"line_number":41,"context_line":"                - fileloader:///foo/bar"},{"line_number":42,"context_line":"            transformers:"},{"line_number":43,"context_line":"            publishers:"},{"line_number":44,"context_line":"                - rpc://"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BIwM%3D","line":41,"in_reply_to":"AAAATn%2F%2BK3I%3D","updated":"2013-12-03 03:25:17.000000000","message":"Because we not only allow to put URL to indicating resource loader in the pipeline resources definition, but also the URL to directly indicating the endpoints, I deliberately use \u0027fileloader://\u0027 in case someone want to use \u0027file://\u0027 to indicating the file itself as the endpoint.","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"28c8affa745e31db65d686cac576473a77cce2ae","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def load_resources(self):"},{"line_number":53,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(self.parsed_url.path)"},{"line_number":54,"context_line":"        resources \u003d yaml.safe_load(data)"},{"line_number":55,"context_line":"        if not isinstance(resources, list):"},{"line_number":56,"context_line":"            msg \u003d _(\"Illegal content of the resource file \""},{"line_number":57,"context_line":"                    \"%s\") % self.parsed_url.path"},{"line_number":58,"context_line":"            LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BK3E%3D","line":55,"updated":"2013-11-29 23:36:23.000000000","message":"This should throw an exception and let the caller decide whether to ignore it.","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"9b77ba2d23fd434ecfc24e7b5dae87ea5105aa09","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def load_resources(self):"},{"line_number":53,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(self.parsed_url.path)"},{"line_number":54,"context_line":"        resources \u003d yaml.safe_load(data)"},{"line_number":55,"context_line":"        if not isinstance(resources, list):"},{"line_number":56,"context_line":"            msg \u003d _(\"Illegal content of the resource file \""},{"line_number":57,"context_line":"                    \"%s\") % self.parsed_url.path"},{"line_number":58,"context_line":"            LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2BIwI%3D","line":55,"in_reply_to":"AAAATn%2F%2BK3E%3D","updated":"2013-12-03 03:25:17.000000000","message":"Done","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"},{"author":{"_account_id":5313,"name":"David Peraza","email":"david_peraza@persistentsys.com","username":"dperaza"},"change_message_id":"1ea13370f5edfc5da3ea65440d48e2b50d6c7b72","unresolved":false,"context_lines":[{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def load_resources(self, parsed_url):"},{"line_number":62,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(parsed_url.path)"},{"line_number":63,"context_line":"        resources \u003d yaml.safe_load(data)"},{"line_number":64,"context_line":"        if not isinstance(resources, list):"},{"line_number":65,"context_line":"            msg \u003d _(\"Resources not defined as list\")"},{"line_number":66,"context_line":"            raise FileResourceLoaderException(msg, parsed_url.path)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F90qA%3D","line":63,"updated":"2013-12-05 15:11:32.000000000","message":"I would add more error handling around yaml.safe_load. For example Log the url path. I would say yaml syntax issues would be common if these files can be edited by user.","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"3c62d41ac8132c779d2efd89e2d1eff614a62401","unresolved":false,"context_lines":[{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def load_resources(self, parsed_url):"},{"line_number":62,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(parsed_url.path)"},{"line_number":63,"context_line":"        resources \u003d yaml.safe_load(data)"},{"line_number":64,"context_line":"        if not isinstance(resources, list):"},{"line_number":65,"context_line":"            msg \u003d _(\"Resources not defined as list\")"},{"line_number":66,"context_line":"            raise FileResourceLoaderException(msg, parsed_url.path)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F9X6M%3D","line":63,"in_reply_to":"AAAATn%2F90qA%3D","updated":"2013-12-12 05:36:35.000000000","message":"Done","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"},{"author":{"_account_id":5313,"name":"David Peraza","email":"david_peraza@persistentsys.com","username":"dperaza"},"change_message_id":"1ea13370f5edfc5da3ea65440d48e2b50d6c7b72","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        if not isinstance(resources, list):"},{"line_number":65,"context_line":"            msg \u003d _(\"Resources not defined as list\")"},{"line_number":66,"context_line":"            raise FileResourceLoaderException(msg, parsed_url.path)"},{"line_number":67,"context_line":"        else:"},{"line_number":68,"context_line":"            return resources"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F90ps%3D","line":67,"updated":"2013-12-05 15:11:32.000000000","message":"no need for else","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"3c62d41ac8132c779d2efd89e2d1eff614a62401","unresolved":false,"context_lines":[{"line_number":64,"context_line":"        if not isinstance(resources, list):"},{"line_number":65,"context_line":"            msg \u003d _(\"Resources not defined as list\")"},{"line_number":66,"context_line":"            raise FileResourceLoaderException(msg, parsed_url.path)"},{"line_number":67,"context_line":"        else:"},{"line_number":68,"context_line":"            return resources"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F9X7g%3D","line":67,"in_reply_to":"AAAATn%2F90ps%3D","updated":"2013-12-12 05:36:35.000000000","message":"Done","commit_id":"cd1a3ed0bc424465ea9c462ffcb9175d055ee88b"},{"author":{"_account_id":7478,"name":"Nadya Shakhat","email":"nadmi4@gmail.com","username":"nprivalova"},"change_message_id":"607fc69a64b2d57fc75d15c7fabf6a1aa5a65ed2","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(parsed_url.path)"},{"line_number":63,"context_line":"        try:"},{"line_number":64,"context_line":"            resources \u003d yaml.safe_load(data)"},{"line_number":65,"context_line":"        except yaml.YAMLError as exc:"},{"line_number":66,"context_line":"            LOG.exception(_(\"Error in resource file %s\"), parsed_url.path)"},{"line_number":67,"context_line":"            raise exc"},{"line_number":68,"context_line":"        if not isinstance(resources, list):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAATn%2F9Cro%3D","line":65,"updated":"2013-12-17 11:59:11.000000000","message":"IMHO it would be clearer if the message will be \u0027Syntax error in resource file\u0027. Just a suggestion","commit_id":"17ada6c1804e505cb9754d8395b04473114ef68a"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"5129e9cab85c551bef2a385a3efcff386ae22da9","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(parsed_url.path)"},{"line_number":63,"context_line":"        try:"},{"line_number":64,"context_line":"            resources \u003d yaml.safe_load(data)"},{"line_number":65,"context_line":"        except yaml.YAMLError as exc:"},{"line_number":66,"context_line":"            LOG.exception(_(\"Error in resource file %s\"), parsed_url.path)"},{"line_number":67,"context_line":"            raise exc"},{"line_number":68,"context_line":"        if not isinstance(resources, list):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAATn%2F8%2BdI%3D","line":65,"in_reply_to":"AAAATn%2F9Cro%3D","updated":"2013-12-18 07:47:57.000000000","message":"Done","commit_id":"17ada6c1804e505cb9754d8395b04473114ef68a"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"fbfa2a7e28563695c78976ef4057d815b948aebb","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class FileResourceLoaderException(res.ResourceLoaderException):"},{"line_number":30,"context_line":"    def __init__(self, message, path):"},{"line_number":31,"context_line":"        self.message \u003d message"},{"line_number":32,"context_line":"        self.fn \u003d str(path)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def __str__(self):"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FSDg%3D","line":31,"updated":"2014-01-15 14:54:38.000000000","message":"super(FileResourceLoaderException, self).__init__(message) to match other exceptions","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"baa5665fe871338c37b819fa6bc8b363d43b2aad","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"class FileResourceLoaderException(res.ResourceLoaderException):"},{"line_number":30,"context_line":"    def __init__(self, message, path):"},{"line_number":31,"context_line":"        self.message \u003d message"},{"line_number":32,"context_line":"        self.fn \u003d str(path)"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def __str__(self):"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FPGo%3D","line":31,"in_reply_to":"AAAAUH%2F%2FSDg%3D","updated":"2014-01-16 03:32:43.000000000","message":"Done","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"fbfa2a7e28563695c78976ef4057d815b948aebb","unresolved":false,"context_lines":[{"line_number":39,"context_line":"    \"\"\"Load the resources from a file."},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    To use this loader, add the following section to file"},{"line_number":42,"context_line":"    /etc/ceilometer/publisher.yaml or simply add it to an existing pipeline."},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"        -"},{"line_number":45,"context_line":"            name: resource_file"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FSDA%3D","line":42,"updated":"2014-01-15 14:54:38.000000000","message":"is publisher.yaml a new file or is it suppose to be pipeline.yaml?","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"baa5665fe871338c37b819fa6bc8b363d43b2aad","unresolved":false,"context_lines":[{"line_number":39,"context_line":"    \"\"\"Load the resources from a file."},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    To use this loader, add the following section to file"},{"line_number":42,"context_line":"    /etc/ceilometer/publisher.yaml or simply add it to an existing pipeline."},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"        -"},{"line_number":45,"context_line":"            name: resource_file"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FPG8%3D","line":42,"in_reply_to":"AAAAUH%2F%2FSDA%3D","updated":"2014-01-16 03:32:43.000000000","message":"Done","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"fbfa2a7e28563695c78976ef4057d815b948aebb","unresolved":false,"context_lines":[{"line_number":59,"context_line":"    \"\"\""},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def load_resources(self, parsed_url):"},{"line_number":62,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(parsed_url.path)"},{"line_number":63,"context_line":"        try:"},{"line_number":64,"context_line":"            resources \u003d yaml.safe_load(data)"},{"line_number":65,"context_line":"        except yaml.YAMLError as exc:"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FSAo%3D","line":62,"updated":"2014-01-15 14:54:38.000000000","message":"do we need to set force_reload param to True? i\u0027m not sure if we\u0027re supporting dynamic loading or if it requires a service restart each time we mod resource list","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"689d098702575b2eaac6531c1725fcb79b26f3cb","unresolved":false,"context_lines":[{"line_number":59,"context_line":"    \"\"\""},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def load_resources(self, parsed_url):"},{"line_number":62,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(parsed_url.path)"},{"line_number":63,"context_line":"        try:"},{"line_number":64,"context_line":"            resources \u003d yaml.safe_load(data)"},{"line_number":65,"context_line":"        except yaml.YAMLError as exc:"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FMPc%3D","line":62,"in_reply_to":"AAAAUH%2F%2FPGU%3D","updated":"2014-01-16 15:55:23.000000000","message":"ah, i misread the purpose of the param. you\u0027re right.","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"baa5665fe871338c37b819fa6bc8b363d43b2aad","unresolved":false,"context_lines":[{"line_number":59,"context_line":"    \"\"\""},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def load_resources(self, parsed_url):"},{"line_number":62,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(parsed_url.path)"},{"line_number":63,"context_line":"        try:"},{"line_number":64,"context_line":"            resources \u003d yaml.safe_load(data)"},{"line_number":65,"context_line":"        except yaml.YAMLError as exc:"}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUH%2F%2FPGU%3D","line":62,"in_reply_to":"AAAAUH%2F%2FSAo%3D","updated":"2014-01-16 03:32:43.000000000","message":"With the resource loader, yes, we kind of dynamic loading. Instead of change the resources definition(e.g. fileloader:///foo/bar) in the pipeline file, we change the content of the file /foo/bar. The  fileutils.read_cached_file can detect the changes and reload the content.\n\nI don\u0027t think we need to set force_reload to be True. If the file doesn\u0027t change, we can just reuse the content from the file cache in the fileutils module.","commit_id":"1462c41e17a53d092e219ded067b6dffb5001463"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"b9eea6437aac3093a76227cbf0f4d7518e8f3193","unresolved":false,"context_lines":[{"line_number":47,"context_line":"            counters:"},{"line_number":48,"context_line":"                - \"*\""},{"line_number":49,"context_line":"            resources:"},{"line_number":50,"context_line":"                - fileloader:///foo/bar"},{"line_number":51,"context_line":"            transformers:"},{"line_number":52,"context_line":"            publishers:"},{"line_number":53,"context_line":"                - rpc://"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAUH%2F%2FGpk%3D","line":50,"updated":"2014-01-17 12:08:38.000000000","message":"A couple of thoughts about this ...\n\n1. Why not just \u0027file://\u0027 as opposed to \u0027fileloader://\u0027 as the URL scheme?\n\n2. How about separating the list of explicit resources and resource-loaders into two disjoint lists in the pipeline config? (seems these things are sufficiently different to warrant separation)","commit_id":"1054209f51f61f06ec6edec6ea72c93654d06c71"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"b9eea6437aac3093a76227cbf0f4d7518e8f3193","unresolved":false,"context_lines":[{"line_number":59,"context_line":"    \"\"\""},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def load_resources(self, parsed_url):"},{"line_number":62,"context_line":"        reloaded, data \u003d fileutils.read_cached_file(parsed_url.path)"},{"line_number":63,"context_line":"        try:"},{"line_number":64,"context_line":"            resources \u003d yaml.safe_load(data)"},{"line_number":65,"context_line":"        except yaml.YAMLError as exc:"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAAUH%2F%2FGo4%3D","line":62,"updated":"2014-01-17 12:08:38.000000000","message":"Does this have the caching effect intended?\n\ni.e. will load_resources() even be called despite the file mtime changing if the ceilometer.resourceloader.get_resources() has cached the resources loaded the first time round?","commit_id":"1054209f51f61f06ec6edec6ea72c93654d06c71"}],"setup.cfg":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"28c8affa745e31db65d686cac576473a77cce2ae","unresolved":false,"context_lines":[{"line_number":103,"context_line":"    file \u003d ceilometer.publisher.file:FilePublisher"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"ceilometer.resourceloader \u003d"},{"line_number":106,"context_line":"    fileloader \u003d ceilometer.resourceloader.file:FileResourceLoader"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"ceilometer.alarm.evaluator \u003d"},{"line_number":109,"context_line":"    threshold \u003d ceilometer.alarm.evaluator.threshold:ThresholdEvaluator"}],"source_content_type":"text/x-ttcn-cfg","patch_set":5,"id":"AAAATn%2F%2BK3A%3D","line":106,"updated":"2013-11-29 23:36:23.000000000","message":"How about \"file\" instead of \"fileloader\"?","commit_id":"54fff0241b4b8503ac431300b0cabc4aa884f3d0"}]}
