)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"853e695373a78a93aa83af47737c4a08b595cbc4","unresolved":false,"context_lines":[{"line_number":9,"context_line":"nova-scheduler will be moved out in L release. So we should move the"},{"line_number":10,"context_line":"unrelated thing out of scheduler. The periodic task for quota reservations"},{"line_number":11,"context_line":"expire is one of thing. Instead of execute expire reservation by"},{"line_number":12,"context_line":"periodic task, this patch execute expire resercation before execute quota"},{"line_number":13,"context_line":"action."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I3c7643a3b8b71d454eebc2e8de61a39f9c09cd4d"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"1a6ced46_7263af1a","line":12,"updated":"2015-03-23 12:28:39.000000000","message":"s/resercation/reservation/","commit_id":"8b873d32c21ba9e622c65d058550532c57473c97"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"72b079e5d659151c19324a87ecabb42903dd9dcb","unresolved":false,"context_lines":[{"line_number":9,"context_line":"nova-scheduler will be moved out in L release. So we should move the"},{"line_number":10,"context_line":"unrelated thing out of scheduler. The periodic task for quota reservations"},{"line_number":11,"context_line":"expire is one of thing. Instead of execute expire reservation by"},{"line_number":12,"context_line":"periodic task, this patch execute expire resercation before execute quota"},{"line_number":13,"context_line":"action."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I3c7643a3b8b71d454eebc2e8de61a39f9c09cd4d"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"1a6ced46_7f86ef66","line":12,"in_reply_to":"1a6ced46_7263af1a","updated":"2015-03-24 13:05:34.000000000","message":"Done","commit_id":"8b873d32c21ba9e622c65d058550532c57473c97"}],"nova/quota.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"d89765ee8727f8c7a50fbc006accfca96643cb83","unresolved":false,"context_lines":[{"line_number":106,"context_line":""},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"def quota_expire(func):"},{"line_number":109,"context_line":"    def expire_helper(self, context, *args, **kwargs):"},{"line_number":110,"context_line":"        QUOTAS.expire(context.elevated())"},{"line_number":111,"context_line":"        return func(self, context, *args, **kwargs)"},{"line_number":112,"context_line":"    return expire_helper"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_f0114dad","line":109,"updated":"2015-03-23 16:15:48.000000000","message":"I\u0027d like a docstring on quota_expire() to explain what it is; I had to see it used before I figured out it was supposed to be a decorator.  That also leads to asking for @functools.wraps() (or @six.wraps()) to decorate the expire_helper() wrapper.","commit_id":"8b873d32c21ba9e622c65d058550532c57473c97"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"72b079e5d659151c19324a87ecabb42903dd9dcb","unresolved":false,"context_lines":[{"line_number":106,"context_line":""},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"def quota_expire(func):"},{"line_number":109,"context_line":"    def expire_helper(self, context, *args, **kwargs):"},{"line_number":110,"context_line":"        QUOTAS.expire(context.elevated())"},{"line_number":111,"context_line":"        return func(self, context, *args, **kwargs)"},{"line_number":112,"context_line":"    return expire_helper"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_1f917b99","line":109,"in_reply_to":"1a6ced46_f0114dad","updated":"2015-03-24 13:05:34.000000000","message":"Done","commit_id":"8b873d32c21ba9e622c65d058550532c57473c97"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"853e695373a78a93aa83af47737c4a08b595cbc4","unresolved":false,"context_lines":[{"line_number":107,"context_line":""},{"line_number":108,"context_line":"def quota_expire(func):"},{"line_number":109,"context_line":"    def expire_helper(self, context, *args, **kwargs):"},{"line_number":110,"context_line":"        QUOTAS.expire(context.elevated())"},{"line_number":111,"context_line":"        return func(self, context, *args, **kwargs)"},{"line_number":112,"context_line":"    return expire_helper"},{"line_number":113,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_521dd3bc","line":110,"updated":"2015-03-23 12:28:39.000000000","message":"is QUOTAS a new value?  where we set it ?","commit_id":"8b873d32c21ba9e622c65d058550532c57473c97"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"d89765ee8727f8c7a50fbc006accfca96643cb83","unresolved":false,"context_lines":[{"line_number":107,"context_line":""},{"line_number":108,"context_line":"def quota_expire(func):"},{"line_number":109,"context_line":"    def expire_helper(self, context, *args, **kwargs):"},{"line_number":110,"context_line":"        QUOTAS.expire(context.elevated())"},{"line_number":111,"context_line":"        return func(self, context, *args, **kwargs)"},{"line_number":112,"context_line":"    return expire_helper"},{"line_number":113,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_b0bb55c3","line":110,"in_reply_to":"1a6ced46_521dd3bc","updated":"2015-03-23 16:15:48.000000000","message":"He\u0027s predeclaring the QUOTAS global so that it\u0027s in scope for the expire_helper() wrapper function.  The actual value is set toward the bottom of quota.py.\n\n(QUOTAS is used like CONF; it\u0027s a singleton global object that everything else uses to perform quota checks.)\n\nThat said: given how simple this decorator is, it would probably be better to bury the code in the decorated methods.  However, the comment about running this too often is a legitimate worry.  What I would do is include some logic to reduce the frequency of execution—expire() is a heavy-weight function—and possibly a try/except block to log and otherwise ignore exceptions.  (These could also go in the expire() method, however…)  Other comments: given that you\u0027re only decorating QuotaEngine methods, self is the same as QUOTAS, so you can completely eliminate the predeclaration and the reference to QUOTAS by using self.expire()…","commit_id":"8b873d32c21ba9e622c65d058550532c57473c97"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"72b079e5d659151c19324a87ecabb42903dd9dcb","unresolved":false,"context_lines":[{"line_number":107,"context_line":""},{"line_number":108,"context_line":"def quota_expire(func):"},{"line_number":109,"context_line":"    def expire_helper(self, context, *args, **kwargs):"},{"line_number":110,"context_line":"        QUOTAS.expire(context.elevated())"},{"line_number":111,"context_line":"        return func(self, context, *args, **kwargs)"},{"line_number":112,"context_line":"    return expire_helper"},{"line_number":113,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_9d72c97a","line":110,"in_reply_to":"1a6ced46_b0bb55c3","updated":"2015-03-24 13:05:34.000000000","message":"Thanks, agree should think about reduce the frequency, I will think about it more.","commit_id":"8b873d32c21ba9e622c65d058550532c57473c97"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"949ead764424e550395c4c56773b464e5fc86088","unresolved":false,"context_lines":[{"line_number":107,"context_line":""},{"line_number":108,"context_line":"def quota_expire(func):"},{"line_number":109,"context_line":"    def expire_helper(self, context, *args, **kwargs):"},{"line_number":110,"context_line":"        QUOTAS.expire(context.elevated())"},{"line_number":111,"context_line":"        return func(self, context, *args, **kwargs)"},{"line_number":112,"context_line":"    return expire_helper"},{"line_number":113,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1a6ced46_64583f57","line":110,"in_reply_to":"1a6ced46_b0bb55c3","updated":"2015-03-23 17:23:08.000000000","message":"ok, I got it , thanks for the sharing","commit_id":"8b873d32c21ba9e622c65d058550532c57473c97"}]}
