)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"64fd94ee652516a0cb7b807600320b5b5c0c6140","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix random unit-test failure for NVP advanced plugin"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Two problems were observed:"},{"line_number":10,"context_line":"1. Tasks are not scheduled as desried in greenthread. The fix is to"},{"line_number":11,"context_line":"   increase the max status probing time from 1 second to 10 seconds."},{"line_number":12,"context_line":"2. An error message is show in unit-test log output. Turns out in"},{"line_number":13,"context_line":"   addition to a bug that may cause task manager stop prematurely,"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"AAAATn%2F%2FSJ4%3D","line":10,"updated":"2013-11-11 18:18:37.000000000","message":"desried \u003d\u003e desired","commit_id":"32d4401b279e7ed42ae1d2a07dbb23fcda8319f8"},{"author":{"_account_id":6461,"name":"Kaiwei Fan","email":"fank@vmware.com","username":"kaiwei-fan"},"change_message_id":"4b7656493478805518f2e812fc569a4b736f2cad","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix random unit-test failure for NVP advanced plugin"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Two problems were observed:"},{"line_number":10,"context_line":"1. Tasks are not scheduled as desried in greenthread. The fix is to"},{"line_number":11,"context_line":"   increase the max status probing time from 1 second to 10 seconds."},{"line_number":12,"context_line":"2. An error message is show in unit-test log output. Turns out in"},{"line_number":13,"context_line":"   addition to a bug that may cause task manager stop prematurely,"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"AAAATn%2F%2FRSw%3D","line":10,"in_reply_to":"AAAATn%2F%2FSJ4%3D","updated":"2013-11-12 00:06:27.000000000","message":"Done","commit_id":"32d4401b279e7ed42ae1d2a07dbb23fcda8319f8"}],"neutron/plugins/nicira/vshield/tasks/tasks.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"b87c27f5d8a288214387a8872f5dcff8a3d9e1bf","unresolved":false,"context_lines":[{"line_number":352,"context_line":"        self._thread.wait()"},{"line_number":353,"context_line":"        self._thread \u003d None"},{"line_number":354,"context_line":""},{"line_number":355,"context_line":"    def has_pending_task(self):"},{"line_number":356,"context_line":"        if self._tasks_queue:"},{"line_number":357,"context_line":"            return True"},{"line_number":358,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2Fyt8%3D","line":355,"updated":"2013-10-28 23:44:00.000000000","message":"This would be a lot more readable if it was:\n\n  return bool(self._tasks_queue or self._tasks or self._main_thread_exec_task)\n\nor \n\n  if self._tasks_queue or self._tasks or self._main_thread_exec_task:\n      return True\n  else:\n      return False","commit_id":"21e275106c1aaa4754afcfaa53810fe4fdc28c10"},{"author":{"_account_id":6461,"name":"Kaiwei Fan","email":"fank@vmware.com","username":"kaiwei-fan"},"change_message_id":"e87a6923b3e0b43e2ebbd78322241a802b7251e4","unresolved":false,"context_lines":[{"line_number":352,"context_line":"        self._thread.wait()"},{"line_number":353,"context_line":"        self._thread \u003d None"},{"line_number":354,"context_line":""},{"line_number":355,"context_line":"    def has_pending_task(self):"},{"line_number":356,"context_line":"        if self._tasks_queue:"},{"line_number":357,"context_line":"            return True"},{"line_number":358,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FvVc%3D","line":355,"in_reply_to":"AAAATn%2F%2Fyt8%3D","updated":"2013-10-29 17:15:29.000000000","message":"Done","commit_id":"21e275106c1aaa4754afcfaa53810fe4fdc28c10"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"b87c27f5d8a288214387a8872f5dcff8a3d9e1bf","unresolved":false,"context_lines":[{"line_number":371,"context_line":"            for task in tasks:"},{"line_number":372,"context_line":"                print(str(task))"},{"line_number":373,"context_line":"        if self._main_thread_exec_task:"},{"line_number":374,"context_line":"            print(str(self._main_thread_exec_task))"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"    def count(self):"},{"line_number":377,"context_line":"        count \u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FyuI%3D","line":374,"updated":"2013-10-28 23:44:00.000000000","message":"We shouldn\u0027t be using print statements. Besides, what\u0027s the use for this?","commit_id":"21e275106c1aaa4754afcfaa53810fe4fdc28c10"},{"author":{"_account_id":6461,"name":"Kaiwei Fan","email":"fank@vmware.com","username":"kaiwei-fan"},"change_message_id":"3fdcd4d90be6050863a017a9bb8874b22ce7bd9c","unresolved":false,"context_lines":[{"line_number":371,"context_line":"            for task in tasks:"},{"line_number":372,"context_line":"                print(str(task))"},{"line_number":373,"context_line":"        if self._main_thread_exec_task:"},{"line_number":374,"context_line":"            print(str(self._main_thread_exec_task))"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"    def count(self):"},{"line_number":377,"context_line":"        count \u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2Fuog%3D","line":374,"in_reply_to":"AAAATn%2F%2FvKY%3D","updated":"2013-10-29 19:47:13.000000000","message":"will do.","commit_id":"21e275106c1aaa4754afcfaa53810fe4fdc28c10"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"2bf214c37a9dd725cf56fd64865c395f795f8806","unresolved":false,"context_lines":[{"line_number":371,"context_line":"            for task in tasks:"},{"line_number":372,"context_line":"                print(str(task))"},{"line_number":373,"context_line":"        if self._main_thread_exec_task:"},{"line_number":374,"context_line":"            print(str(self._main_thread_exec_task))"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"    def count(self):"},{"line_number":377,"context_line":"        count \u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FvKY%3D","line":374,"in_reply_to":"AAAATn%2F%2FvUM%3D","updated":"2013-10-29 17:54:00.000000000","message":"using logging should work just as well when there\u0027s a failure.","commit_id":"21e275106c1aaa4754afcfaa53810fe4fdc28c10"},{"author":{"_account_id":6461,"name":"Kaiwei Fan","email":"fank@vmware.com","username":"kaiwei-fan"},"change_message_id":"e87a6923b3e0b43e2ebbd78322241a802b7251e4","unresolved":false,"context_lines":[{"line_number":371,"context_line":"            for task in tasks:"},{"line_number":372,"context_line":"                print(str(task))"},{"line_number":373,"context_line":"        if self._main_thread_exec_task:"},{"line_number":374,"context_line":"            print(str(self._main_thread_exec_task))"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"    def count(self):"},{"line_number":377,"context_line":"        count \u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FvUM%3D","line":374,"in_reply_to":"AAAATn%2F%2FyuI%3D","updated":"2013-10-29 17:15:29.000000000","message":"This is for unit-test failure troubleshooting. In case some pending tasks cannot be stopped when unit-test case finished, we\u0027ll raise an Exception to indicate error. The print here is show those problematic tasks in unit-test log when failed to help debugging.","commit_id":"21e275106c1aaa4754afcfaa53810fe4fdc28c10"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"b80ec09eda50cd6bb82427a3e848c5293571d26d","unresolved":false,"context_lines":[{"line_number":312,"context_line":"                    continue"},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"                try:"},{"line_number":315,"context_line":"                    self._main_thread_exec_task \u003d task"},{"line_number":316,"context_line":"                    self._execute(task)"},{"line_number":317,"context_line":"                finally:"},{"line_number":318,"context_line":"                    self._main_thread_exec_task \u003d None"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2B528%3D","line":315,"updated":"2013-11-18 18:54:22.000000000","message":"I just wonder if we need to synchronize the block 314-326 with stop() in order to ensure one can\u0027t possibly stop the task manager if there is a pending task.\n\nI think there could still be a race condition in the current code - because of multithreaded test execution one thread might call stop while another thread is executing a task.\n\nLet me know if this is likely or if it\u0027s just me dreaming.","commit_id":"a52ef6ecf19b8b015465ddda2a3ca087f0e12122"},{"author":{"_account_id":6461,"name":"Kaiwei Fan","email":"fank@vmware.com","username":"kaiwei-fan"},"change_message_id":"f02cac45f22c1be7f0e47646bc9a620c16e73c14","unresolved":false,"context_lines":[{"line_number":312,"context_line":"                    continue"},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"                try:"},{"line_number":315,"context_line":"                    self._main_thread_exec_task \u003d task"},{"line_number":316,"context_line":"                    self._execute(task)"},{"line_number":317,"context_line":"                finally:"},{"line_number":318,"context_line":"                    self._main_thread_exec_task \u003d None"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATn%2F%2B5tw%3D","line":315,"in_reply_to":"AAAATn%2F%2B528%3D","updated":"2013-11-18 19:36:27.000000000","message":"Yes it is possible.\n\nIf we want to prevent the process to stop if there are pending task, we don\u0027t need synchronization/lock mechanism, we only need to set a flag and let the execution thread terminate gracefully.\n\nHowever, I didn\u0027t prevent stop() from preemptively killing the running thread because of few reasons. The major reason is an asynchronous task may send a request in execution phase, and start polling status periodically. We don\u0027t want a task that spends too much time (or a task that never finishes because of bug) from preventing the process to stop. If we allow the process to stop while some tasks are still pending (polling the status periodically), adding synchronization block during execution does not provide much benefit, and it will block other threads\u0027 execution.\n\nSo I have \"has_pending_task()\" to let the caller decide whether he/she really wants to stop the process even if there are pending tasks.","commit_id":"a52ef6ecf19b8b015465ddda2a3ca087f0e12122"}]}
