)]}'
{"tests/test_service.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"37bdce50b96c14c15cc67ca43bc5d36be142a244","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        self.sub.wait()"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"    def _check_process_alive(self, pid):"},{"line_number":61,"context_line":"        f \u003d os.popen(\u0027ps ax -o pid,stat,cmd\u0027)"},{"line_number":62,"context_line":"        f.readline()"},{"line_number":63,"context_line":"        pid_stat \u003d [tuple(p for p in line.strip().split()[:2])"},{"line_number":64,"context_line":"                    for line in f.readlines()]"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FGIk%3D","line":61,"updated":"2013-08-07 09:22:56.000000000","message":":(\nToo hackish\nIf you\u0027re going Linux only anyway, just check for /proc/\u003cpid\u003e","commit_id":"166c5ee6499896cafc4139779228f41e5e07680c"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"37bdce50b96c14c15cc67ca43bc5d36be142a244","unresolved":false,"context_lines":[{"line_number":68,"context_line":""},{"line_number":69,"context_line":"    def check_process_alive(self):"},{"line_number":70,"context_line":"        cond \u003d lambda: self._check_process_alive(self.sub.pid)"},{"line_number":71,"context_line":"        self._wait(cond, 5)"},{"line_number":72,"context_line":"        return self._check_process_alive(self.sub.pid)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _wait(self, cond, timeout):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FGH0%3D","line":71,"updated":"2013-08-07 09:22:56.000000000","message":"5 seems potentially short, I\u0027d go for a minute to be safe.","commit_id":"166c5ee6499896cafc4139779228f41e5e07680c"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"37bdce50b96c14c15cc67ca43bc5d36be142a244","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    def check_process_alive(self):"},{"line_number":70,"context_line":"        cond \u003d lambda: self._check_process_alive(self.sub.pid)"},{"line_number":71,"context_line":"        self._wait(cond, 5)"},{"line_number":72,"context_line":"        return self._check_process_alive(self.sub.pid)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _wait(self, cond, timeout):"},{"line_number":75,"context_line":"        start \u003d time.time()"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FGH8%3D","line":72,"updated":"2013-08-07 09:22:56.000000000","message":"You should make _wait() return something and return this","commit_id":"166c5ee6499896cafc4139779228f41e5e07680c"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"37bdce50b96c14c15cc67ca43bc5d36be142a244","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        self._wait(cond, 5)"},{"line_number":72,"context_line":"        return self._check_process_alive(self.sub.pid)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _wait(self, cond, timeout):"},{"line_number":75,"context_line":"        start \u003d time.time()"},{"line_number":76,"context_line":"        while True:"},{"line_number":77,"context_line":"            if cond():"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FGI0%3D","line":74,"updated":"2013-08-07 09:22:56.000000000","message":"@staticmethod","commit_id":"166c5ee6499896cafc4139779228f41e5e07680c"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"37bdce50b96c14c15cc67ca43bc5d36be142a244","unresolved":false,"context_lines":[{"line_number":79,"context_line":"            if time.time() - start \u003e timeout:"},{"line_number":80,"context_line":"                break"},{"line_number":81,"context_line":"            time.sleep(.1)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def _spawn_service(self, cmd, conf_file\u003dNone):"},{"line_number":84,"context_line":"        if conf_file is None:"},{"line_number":85,"context_line":"            conf_file \u003d self.tempfile"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FGH4%3D","line":82,"updated":"2013-08-07 09:22:56.000000000","message":"You should return the result of cond()","commit_id":"166c5ee6499896cafc4139779228f41e5e07680c"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"37bdce50b96c14c15cc67ca43bc5d36be142a244","unresolved":false,"context_lines":[{"line_number":86,"context_line":"        self.sub \u003d subprocess.Popen([cmd, \u0027--config-file\u003d%s\u0027 % conf_file])"},{"line_number":87,"context_line":"        #NOTE(Fengqian): Hard code here and wait 3 secs to let the"},{"line_number":88,"context_line":"        #service start."},{"line_number":89,"context_line":"        time.sleep(3)"},{"line_number":90,"context_line":"        self.check_process_alive()"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def test_compute_service_restart(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FGIo%3D","line":89,"updated":"2013-08-07 09:22:56.000000000","message":"No that\u0027s likely to fail at some point.","commit_id":"166c5ee6499896cafc4139779228f41e5e07680c"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"37bdce50b96c14c15cc67ca43bc5d36be142a244","unresolved":false,"context_lines":[{"line_number":93,"context_line":"        self._spawn_service(\u0027ceilometer-agent-compute\u0027)"},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"        self.assertTrue(self.sub.pid)"},{"line_number":96,"context_line":"        os.kill(self.sub.pid, signal.SIGHUP)"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        self.assertTrue(self.check_process_alive())"},{"line_number":99,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAQn%2F%2FGHs%3D","line":96,"updated":"2013-08-07 09:22:56.000000000","message":"Thing is that doesn\u0027t test it has restarted, it just tests the process is still alive.\n\nI think it would be best to parse stdout/stderr of the process considering it should print something when restarting like \"Hey got SIGHUP, restarting)","commit_id":"166c5ee6499896cafc4139779228f41e5e07680c"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"a00efecd41a947db9f0ecce25e533c07ce885688","unresolved":false,"context_lines":[{"line_number":34,"context_line":"#NOTE(Fengqian): I have to set up a thread to parse the ouput of"},{"line_number":35,"context_line":"#subprocess.Popen. Because readline() may block the process in"},{"line_number":36,"context_line":"#some conditions."},{"line_number":37,"context_line":"class Parse_output(threading.Thread):"},{"line_number":38,"context_line":"    def __init__(self, input_stream, str_flag):"},{"line_number":39,"context_line":"        super(Parse_output, self).__init__()"},{"line_number":40,"context_line":"        self.input_stream \u003d input_stream"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2B7kg%3D","line":37,"updated":"2013-08-09 18:58:48.000000000","message":"ParseOutput","commit_id":"ddab752d6792efb90dbe66105879f580ff19b6a7"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"6570dac0ecf724901b5d4c5273e8612cd478a4a9","unresolved":false,"context_lines":[{"line_number":85,"context_line":"    @staticmethod"},{"line_number":86,"context_line":"    def _check_process_alive(pid):"},{"line_number":87,"context_line":"        try:"},{"line_number":88,"context_line":"            for line in open(\"/proc/%d/status\" % pid).readlines():"},{"line_number":89,"context_line":"                if line.startswith(\"State:\"):"},{"line_number":90,"context_line":"                    state \u003d line.split(\":\", 1)[1].strip().split(\u0027 \u0027)[0]"},{"line_number":91,"context_line":"                    return state not in [\u0027Z\u0027, \u0027T\u0027, \u0027Z+\u0027]"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2FBHQ%3D","line":88,"updated":"2013-08-08 12:45:13.000000000","message":"using with would allow to be sure the file is closed","commit_id":"ddab752d6792efb90dbe66105879f580ff19b6a7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"a00efecd41a947db9f0ecce25e533c07ce885688","unresolved":false,"context_lines":[{"line_number":99,"context_line":"    def parse_output(self, str_flag, timeout\u003d3):"},{"line_number":100,"context_line":"        parse \u003d Parse_output(self.sub.stderr, str_flag)"},{"line_number":101,"context_line":"        parse.start()"},{"line_number":102,"context_line":"        parse.join(timeout)"},{"line_number":103,"context_line":"        parse.stop()"},{"line_number":104,"context_line":"        return parse.ret"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2B7iw%3D","line":102,"updated":"2013-08-09 18:58:48.000000000","message":"Should there be a check in case the timeout tripped?","commit_id":"ddab752d6792efb90dbe66105879f580ff19b6a7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"a2776f6d80490a06a6ea20fa82d78aa7594b509d","unresolved":false,"context_lines":[{"line_number":99,"context_line":"    def parse_output(self, str_flag, timeout\u003d3):"},{"line_number":100,"context_line":"        parse \u003d Parse_output(self.sub.stderr, str_flag)"},{"line_number":101,"context_line":"        parse.start()"},{"line_number":102,"context_line":"        parse.join(timeout)"},{"line_number":103,"context_line":"        parse.stop()"},{"line_number":104,"context_line":"        return parse.ret"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQ3%2F%2F4z4%3D","line":102,"in_reply_to":"AAAAQn%2F%2B6XA%3D","updated":"2013-08-13 13:40:46.000000000","message":"There\u0027s a 3 second timeout here. But we never check to see if it trips. Either remove the timeout or add a check to do something with it.  Log at the very least.","commit_id":"ddab752d6792efb90dbe66105879f580ff19b6a7"},{"author":{"_account_id":7642,"name":"Fengqian Gao","email":"fengqian.gao@intel.com","username":"Fengqian"},"change_message_id":"94117b437e435b09fd83dec0d01ed23dd8172145","unresolved":false,"context_lines":[{"line_number":99,"context_line":"    def parse_output(self, str_flag, timeout\u003d3):"},{"line_number":100,"context_line":"        parse \u003d Parse_output(self.sub.stderr, str_flag)"},{"line_number":101,"context_line":"        parse.start()"},{"line_number":102,"context_line":"        parse.join(timeout)"},{"line_number":103,"context_line":"        parse.stop()"},{"line_number":104,"context_line":"        return parse.ret"},{"line_number":105,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAQn%2F%2B6XA%3D","line":102,"in_reply_to":"AAAAQn%2F%2B7iw%3D","updated":"2013-08-10 00:45:05.000000000","message":"I didn\u0027t get it here. In which condition the timeout tripped?\n\nThanks\n\nFengqian","commit_id":"ddab752d6792efb90dbe66105879f580ff19b6a7"}]}
