)]}'
{"ceilometer/alarm/threshold_evaluation.py":[{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"eedd8189c2d05bb2fc00fa51f2c43772b7679962","unresolved":false,"context_lines":[{"line_number":185,"context_line":"            self._update(alarm, state, reason)"},{"line_number":186,"context_line":"        elif alarm.repeat_actions and self.notifier:"},{"line_number":187,"context_line":"            reason \u003d self._reason(alarm, statistics, distilled, alarm.state)"},{"line_number":188,"context_line":"            self.notifier.notify(alarm, alarm.state, reason)"},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"    def evaluate(self):"},{"line_number":191,"context_line":"        \"\"\"Evaluate the alarms assigned to this evaluator.\"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAQn%2F%2FXyA%3D","line":188,"updated":"2013-08-01 09:05:28.000000000","message":"This logic is getting a bit tortuous, I wonder could it simplified and made more readable?\n\nOne idea to simply would be to re-purpose the Evaluator._update() method to allow the actual state update be selective, e.g.:\n\n -    def _update(self, alarm, state, reason):\n +    def _refresh(self, alarm, state, reason, update\u003dTrue):\n        \"\"\"Refresh alarm state.\"\"\"\n        id \u003d alarm.alarm_id\n -       LOG.info(_(\u0027alarm %(id)s transitioning to %(state)s\u0027\n -                  \u0027 because %(reason)s\u0027) % locals())\n        try:\n -         self._client.alarms.update(id, **dict(state\u003dstate))\n +         if update:\n +             LOG.info(_(\u0027alarm %(id)s transitioning to %(state)s\u0027\n +                      \u0027 because %(reason)s\u0027) % locals())\n +              self._client.alarms.update(id, **dict(state\u003dstate))\n\nThen there would be no need to be concerned about self.notifier being unset in the _transition() method or to distinguish between update and notify, so it could become:\n\n +        unknown \u003d alarm.state \u003d\u003d UNKNOWN\n +        continuous \u003d alarm.repeat_actions\n +\n          if unequivocal:\n              state \u003d ALARM if distilled else OK\n -            if alarm.state !\u003d state:\n +            if alarm.state !\u003d state or continuous:\n                  reason \u003d self._reason(alarm, statistics, distilled, state)\n -                self._update(alarm, state, reason)\n +                self._refresh(alarm, state, reason, update\u003dcontinuous)\n -         elif alarm.state \u003d\u003d UNKNOWN:\n +         elif unknown or continuous:\n -            state \u003d ALARM if compared[-1] else OK\n +            state \u003d (ALARM if compared[-1] else OK) if unknown\n +                    else alarm.state\n              reason \u003d self._reason(alarm, statistics, distilled, state)\n -            self._update(alarm, state, reason)\n +            self._refresh(alarm, state, reason, update\u003dcontinuous)","commit_id":"33fd65ae592efb7ba55697115211f0fc6dc5c8c0"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"2762038e6669f4602522d913f9a16a00b7aeb163","unresolved":false,"context_lines":[{"line_number":124,"context_line":"            LOG.exception(_(\u0027alarm stats retrieval failed\u0027))"},{"line_number":125,"context_line":"            return []"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def _refresh(self, alarm, state, reason):"},{"line_number":128,"context_line":"        \"\"\"Refresh alarm state.\"\"\""},{"line_number":129,"context_line":"        try:"},{"line_number":130,"context_line":"            if alarm.state !\u003d state:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FXZg%3D","line":127,"updated":"2013-08-01 10:49:10.000000000","message":"Isn\u0027t a new update parameter required here?\n\ni.e. we\u0027d want to avoid the needless hit on the API if alarm state hasn\u0027t changed.","commit_id":"d0b89d9311fc3d24e0f5d826969d05207896e573"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"0828ec364b69f61c334b23069bc5f61a0de1b5e0","unresolved":false,"context_lines":[{"line_number":124,"context_line":"            LOG.exception(_(\u0027alarm stats retrieval failed\u0027))"},{"line_number":125,"context_line":"            return []"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    def _refresh(self, alarm, state, reason):"},{"line_number":128,"context_line":"        \"\"\"Refresh alarm state.\"\"\""},{"line_number":129,"context_line":"        try:"},{"line_number":130,"context_line":"            if alarm.state !\u003d state:"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FXME%3D","line":127,"in_reply_to":"AAAAQn%2F%2FXZg%3D","updated":"2013-08-01 11:58:10.000000000","message":"The alarm API is only used to change the state of the alarm so if alarm.state !\u003d state (line 130) I do the update","commit_id":"d0b89d9311fc3d24e0f5d826969d05207896e573"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"2762038e6669f4602522d913f9a16a00b7aeb163","unresolved":false,"context_lines":[{"line_number":167,"context_line":"            return (_(\u0027Remaining as %(state)s due to %(count)d samples\u0027"},{"line_number":168,"context_line":"                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %"},{"line_number":169,"context_line":"                    {\u0027state\u0027: state, \u0027count\u0027: count, \u0027disposition\u0027: disposition,"},{"line_number":170,"context_line":"                    \u0027last\u0027: last})"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":"    def _transition(self, alarm, statistics, compared):"},{"line_number":173,"context_line":"        \"\"\"Transition alarm state if necessary."}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FXZM%3D","line":170,"updated":"2013-08-01 10:49:10.000000000","message":"Neater as?\n\n -        if transition:\n -            return (_(\u0027Transition to %(state)s due to %(count)d samples\u0027\n -                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %\n -                    {\u0027state\u0027: state, \u0027count\u0027: count, \u0027disposition\u0027: disposition,\n -                    \u0027last\u0027: last})\n -        else:\n -            return (_(\u0027Remaining as %(state)s due to %(count)d samples\u0027\n -                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %\n -                    {\u0027state\u0027: state, \u0027count\u0027: count, \u0027disposition\u0027: disposition,\n -                    \u0027last\u0027: last})\n +            return (_(\u0027%(action)s %(state)s due to %(count)d samples\u0027\n +                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %\n +                    {\u0027action\u0027: _(\u0027Transition to\u0027) if transition else _(\u0027Remaining as\u0027),\n +                     \u0027state\u0027: state, \u0027count\u0027: count, \u0027disposition\u0027: disposition,\n +                    \u0027last\u0027: last})","commit_id":"d0b89d9311fc3d24e0f5d826969d05207896e573"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"0828ec364b69f61c334b23069bc5f61a0de1b5e0","unresolved":false,"context_lines":[{"line_number":167,"context_line":"            return (_(\u0027Remaining as %(state)s due to %(count)d samples\u0027"},{"line_number":168,"context_line":"                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %"},{"line_number":169,"context_line":"                    {\u0027state\u0027: state, \u0027count\u0027: count, \u0027disposition\u0027: disposition,"},{"line_number":170,"context_line":"                    \u0027last\u0027: last})"},{"line_number":171,"context_line":""},{"line_number":172,"context_line":"    def _transition(self, alarm, statistics, compared):"},{"line_number":173,"context_line":"        \"\"\"Transition alarm state if necessary."}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FXLI%3D","line":170,"in_reply_to":"AAAAQn%2F%2FXZM%3D","updated":"2013-08-01 11:58:10.000000000","message":"I have think that is better for the translator to have the complete sentence to translate. It will be difficult for him to know that \"%(action)\" will be replaced by Transition or Remaining without reading the code.","commit_id":"d0b89d9311fc3d24e0f5d826969d05207896e573"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"37ed93d2debed1885749fca550d5d11aa2846ed2","unresolved":false,"context_lines":[{"line_number":164,"context_line":"                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %"},{"line_number":165,"context_line":"                    {\u0027state\u0027: state, \u0027count\u0027: count,"},{"line_number":166,"context_line":"                     \u0027disposition\u0027: disposition, \u0027last\u0027: last})"},{"line_number":167,"context_line":"        else:"},{"line_number":168,"context_line":"            return (_(\u0027Remaining as %(state)s due to %(count)d samples\u0027"},{"line_number":169,"context_line":"                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %"},{"line_number":170,"context_line":"                    {\u0027state\u0027: state, \u0027count\u0027: count,"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2FWzo%3D","line":167,"updated":"2013-08-01 13:58:44.000000000","message":"Don\u0027t need the else:","commit_id":"221aa6e678c736c72b4d875d0af50770e40cadde"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"3a3b9e84966d488689b6b7158179a42ca9ff7234","unresolved":false,"context_lines":[{"line_number":164,"context_line":"                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %"},{"line_number":165,"context_line":"                    {\u0027state\u0027: state, \u0027count\u0027: count,"},{"line_number":166,"context_line":"                     \u0027disposition\u0027: disposition, \u0027last\u0027: last})"},{"line_number":167,"context_line":"        else:"},{"line_number":168,"context_line":"            return (_(\u0027Remaining as %(state)s due to %(count)d samples\u0027"},{"line_number":169,"context_line":"                    \u0027 %(disposition)s threshold, most recent: %(last)s\u0027) %"},{"line_number":170,"context_line":"                    {\u0027state\u0027: state, \u0027count\u0027: count,"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2FTlE%3D","line":167,"in_reply_to":"AAAAQn%2F%2FWzo%3D","updated":"2013-08-02 06:58:49.000000000","message":"Done","commit_id":"221aa6e678c736c72b4d875d0af50770e40cadde"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"37ed93d2debed1885749fca550d5d11aa2846ed2","unresolved":false,"context_lines":[{"line_number":194,"context_line":"            if alarm.state !\u003d state or continuous:"},{"line_number":195,"context_line":"                self._refresh(alarm, state, reason)"},{"line_number":196,"context_line":"        elif unknown or continuous:"},{"line_number":197,"context_line":"            state \u003d (ALARM if compared[-1] else OK) if unknown else alarm.state"},{"line_number":198,"context_line":"            reason \u003d self._reason(alarm, statistics, distilled, state)"},{"line_number":199,"context_line":"            self._refresh(alarm, state, reason)"},{"line_number":200,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2FWzc%3D","line":197,"updated":"2013-08-01 13:58:44.000000000","message":"ugh","commit_id":"221aa6e678c736c72b4d875d0af50770e40cadde"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"3a3b9e84966d488689b6b7158179a42ca9ff7234","unresolved":false,"context_lines":[{"line_number":194,"context_line":"            if alarm.state !\u003d state or continuous:"},{"line_number":195,"context_line":"                self._refresh(alarm, state, reason)"},{"line_number":196,"context_line":"        elif unknown or continuous:"},{"line_number":197,"context_line":"            state \u003d (ALARM if compared[-1] else OK) if unknown else alarm.state"},{"line_number":198,"context_line":"            reason \u003d self._reason(alarm, statistics, distilled, state)"},{"line_number":199,"context_line":"            self._refresh(alarm, state, reason)"},{"line_number":200,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2FTlA%3D","line":197,"in_reply_to":"AAAAQn%2F%2FUck%3D","updated":"2013-08-02 06:58:49.000000000","message":"Done","commit_id":"221aa6e678c736c72b4d875d0af50770e40cadde"},{"author":{"_account_id":4715,"name":"Angus Salkeld","email":"asalkeld@redhat.com","username":"asalkeld"},"change_message_id":"48beb19c436d4fab64e5e371e80353e39ffc30bc","unresolved":false,"context_lines":[{"line_number":194,"context_line":"            if alarm.state !\u003d state or continuous:"},{"line_number":195,"context_line":"                self._refresh(alarm, state, reason)"},{"line_number":196,"context_line":"        elif unknown or continuous:"},{"line_number":197,"context_line":"            state \u003d (ALARM if compared[-1] else OK) if unknown else alarm.state"},{"line_number":198,"context_line":"            reason \u003d self._reason(alarm, statistics, distilled, state)"},{"line_number":199,"context_line":"            self._refresh(alarm, state, reason)"},{"line_number":200,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2FUck%3D","line":197,"in_reply_to":"AAAAQn%2F%2FWzc%3D","updated":"2013-08-02 00:33:50.000000000","message":"Agree with the \"ugh\", please make an effort to leave the code maintainable and *easily* understandable. I shouldn\u0027t have to re-read the code a bunch of times to figure out what it is doing.","commit_id":"221aa6e678c736c72b4d875d0af50770e40cadde"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"09d2d3af864437041b7722f4e7fb2dbdce3b0ea0","unresolved":false,"context_lines":[{"line_number":196,"context_line":"            if unknown:"},{"line_number":197,"context_line":"                state \u003d (ALARM if compared[-1] else OK)"},{"line_number":198,"context_line":"            else:"},{"line_number":199,"context_line":"                state \u003d alarm.state"},{"line_number":200,"context_line":"            reason \u003d self._reason(alarm, statistics, distilled, state)"},{"line_number":201,"context_line":"            self._refresh(alarm, state, reason)"},{"line_number":202,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAQn%2F%2FTcM%3D","line":199,"updated":"2013-08-02 07:59:36.000000000","message":"If we\u0027re just shooting for clarity here, here\u0027s an suggested alternative to the nested if:\n\n  trending_state \u003d ALARM if compared[-1] else OK\n  state \u003d trending_state if unknown else alarm.state\n\nEither way, the brackets around the ternary on line 197 can go.","commit_id":"364694214c7d367ff5a0b3c0c36eaad66a672183"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"0bab52cc4874fe18ab6bf696b1fda79477096523","unresolved":false,"context_lines":[{"line_number":196,"context_line":"            if unknown:"},{"line_number":197,"context_line":"                state \u003d (ALARM if compared[-1] else OK)"},{"line_number":198,"context_line":"            else:"},{"line_number":199,"context_line":"                state \u003d alarm.state"},{"line_number":200,"context_line":"            reason \u003d self._reason(alarm, statistics, distilled, state)"},{"line_number":201,"context_line":"            self._refresh(alarm, state, reason)"},{"line_number":202,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAQn%2F%2FTOY%3D","line":199,"in_reply_to":"AAAAQn%2F%2FTcM%3D","updated":"2013-08-02 09:33:12.000000000","message":"Done, I like the explicit name trending_state :)","commit_id":"364694214c7d367ff5a0b3c0c36eaad66a672183"}],"ceilometer/api/controllers/v2.py":[{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"eedd8189c2d05bb2fc00fa51f2c43772b7679962","unresolved":false,"context_lines":[{"line_number":783,"context_line":"    \"The actions to do when alarm state change to insufficient data\""},{"line_number":784,"context_line":""},{"line_number":785,"context_line":"    repeat_actions \u003d bool"},{"line_number":786,"context_line":"    \"The actions should be triggered on each evaluation\""},{"line_number":787,"context_line":""},{"line_number":788,"context_line":"    matching_metadata \u003d {wtypes.text: wtypes.text}"},{"line_number":789,"context_line":"    \"The matching_metadata of the alarm\""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAQn%2F%2FXuI%3D","line":786,"updated":"2013-08-01 09:05:28.000000000","message":"s/The actions should be triggered on each evaluation/The actions should be re-triggered on each evaluation cycle/","commit_id":"33fd65ae592efb7ba55697115211f0fc6dc5c8c0"}],"ceilometer/storage/sqlalchemy/alembic/versions/43b1a023dfaa_add_column_repeat_al.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"cd350f2f5c1449d6df330f7a9a2854c3b949c0be","unresolved":false,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"def downgrade():"},{"line_number":24,"context_line":"    pass"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAQn%2F%2Fasc%3D","line":24,"updated":"2013-07-31 14:44:33.000000000","message":":-( ?","commit_id":"363554b043896f227e4280ad750da322729a8f0e"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"8364870318027a1614cf4e22654df84a96e806cf","unresolved":false,"context_lines":[{"line_number":21,"context_line":""},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"def downgrade():"},{"line_number":24,"context_line":"    pass"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAQn%2F%2Famg%3D","line":24,"in_reply_to":"AAAAQn%2F%2Fasc%3D","updated":"2013-07-31 15:02:41.000000000","message":"oups I will add the downgrade","commit_id":"363554b043896f227e4280ad750da322729a8f0e"}],"tests/alarm/test_threshold_evaluation.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"cd350f2f5c1449d6df330f7a9a2854c3b949c0be","unresolved":false,"context_lines":[{"line_number":217,"context_line":"            maxs \u003d [self._get_stat(\u0027max\u0027, self.alarms[1].threshold - v)"},{"line_number":218,"context_line":"                    for v in xrange(4)]"},{"line_number":219,"context_line":"            self.api_client.statistics.list.side_effect \u003d [avgs, maxs]"},{"line_number":220,"context_line":"            self.evaluator.evaluate()"},{"line_number":221,"context_line":"            self._assert_all_alarms(\u0027alarm\u0027)"},{"line_number":222,"context_line":"            self.assertEqual(self.api_client.alarms.update.call_args_list,"},{"line_number":223,"context_line":"                             [])"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAQn%2F%2FasI%3D","line":220,"updated":"2013-07-31 14:44:33.000000000","message":"I may be wrong, but how are you sure that repeat works if you call evaluate() only once?","commit_id":"363554b043896f227e4280ad750da322729a8f0e"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"8364870318027a1614cf4e22654df84a96e806cf","unresolved":false,"context_lines":[{"line_number":217,"context_line":"            maxs \u003d [self._get_stat(\u0027max\u0027, self.alarms[1].threshold - v)"},{"line_number":218,"context_line":"                    for v in xrange(4)]"},{"line_number":219,"context_line":"            self.api_client.statistics.list.side_effect \u003d [avgs, maxs]"},{"line_number":220,"context_line":"            self.evaluator.evaluate()"},{"line_number":221,"context_line":"            self._assert_all_alarms(\u0027alarm\u0027)"},{"line_number":222,"context_line":"            self.assertEqual(self.api_client.alarms.update.call_args_list,"},{"line_number":223,"context_line":"                             [])"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAQn%2F%2Fam0%3D","line":220,"in_reply_to":"AAAAQn%2F%2FasI%3D","updated":"2013-07-31 15:02:41.000000000","message":"The test case is: the alarm state don\u0027t change but because repeat_actions \u003d True when evaluate is called it must call the notifier.","commit_id":"363554b043896f227e4280ad750da322729a8f0e"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"eedd8189c2d05bb2fc00fa51f2c43772b7679962","unresolved":false,"context_lines":[{"line_number":224,"context_line":"            reason \u003d \u0027Transition to alarm due to 4 samples outside\u0027 \\"},{"line_number":225,"context_line":"                     \u0027 threshold, most recent: 7.0\u0027"},{"line_number":226,"context_line":"            expected \u003d [mock.call(self.alarms[1], \u0027alarm\u0027, reason)]"},{"line_number":227,"context_line":"            self.assertEqual(self.notifier.notify.call_args_list, expected)"},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"    def test_equivocal_from_unknown(self):"},{"line_number":230,"context_line":"        self._set_all_alarms(\u0027insufficient data\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAQn%2F%2FXtA%3D","line":227,"updated":"2013-08-01 09:05:28.000000000","message":"Are you missing testcases for the scenario where there is both a state transition *and* repeat_actions is also true?","commit_id":"33fd65ae592efb7ba55697115211f0fc6dc5c8c0"}]}
