)]}'
{"openstack/compute/v2/server.py":[{"author":{"_account_id":8257,"name":"Brian Curtin","email":"brian@python.org","username":"briancurtin"},"change_message_id":"f92af235a0fe00152dc21a559e756cf663d723a0","unresolved":false,"context_lines":[{"line_number":112,"context_line":"        body \u003d {\u0027createImage\u0027: action}"},{"line_number":113,"context_line":"        return self.action(session, body)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    def wait_for_status(self, session, status\u003d\u0027ACTIVE\u0027, interval\u003d5, wait\u003d120):"},{"line_number":116,"context_line":"        \"\"\"Wait for the server to be in some status.\"\"\""},{"line_number":117,"context_line":"        try:"},{"line_number":118,"context_line":"            if self.status \u003d\u003d status:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a890539_2c99e6d0","line":115,"updated":"2014-11-26 20:16:56.000000000","message":"I\u0027m not sure True/False is the best contract for something like this, as there are multiple failure cases to log and act on.\n\nThere are at least the following:\n\n1. Success. I would probably prefer to have `self` returned here.\n\n2. Timeout. I think a timeout is really in between failure (False) and exceptional (an exception), but I don\u0027t really like thought of an API for this which is both returning booleans and raising its own exceptions. Because of 3, I think this should raise some timeout exception.\n\n3. Build failure before timeout. This is an exceptional case and different from a timeout, so I think it should raise some build failure exception.\n\nAn app developer would likely code around build failures differently than timeouts, or enter different types of retry logic, so I\u0027d prefer to give them that info.","commit_id":"c0b2e7cb6f7915449d0df22e90bdee80a9fd2181"},{"author":{"_account_id":8257,"name":"Brian Curtin","email":"brian@python.org","username":"briancurtin"},"change_message_id":"f92af235a0fe00152dc21a559e756cf663d723a0","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        total_sleep \u003d 0"},{"line_number":123,"context_line":"        while total_sleep \u003c wait:"},{"line_number":124,"context_line":"            self.get(session)"},{"line_number":125,"context_line":"            if self.status \u003d\u003d status:"},{"line_number":126,"context_line":"                return True"},{"line_number":127,"context_line":"            time.sleep(interval)"},{"line_number":128,"context_line":"            total_sleep +\u003d interval"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a890539_cca942df","line":125,"updated":"2014-11-26 20:16:56.000000000","message":"We should probably be a bit more precise about this check and only keep sleeping/looping when the state is BUILDING, move into the success case when it\u0027s ACTIVE, and bail out of the loop early if it\u0027s ERROR (with exception).","commit_id":"c0b2e7cb6f7915449d0df22e90bdee80a9fd2181"},{"author":{"_account_id":8257,"name":"Brian Curtin","email":"brian@python.org","username":"briancurtin"},"change_message_id":"9b7bc6ce852714702e50f747b797772e3a3a69f3","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        body \u003d {\u0027createImage\u0027: action}"},{"line_number":114,"context_line":"        return self.action(session, body)"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def wait_for_status(self, session, status\u003d\u0027ACTIVE\u0027, failures\u003d[],"},{"line_number":117,"context_line":"                        interval\u003d5, wait\u003d120):"},{"line_number":118,"context_line":"        \"\"\"Wait for the server to be in some status."},{"line_number":119,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_797240ae","line":116,"updated":"2015-01-25 23:09:45.000000000","message":"We should avoid having a mutable default for failures. The default argument should be None, and then one of the first things we do in the function should check if it\u0027s None and then assign an empty list, as we do in a bunch of other places.","commit_id":"18ea9cc2966bdde819835d848fb508e229a1ee05"},{"author":{"_account_id":8257,"name":"Brian Curtin","email":"brian@python.org","username":"briancurtin"},"change_message_id":"9b7bc6ce852714702e50f747b797772e3a3a69f3","unresolved":false,"context_lines":[{"line_number":140,"context_line":"            self.get(session)"},{"line_number":141,"context_line":"            if self.status \u003d\u003d status:"},{"line_number":142,"context_line":"                return self"},{"line_number":143,"context_line":"            for failure in failures:"},{"line_number":144,"context_line":"                if self.status \u003d\u003d failure:"},{"line_number":145,"context_line":"                    msg \u003d (\"Resource %s transitioned to failure state %s\" %"},{"line_number":146,"context_line":"                           (self.id, failure))"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a930d6b_d96094d1","line":143,"updated":"2015-01-25 23:09:45.000000000","message":"A slightly quicker/shorter way through this would be to make it...\n\nif self.status in failures:\n    msg \u003d (\"Resource %s transitioned to failure state %s\" %\n           (self.id, self.status))\n    raise exceptions.ResourceFailure(msg)","commit_id":"18ea9cc2966bdde819835d848fb508e229a1ee05"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"8073f678d8e110cb51c9d76dcd9bfb8d338ad4aa","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        :param session: The session to use for making this request."},{"line_number":121,"context_line":"        :type session: :class:`~openstack.session.Session`"},{"line_number":122,"context_line":"        :param status: Desired status of the server."},{"line_number":123,"context_line":"        :param failures: Statuses that would indicate the transition failed."},{"line_number":124,"context_line":"        :param interval: Number of seconds to wait between checks."},{"line_number":125,"context_line":"        :param wait: Maximum number of seconds to wait for transition."},{"line_number":126,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1a930d6b_e523cca4","line":123,"updated":"2015-01-26 16:29:36.000000000","message":"Should we specify a list/set type here? It may seem obvious now, but I can imagine a user passing\n\n    \u0027400,401,403,404,411,500\u0027","commit_id":"f6ad003bc8ccfcfb7dc111c67c205e09f7d76751"},{"author":{"_account_id":8257,"name":"Brian Curtin","email":"brian@python.org","username":"briancurtin"},"change_message_id":"4b109d6ffc3a2edd3a7c77994ccacaf361029ed4","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        :param session: The session to use for making this request."},{"line_number":121,"context_line":"        :type session: :class:`~openstack.session.Session`"},{"line_number":122,"context_line":"        :param status: Desired status of the server."},{"line_number":123,"context_line":"        :param failures: Statuses that would indicate the transition failed."},{"line_number":124,"context_line":"        :param interval: Number of seconds to wait between checks."},{"line_number":125,"context_line":"        :param wait: Maximum number of seconds to wait for transition."},{"line_number":126,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1a930d6b_854cc89f","line":123,"in_reply_to":"1a930d6b_e523cca4","updated":"2015-01-26 16:45:25.000000000","message":":param list failures: would be good to have","commit_id":"f6ad003bc8ccfcfb7dc111c67c205e09f7d76751"},{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"8073f678d8e110cb51c9d76dcd9bfb8d338ad4aa","unresolved":false,"context_lines":[{"line_number":137,"context_line":"            pass"},{"line_number":138,"context_line":"        total_sleep \u003d 0"},{"line_number":139,"context_line":"        if failures is None:"},{"line_number":140,"context_line":"            failures \u003d []"},{"line_number":141,"context_line":"        while total_sleep \u003c wait:"},{"line_number":142,"context_line":"            self.get(session)"},{"line_number":143,"context_line":"            if self.status \u003d\u003d status:"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a930d6b_6518bc75","line":140,"updated":"2015-01-26 16:29:36.000000000","message":"Probably a bad question, but how long do we expect the list of failures could be at its worst? If it\u0027s long enough, calling\n\n    self.status in failures\n\nSeveral times will hurt because lookup is actually O(n). If we convert failures into a set. The performance will be significantly better.\n\nFor example, after this if block you could just do\n\n    failures \u003d set(failures)\n\nSince we should always have an iterable here.","commit_id":"f6ad003bc8ccfcfb7dc111c67c205e09f7d76751"},{"author":{"_account_id":8257,"name":"Brian Curtin","email":"brian@python.org","username":"briancurtin"},"change_message_id":"4b109d6ffc3a2edd3a7c77994ccacaf361029ed4","unresolved":false,"context_lines":[{"line_number":137,"context_line":"            pass"},{"line_number":138,"context_line":"        total_sleep \u003d 0"},{"line_number":139,"context_line":"        if failures is None:"},{"line_number":140,"context_line":"            failures \u003d []"},{"line_number":141,"context_line":"        while total_sleep \u003c wait:"},{"line_number":142,"context_line":"            self.get(session)"},{"line_number":143,"context_line":"            if self.status \u003d\u003d status:"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a930d6b_45fae043","line":140,"in_reply_to":"1a930d6b_6518bc75","updated":"2015-01-26 16:45:25.000000000","message":"There are 18 documented status values and only a couple of them could be considered failure related. I don\u0027t think we have to get too smart with this - my original comment should have focused more on readability instead of having mentioned performance.","commit_id":"f6ad003bc8ccfcfb7dc111c67c205e09f7d76751"}]}
