)]}'
{"taskflow/utils/lock_utils.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"5edd5e3ed4ab8c957904f7921d715d7ee3077fd2","unresolved":false,"context_lines":[{"line_number":300,"context_line":"        self._local \u003d threading.local()"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"    @property"},{"line_number":303,"context_line":"    def _lock_stacks(self):"},{"line_number":304,"context_line":"        try:"},{"line_number":305,"context_line":"            return self._local.stacks"},{"line_number":306,"context_line":"        except AttributeError:"}],"source_content_type":"text/x-python","patch_set":11,"id":"da9df570_08208448","line":303,"updated":"2014-09-22 09:10:41.000000000","message":"Why not assign it in __init__? Sounds simpler. :)","commit_id":"980083ebdbb48a5c1512b26fe12138fe599ec87b"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"78aeb5af2faa0355fa2e9a955f4c06ded763439d","unresolved":false,"context_lines":[{"line_number":300,"context_line":"        self._local \u003d threading.local()"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"    @property"},{"line_number":303,"context_line":"    def _lock_stacks(self):"},{"line_number":304,"context_line":"        try:"},{"line_number":305,"context_line":"            return self._local.stacks"},{"line_number":306,"context_line":"        except AttributeError:"}],"source_content_type":"text/x-python","patch_set":11,"id":"da9df570_16041e7a","line":303,"in_reply_to":"da9df570_08208448","updated":"2014-09-22 16:10:37.000000000","message":"I tried that, that only makes it for the thread that created the object not for all other threads, so this must be created on demand by each thread instead using this kind of technique to ensure that each thread makes it appear in there version of self._local.","commit_id":"980083ebdbb48a5c1512b26fe12138fe599ec87b"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"5edd5e3ed4ab8c957904f7921d715d7ee3077fd2","unresolved":false,"context_lines":[{"line_number":323,"context_line":"                saved \u003d True"},{"line_number":324,"context_line":"        if not saved:"},{"line_number":325,"context_line":"            self._lock_stacks.append(stack)"},{"line_number":326,"context_line":"        return True"},{"line_number":327,"context_line":""},{"line_number":328,"context_line":"    def __exit__(self, type, value, traceback):"},{"line_number":329,"context_line":"        self.release()"}],"source_content_type":"text/x-python","patch_set":11,"id":"da9df570_087c0420","line":326,"updated":"2014-09-22 09:10:41.000000000","message":"There\u0027s something I miss here, but it\u0027s likely me not getting the purpose of the code. It looks to me that you\u0027re OK with not grabbing all locks and that you only save the first lock in the _lock_stacks.\n\nBut anyhow what\u0027s returned is True so it\u0027s like you always acquire all the lock? I miss something. :)","commit_id":"980083ebdbb48a5c1512b26fe12138fe599ec87b"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"78aeb5af2faa0355fa2e9a955f4c06ded763439d","unresolved":false,"context_lines":[{"line_number":323,"context_line":"                saved \u003d True"},{"line_number":324,"context_line":"        if not saved:"},{"line_number":325,"context_line":"            self._lock_stacks.append(stack)"},{"line_number":326,"context_line":"        return True"},{"line_number":327,"context_line":""},{"line_number":328,"context_line":"    def __exit__(self, type, value, traceback):"},{"line_number":329,"context_line":"        self.release()"}],"source_content_type":"text/x-python","patch_set":11,"id":"da9df570_d6653646","line":326,"in_reply_to":"da9df570_087c0420","updated":"2014-09-22 16:10:37.000000000","message":"So this acquires many locks right, making it look to the outside user that a single lock was acquired. So to enable this for re-entreant locks we have to track many stacks of locks that were acquired and for each time a new acquire() happens we create a brand new stack and acquire all the locks that were provided and save what was acquired for later releasing.\n\nAs for the first lock, its more than the first lock I hope, since _lock_stacks gets a whole stack of locks (not just a single one). I\u0027ll adjust this a little to make this more clear.","commit_id":"980083ebdbb48a5c1512b26fe12138fe599ec87b"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3ec973a99b67a5235aca5492fc9735e2120f897d","unresolved":false,"context_lines":[{"line_number":328,"context_line":""},{"line_number":329,"context_line":"        If all the locks can not be acquired (and say only X of Y locks could"},{"line_number":330,"context_line":"        be acquired then this will return false to signify that not all the"},{"line_number":331,"context_line":"        locks were able to be acquired, you can later use the obtained property"},{"line_number":332,"context_line":"        to determine how many were obtained)."},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"        NOTE(harlowja): When this happens it is still required to release since"}],"source_content_type":"text/x-python","patch_set":17,"id":"da9df570_73f641d9","line":331,"updated":"2014-09-23 09:52:28.000000000","message":"can you tag with RST \"obtained\" to make it more clear it\u0027s a property of the class?","commit_id":"1b4fb77ff4098411d8501699ec89853f341269ef"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"be0e704842194d647332f674823241eea81b4304","unresolved":false,"context_lines":[{"line_number":328,"context_line":""},{"line_number":329,"context_line":"        If all the locks can not be acquired (and say only X of Y locks could"},{"line_number":330,"context_line":"        be acquired then this will return false to signify that not all the"},{"line_number":331,"context_line":"        locks were able to be acquired, you can later use the obtained property"},{"line_number":332,"context_line":"        to determine how many were obtained)."},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"        NOTE(harlowja): When this happens it is still required to release since"}],"source_content_type":"text/x-python","patch_set":17,"id":"da9df570_26d9c783","line":331,"in_reply_to":"da9df570_73f641d9","updated":"2014-09-23 17:21:59.000000000","message":"Done","commit_id":"1b4fb77ff4098411d8501699ec89853f341269ef"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3ec973a99b67a5235aca5492fc9735e2120f897d","unresolved":false,"context_lines":[{"line_number":329,"context_line":"        If all the locks can not be acquired (and say only X of Y locks could"},{"line_number":330,"context_line":"        be acquired then this will return false to signify that not all the"},{"line_number":331,"context_line":"        locks were able to be acquired, you can later use the obtained property"},{"line_number":332,"context_line":"        to determine how many were obtained)."},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"        NOTE(harlowja): When this happens it is still required to release since"},{"line_number":335,"context_line":"        under partial acquisition the partially acquired locks must still be"}],"source_content_type":"text/x-python","patch_set":17,"id":"da9df570_73c72146","line":332,"updated":"2014-09-23 09:52:28.000000000","message":"What\u0027s not clear here and I finally understood with the code is that it stops acquiring locks as soon as one fails to be acquired.\nSo that means order of locks giving in __init__ matters also.\n\nI think it should be explained as it\u0027s really not obvious. :)","commit_id":"1b4fb77ff4098411d8501699ec89853f341269ef"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"be0e704842194d647332f674823241eea81b4304","unresolved":false,"context_lines":[{"line_number":329,"context_line":"        If all the locks can not be acquired (and say only X of Y locks could"},{"line_number":330,"context_line":"        be acquired then this will return false to signify that not all the"},{"line_number":331,"context_line":"        locks were able to be acquired, you can later use the obtained property"},{"line_number":332,"context_line":"        to determine how many were obtained)."},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"        NOTE(harlowja): When this happens it is still required to release since"},{"line_number":335,"context_line":"        under partial acquisition the partially acquired locks must still be"}],"source_content_type":"text/x-python","patch_set":17,"id":"da9df570_86d19359","line":332,"in_reply_to":"da9df570_73c72146","updated":"2014-09-23 17:21:59.000000000","message":"Done","commit_id":"1b4fb77ff4098411d8501699ec89853f341269ef"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3ec973a99b67a5235aca5492fc9735e2120f897d","unresolved":false,"context_lines":[{"line_number":331,"context_line":"        locks were able to be acquired, you can later use the obtained property"},{"line_number":332,"context_line":"        to determine how many were obtained)."},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"        NOTE(harlowja): When this happens it is still required to release since"},{"line_number":335,"context_line":"        under partial acquisition the partially acquired locks must still be"},{"line_number":336,"context_line":"        released. For example if 4 out of 5 locks were acquired this will"},{"line_number":337,"context_line":"        return false, but the user **must** still release those other 4 to"}],"source_content_type":"text/x-python","patch_set":17,"id":"da9df570_d3d36d36","line":334,"updated":"2014-09-23 09:52:28.000000000","message":"s/this happens/not all locks were acquired/","commit_id":"1b4fb77ff4098411d8501699ec89853f341269ef"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"be0e704842194d647332f674823241eea81b4304","unresolved":false,"context_lines":[{"line_number":331,"context_line":"        locks were able to be acquired, you can later use the obtained property"},{"line_number":332,"context_line":"        to determine how many were obtained)."},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"        NOTE(harlowja): When this happens it is still required to release since"},{"line_number":335,"context_line":"        under partial acquisition the partially acquired locks must still be"},{"line_number":336,"context_line":"        released. For example if 4 out of 5 locks were acquired this will"},{"line_number":337,"context_line":"        return false, but the user **must** still release those other 4 to"}],"source_content_type":"text/x-python","patch_set":17,"id":"da9df570_a6d4d747","line":334,"in_reply_to":"da9df570_d3d36d36","updated":"2014-09-23 17:21:59.000000000","message":"Done","commit_id":"1b4fb77ff4098411d8501699ec89853f341269ef"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"3ec973a99b67a5235aca5492fc9735e2120f897d","unresolved":false,"context_lines":[{"line_number":359,"context_line":"            self._lock_stacks.append(gotten)"},{"line_number":360,"context_line":"            return gotten \u003d\u003d len(self._locks)"},{"line_number":361,"context_line":"        else:"},{"line_number":362,"context_line":"            return False"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"    def __exit__(self, type, value, traceback):"},{"line_number":365,"context_line":"        self.release()"}],"source_content_type":"text/x-python","patch_set":17,"id":"da9df570_b3c5095d","line":362,"updated":"2014-09-23 09:52:28.000000000","message":"You don\u0027t need else: return False, you can always return gotten \u003d\u003d len(self._locks) actually.\n\nThat would also fix the case where len(self._locks) \u003d 0. Currently I think this method returns always False, with that proposed change it\u0027d return True. :)","commit_id":"1b4fb77ff4098411d8501699ec89853f341269ef"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"be0e704842194d647332f674823241eea81b4304","unresolved":false,"context_lines":[{"line_number":359,"context_line":"            self._lock_stacks.append(gotten)"},{"line_number":360,"context_line":"            return gotten \u003d\u003d len(self._locks)"},{"line_number":361,"context_line":"        else:"},{"line_number":362,"context_line":"            return False"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"    def __exit__(self, type, value, traceback):"},{"line_number":365,"context_line":"        self.release()"}],"source_content_type":"text/x-python","patch_set":17,"id":"da9df570_46bfabfb","line":362,"in_reply_to":"da9df570_b3c5095d","updated":"2014-09-23 17:21:59.000000000","message":"len(self._locks) can\u0027t be zero, but sure will update :)","commit_id":"1b4fb77ff4098411d8501699ec89853f341269ef"}]}
