)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"a8b395eadd5b49b7eac485574c38ad65c8246287","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"This will allow us to avoid open coding \"is jenkins ready?\" for"},{"line_number":17,"context_line":"different provisioners like puppet, chef, salt, ansible, ... when this"},{"line_number":18,"context_line":"gets jused by jjb."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Change-Id: I7fd8aed43f571528f27dac681cc1e1f77a0e0ad7"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"da86d52c_06b7a23b","line":18,"updated":"2015-02-13 16:53:21.000000000","message":"s/jused/used/ (femtonit)","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"}],"doc/source/examples.rst":[{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"33b23f36e3e5dd6c50527089a15719a04b2678ac","unresolved":false,"context_lines":[{"line_number":242,"context_line":""},{"line_number":243,"context_line":"It is possible to ask the API to wait for Jenkins to be ready with a given"},{"line_number":244,"context_line":"timeout. This can be used to aid launching of Jenkins and then waiting for the"},{"line_number":245,"context_line":"REST API to be responsive before containing with subsequent configuration."},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"::"},{"line_number":248,"context_line":"    # timeout here is the socket connection timeout, for each connection"}],"source_content_type":"text/x-rst","patch_set":8,"id":"7a3c09a3_99070ac9","line":245,"range":{"start_line":245,"start_character":33,"end_line":245,"end_character":43},"updated":"2017-01-18 17:43:19.000000000","message":"containing/continuing","commit_id":"abc9008ae4aed8ecac79591b6ee7885f6671b06d"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"85765c36fb18f386d0a4fa3274ce41009c3f6188","unresolved":false,"context_lines":[{"line_number":242,"context_line":""},{"line_number":243,"context_line":"It is possible to ask the API to wait for Jenkins to be ready with a given"},{"line_number":244,"context_line":"timeout. This can be used to aid launching of Jenkins and then waiting for the"},{"line_number":245,"context_line":"REST API to be responsive before containing with subsequent configuration."},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"::"},{"line_number":248,"context_line":"    # timeout here is the socket connection timeout, for each connection"}],"source_content_type":"text/x-rst","patch_set":8,"id":"5a3905b3_359cef68","line":245,"range":{"start_line":245,"start_character":33,"end_line":245,"end_character":43},"in_reply_to":"7a3c09a3_99070ac9","updated":"2017-01-20 16:17:14.000000000","message":"Done","commit_id":"abc9008ae4aed8ecac79591b6ee7885f6671b06d"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"33b23f36e3e5dd6c50527089a15719a04b2678ac","unresolved":false,"context_lines":[{"line_number":247,"context_line":"::"},{"line_number":248,"context_line":"    # timeout here is the socket connection timeout, for each connection"},{"line_number":249,"context_line":"    # attempt it will wait at most 5 seconds before assuming there is"},{"line_number":250,"context_line":"    # nothing listening. Useful where firewalls may backhole connections."},{"line_number":251,"context_line":"    server \u003d jenkins.Jenkins(\u0027http://localhost:8080\u0027, timeout\u003d5)"},{"line_number":252,"context_line":""},{"line_number":253,"context_line":"    # wait for at least 30 seconds for Jenkins to be ready"}],"source_content_type":"text/x-rst","patch_set":8,"id":"7a3c09a3_f9272e60","line":250,"range":{"start_line":250,"start_character":52,"end_line":250,"end_character":60},"updated":"2017-01-18 17:43:19.000000000","message":"backhole/black hole ?","commit_id":"abc9008ae4aed8ecac79591b6ee7885f6671b06d"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"85765c36fb18f386d0a4fa3274ce41009c3f6188","unresolved":false,"context_lines":[{"line_number":247,"context_line":"::"},{"line_number":248,"context_line":"    # timeout here is the socket connection timeout, for each connection"},{"line_number":249,"context_line":"    # attempt it will wait at most 5 seconds before assuming there is"},{"line_number":250,"context_line":"    # nothing listening. Useful where firewalls may backhole connections."},{"line_number":251,"context_line":"    server \u003d jenkins.Jenkins(\u0027http://localhost:8080\u0027, timeout\u003d5)"},{"line_number":252,"context_line":""},{"line_number":253,"context_line":"    # wait for at least 30 seconds for Jenkins to be ready"}],"source_content_type":"text/x-rst","patch_set":8,"id":"5a3905b3_b5861f11","line":250,"range":{"start_line":250,"start_character":52,"end_line":250,"end_character":60},"in_reply_to":"7a3c09a3_f9272e60","updated":"2017-01-20 16:17:14.000000000","message":"Done","commit_id":"abc9008ae4aed8ecac79591b6ee7885f6671b06d"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"33b23f36e3e5dd6c50527089a15719a04b2678ac","unresolved":false,"context_lines":[{"line_number":258,"context_line":"        print(\"Jenkins failed to be ready in sufficient time\")"},{"line_number":259,"context_line":"        exit 2"},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"Note that the timeout arg to `jenkins.Jenkins()` is the socket connection"},{"line_number":262,"context_line":"timeout. If you set this to be more than the timeout value passed to"},{"line_number":263,"context_line":"`wait_for_normal_op()`, then in cases were the underlying connection is not"},{"line_number":264,"context_line":"rejected (firewall black-hole, or slow connection) then `wait_for_normal_op()`"},{"line_number":265,"context_line":"may wait at least the connection timeout, or a multiple of it where multiple"},{"line_number":266,"context_line":"connection attempts are made. A connection timeout of 5 seconds and a wait"},{"line_number":267,"context_line":"timeout of 8 will result in potentially waiting 10 seconds if both connections"},{"line_number":268,"context_line":"attempts do not get responses."}],"source_content_type":"text/x-rst","patch_set":8,"id":"7a3c09a3_19423aae","line":268,"range":{"start_line":261,"start_character":0,"end_line":268,"end_character":30},"updated":"2017-01-18 17:43:19.000000000","message":"This is the clarification that I was suggesting. thanks.","commit_id":"abc9008ae4aed8ecac79591b6ee7885f6671b06d"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"638e392b22dabdba3b8096408bddc7e96f600d55","unresolved":false,"context_lines":[{"line_number":247,"context_line":"::"},{"line_number":248,"context_line":"    # timeout here is the socket connection timeout, for each connection"},{"line_number":249,"context_line":"    # attempt it will wait at most 5 seconds before assuming there is"},{"line_number":250,"context_line":"    # nothing listening. Useful where firewalls may back hole connections."},{"line_number":251,"context_line":"    server \u003d jenkins.Jenkins(\u0027http://localhost:8080\u0027, timeout\u003d5)"},{"line_number":252,"context_line":""},{"line_number":253,"context_line":"    # wait for at least 30 seconds for Jenkins to be ready"}],"source_content_type":"text/x-rst","patch_set":9,"id":"5a3905b3_885bc686","line":250,"range":{"start_line":250,"start_character":52,"end_line":250,"end_character":56},"updated":"2017-01-20 16:42:08.000000000","message":"s/back hole/black-hole/ (dash for consistency)","commit_id":"3c043c5ecce15e4f2c953fdcd11d0b1bd20a3483"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"f0fb6befbcb5b3e3330db3f3a1f03709b45be97a","unresolved":false,"context_lines":[{"line_number":247,"context_line":"::"},{"line_number":248,"context_line":"    # timeout here is the socket connection timeout, for each connection"},{"line_number":249,"context_line":"    # attempt it will wait at most 5 seconds before assuming there is"},{"line_number":250,"context_line":"    # nothing listening. Useful where firewalls may back hole connections."},{"line_number":251,"context_line":"    server \u003d jenkins.Jenkins(\u0027http://localhost:8080\u0027, timeout\u003d5)"},{"line_number":252,"context_line":""},{"line_number":253,"context_line":"    # wait for at least 30 seconds for Jenkins to be ready"}],"source_content_type":"text/x-rst","patch_set":9,"id":"5a3905b3_92a83add","line":250,"range":{"start_line":250,"start_character":52,"end_line":250,"end_character":56},"in_reply_to":"5a3905b3_885bc686","updated":"2017-01-21 14:42:43.000000000","message":"Done","commit_id":"3c043c5ecce15e4f2c953fdcd11d0b1bd20a3483"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"638e392b22dabdba3b8096408bddc7e96f600d55","unresolved":false,"context_lines":[{"line_number":260,"context_line":""},{"line_number":261,"context_line":"Note that the timeout arg to `jenkins.Jenkins()` is the socket connection"},{"line_number":262,"context_line":"timeout. If you set this to be more than the timeout value passed to"},{"line_number":263,"context_line":"`wait_for_normal_op()`, then in cases were the underlying connection is not"},{"line_number":264,"context_line":"rejected (firewall black-hole, or slow connection) then `wait_for_normal_op()`"},{"line_number":265,"context_line":"may wait at least the connection timeout, or a multiple of it where multiple"},{"line_number":266,"context_line":"connection attempts are made. A connection timeout of 5 seconds and a wait"}],"source_content_type":"text/x-rst","patch_set":9,"id":"5a3905b3_a8eb22af","line":263,"range":{"start_line":263,"start_character":38,"end_line":263,"end_character":42},"updated":"2017-01-20 16:42:08.000000000","message":"s/were/where/ (femtonit)","commit_id":"3c043c5ecce15e4f2c953fdcd11d0b1bd20a3483"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"f0fb6befbcb5b3e3330db3f3a1f03709b45be97a","unresolved":false,"context_lines":[{"line_number":260,"context_line":""},{"line_number":261,"context_line":"Note that the timeout arg to `jenkins.Jenkins()` is the socket connection"},{"line_number":262,"context_line":"timeout. If you set this to be more than the timeout value passed to"},{"line_number":263,"context_line":"`wait_for_normal_op()`, then in cases were the underlying connection is not"},{"line_number":264,"context_line":"rejected (firewall black-hole, or slow connection) then `wait_for_normal_op()`"},{"line_number":265,"context_line":"may wait at least the connection timeout, or a multiple of it where multiple"},{"line_number":266,"context_line":"connection attempts are made. A connection timeout of 5 seconds and a wait"}],"source_content_type":"text/x-rst","patch_set":9,"id":"5a3905b3_b2b1b649","line":263,"range":{"start_line":263,"start_character":38,"end_line":263,"end_character":42},"in_reply_to":"5a3905b3_a8eb22af","updated":"2017-01-21 14:42:43.000000000","message":"Done","commit_id":"3c043c5ecce15e4f2c953fdcd11d0b1bd20a3483"}],"jenkins/__init__.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"a8b395eadd5b49b7eac485574c38ad65c8246287","unresolved":false,"context_lines":[{"line_number":816,"context_line":"        saved_timeout \u003d self.timeout"},{"line_number":817,"context_line":"        while True:"},{"line_number":818,"context_line":"            try:"},{"line_number":819,"context_line":"                # Reset socket timeout to it\u0027s default so we don\u0027t"},{"line_number":820,"context_line":"                # end up waiting ages"},{"line_number":821,"context_line":"                self.timeout \u003d socket._GLOBAL_DEFAULT_TIMEOUT"},{"line_number":822,"context_line":"                if self.get_info()[\u0027mode\u0027] \u003d\u003d \u0027NORMAL\u0027:"}],"source_content_type":"text/x-python","patch_set":3,"id":"da86d52c_a6f6d6f7","line":819,"updated":"2015-02-13 16:53:21.000000000","message":"s/it\u0027s/its/ (femtonit)","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"08f5d44065300a96f84090e5b433c9adf2548d4c","unresolved":false,"context_lines":[{"line_number":819,"context_line":"                # Reset socket timeout to it\u0027s default so we don\u0027t"},{"line_number":820,"context_line":"                # end up waiting ages"},{"line_number":821,"context_line":"                self.timeout \u003d socket._GLOBAL_DEFAULT_TIMEOUT"},{"line_number":822,"context_line":"                if self.get_info()[\u0027mode\u0027] \u003d\u003d \u0027NORMAL\u0027:"},{"line_number":823,"context_line":"                    return True"},{"line_number":824,"context_line":"            except (KeyError, EmptyResponseException, BadHTTPException):"},{"line_number":825,"context_line":"                # key missing from JSON, empty response or errors in"}],"source_content_type":"text/x-python","patch_set":3,"id":"da86d52c_11ab8275","line":822,"updated":"2015-02-13 00:03:25.000000000","message":"i\u0027m wondering if the delay might be less erratic if you use the get_version() method instead?  i don\u0027t think the mode provides much info anyways.","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":1054,"name":"Darragh Bailey","email":"daragh.bailey@gmail.com","username":"dbailey-k"},"change_message_id":"7866a174aec2d5c986bd15b04a67098cd3a0a23c","unresolved":false,"context_lines":[{"line_number":819,"context_line":"                # Reset socket timeout to it\u0027s default so we don\u0027t"},{"line_number":820,"context_line":"                # end up waiting ages"},{"line_number":821,"context_line":"                self.timeout \u003d socket._GLOBAL_DEFAULT_TIMEOUT"},{"line_number":822,"context_line":"                if self.get_info()[\u0027mode\u0027] \u003d\u003d \u0027NORMAL\u0027:"},{"line_number":823,"context_line":"                    return True"},{"line_number":824,"context_line":"            except (KeyError, EmptyResponseException, BadHTTPException):"},{"line_number":825,"context_line":"                # key missing from JSON, empty response or errors in"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a122d0e_8e3a0633","line":822,"in_reply_to":"da86d52c_06bc0206","updated":"2016-04-22 21:07:08.000000000","message":"Probably also a case that communication takes a while if jenkins is slow to respond but still processing the query.\n\nNormal mode is required for most operations to succeed, basically it means that it\u0027s not still coming up and processing it\u0027s internal data and can accept requests such as update jobs, create new jobs, etc. When not in normal mode anything that is not a query won\u0027t work, possibly could implement a common wait and provide some condition, i.e. is responding, is starting, is ready.","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"a8b395eadd5b49b7eac485574c38ad65c8246287","unresolved":false,"context_lines":[{"line_number":819,"context_line":"                # Reset socket timeout to it\u0027s default so we don\u0027t"},{"line_number":820,"context_line":"                # end up waiting ages"},{"line_number":821,"context_line":"                self.timeout \u003d socket._GLOBAL_DEFAULT_TIMEOUT"},{"line_number":822,"context_line":"                if self.get_info()[\u0027mode\u0027] \u003d\u003d \u0027NORMAL\u0027:"},{"line_number":823,"context_line":"                    return True"},{"line_number":824,"context_line":"            except (KeyError, EmptyResponseException, BadHTTPException):"},{"line_number":825,"context_line":"                # key missing from JSON, empty response or errors in"}],"source_content_type":"text/x-python","patch_set":3,"id":"da86d52c_06bc0206","line":822,"in_reply_to":"da86d52c_11ab8275","updated":"2015-02-13 16:53:21.000000000","message":"Yeah, pick the simplest method as a basic ping.  After that starts returning normally, then maybe you need to look at mode…but I don\u0027t know much about what \"mode\" signifies in Jenkins, so I don\u0027t know…","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"08f5d44065300a96f84090e5b433c9adf2548d4c","unresolved":false,"context_lines":[{"line_number":821,"context_line":"                self.timeout \u003d socket._GLOBAL_DEFAULT_TIMEOUT"},{"line_number":822,"context_line":"                if self.get_info()[\u0027mode\u0027] \u003d\u003d \u0027NORMAL\u0027:"},{"line_number":823,"context_line":"                    return True"},{"line_number":824,"context_line":"            except (KeyError, EmptyResponseException, BadHTTPException):"},{"line_number":825,"context_line":"                # key missing from JSON, empty response or errors in"},{"line_number":826,"context_line":"                # get_info due to incomplete HTTP responses"},{"line_number":827,"context_line":"                pass"}],"source_content_type":"text/x-python","patch_set":3,"id":"da86d52c_f1c6ee47","line":824,"updated":"2015-02-13 00:03:25.000000000","message":"I think you\u0027ll want to add a JenkinsException here otherwise this method will exit when jenkins is not even accepting connections.  It will exit with \"\njenkins.JenkinsException: Error in request: [Errno 61] Connection refused\"","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"08f5d44065300a96f84090e5b433c9adf2548d4c","unresolved":false,"context_lines":[{"line_number":821,"context_line":"                self.timeout \u003d socket._GLOBAL_DEFAULT_TIMEOUT"},{"line_number":822,"context_line":"                if self.get_info()[\u0027mode\u0027] \u003d\u003d \u0027NORMAL\u0027:"},{"line_number":823,"context_line":"                    return True"},{"line_number":824,"context_line":"            except (KeyError, EmptyResponseException, BadHTTPException):"},{"line_number":825,"context_line":"                # key missing from JSON, empty response or errors in"},{"line_number":826,"context_line":"                # get_info due to incomplete HTTP responses"},{"line_number":827,"context_line":"                pass"}],"source_content_type":"text/x-python","patch_set":3,"id":"da86d52c_31eb26a5","line":824,"updated":"2015-02-13 00:03:25.000000000","message":"I think you\u0027ll want to either add a JenkinsException here or another custom exception otherwise this method will exit when jenkins is not even accepting connections.  It will exit with \"\njenkins.JenkinsException: Error in request: [Errno 61] Connection refused\"","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"08f5d44065300a96f84090e5b433c9adf2548d4c","unresolved":false,"context_lines":[{"line_number":827,"context_line":"                pass"},{"line_number":828,"context_line":"            finally:"},{"line_number":829,"context_line":"                self.timeout \u003d saved_timeout"},{"line_number":830,"context_line":"            timeout -\u003d 1"},{"line_number":831,"context_line":"            if timeout \u003c 0:"},{"line_number":832,"context_line":"                break"},{"line_number":833,"context_line":"            time.sleep(1)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da86d52c_b1839601","line":830,"updated":"2015-02-13 00:03:25.000000000","message":"I think some slow processing is happening in between sleeps which causes the delay to be much longer than what a user might expect.  \n\nI added a command to print timestamp here:\n   print (time.strftime(\"%H:%M:%S\"))\n\nstop my jenkins\nstarted it then ran the following:\n\n\u003e\u003e\u003e j.wait_for_normal_op(10)\n  15:51:03\n  15:51:04\n  15:51:05\n  15:51:06\n  15:51:13   \n  15:51:14\n  15:51:43      \u003c-- 29 sec delay\n  15:51:44\n  15:51:46\n  15:51:48\n  15:51:49\n  False\n\u003e\u003e\u003e j.wait_for_normal_op(10)\n  15:51:54\n  15:51:56\n  15:51:57\n  15:51:59\n  15:52:00\n  15:52:02\n  15:52:03\n  15:52:04\n  True","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":1054,"name":"Darragh Bailey","email":"daragh.bailey@gmail.com","username":"dbailey-k"},"change_message_id":"7866a174aec2d5c986bd15b04a67098cd3a0a23c","unresolved":false,"context_lines":[{"line_number":827,"context_line":"                pass"},{"line_number":828,"context_line":"            finally:"},{"line_number":829,"context_line":"                self.timeout \u003d saved_timeout"},{"line_number":830,"context_line":"            timeout -\u003d 1"},{"line_number":831,"context_line":"            if timeout \u003c 0:"},{"line_number":832,"context_line":"                break"},{"line_number":833,"context_line":"            time.sleep(1)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1a122d0e_0e3436f9","line":830,"in_reply_to":"da86d52c_668bfe1e","updated":"2016-04-22 21:07:08.000000000","message":"The other thing to remember is that when you set the socket timeout to default global timeout, it becomes blocking and waits for the other side.\n\nI think the correct approach is actually to leave the timeout set as it is, which is a connection timeout, then treat this timeout as being the overall wait timeout, and document the difference.\n\nIf someone sets a high timeout on the jenkins object for connections and then a lower timeout, then they should only get a single attempt at a connection if connection takes a long time to respond.","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"a8b395eadd5b49b7eac485574c38ad65c8246287","unresolved":false,"context_lines":[{"line_number":827,"context_line":"                pass"},{"line_number":828,"context_line":"            finally:"},{"line_number":829,"context_line":"                self.timeout \u003d saved_timeout"},{"line_number":830,"context_line":"            timeout -\u003d 1"},{"line_number":831,"context_line":"            if timeout \u003c 0:"},{"line_number":832,"context_line":"                break"},{"line_number":833,"context_line":"            time.sleep(1)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da86d52c_668bfe1e","line":830,"in_reply_to":"da86d52c_b1839601","updated":"2015-02-13 16:53:21.000000000","message":"I\u0027m rather tempted to suggest using some sort of exponential backoff algorithm as well; after all, every REST hit is going to slow Jenkins down a bit to process that hit.\n\nAs for the huge delay, well, remember that it could take Jenkins a long time to finally reply to a query.  We\u0027re using LDAP-based authentication with Jenkins, and it can take nearly an hour to reconfigure Jenkins with JJB because of all the LDAP queries…so this is something that we\u0027re quite sensitive to :)","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"5dc608d6183f1855af0288e135b3734360cb1b28","unresolved":false,"context_lines":[{"line_number":1341,"context_line":"        :returns: ``True`` if Jenkins became ready in time, ``False``"},{"line_number":1342,"context_line":"                   otherwise."},{"line_number":1343,"context_line":"        \u0027\u0027\u0027"},{"line_number":1344,"context_line":"        if timeout \u003c 0:"},{"line_number":1345,"context_line":"            raise ValueError(\"Timeout must be \u003e\u003d 0 not %d\" % timeout)"},{"line_number":1346,"context_line":""},{"line_number":1347,"context_line":"        if (self.timeout !\u003d socket._GLOBAL_DEFAULT_TIMEOUT and"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a122d0e_d21eceb9","line":1344,"updated":"2016-04-29 01:22:57.000000000","message":"is 0 a valid timeout?  if so what does a timeout of 0 mean?  wait indefinitely?  whatever the functionality, it should probably be documented above.","commit_id":"205f5f203cc4ed7916ccd640cc52f565d6e5d575"},{"author":{"_account_id":1054,"name":"Darragh Bailey","email":"daragh.bailey@gmail.com","username":"dbailey-k"},"change_message_id":"706f0a46a5cd7cc3602e851faf3652447da561f1","unresolved":false,"context_lines":[{"line_number":1341,"context_line":"        :returns: ``True`` if Jenkins became ready in time, ``False``"},{"line_number":1342,"context_line":"                   otherwise."},{"line_number":1343,"context_line":"        \u0027\u0027\u0027"},{"line_number":1344,"context_line":"        if timeout \u003c 0:"},{"line_number":1345,"context_line":"            raise ValueError(\"Timeout must be \u003e\u003d 0 not %d\" % timeout)"},{"line_number":1346,"context_line":""},{"line_number":1347,"context_line":"        if (self.timeout !\u003d socket._GLOBAL_DEFAULT_TIMEOUT and"}],"source_content_type":"text/x-python","patch_set":4,"id":"1a122d0e_dbba62bf","line":1344,"in_reply_to":"1a122d0e_d21eceb9","updated":"2016-04-29 10:20:37.000000000","message":"I believe timeout of 0 would be, attempt the two calls and return without retrying, but should still respect the connection timeout set on object creation.\n\n0 would mean that a failure from either get_version() or checking of get_info() for normal mode would return false, but not necessarily immediately, could still take a number of seconds.\n\nThe only real way to be absolutely sure that you only wait the exact number of seconds would be to spin off a separate process to check, looping here and terminating it should it fail to return success. But I think that\u0027s a little overkill for scenarios where someone set a 5 second connection timeout via __init__ and then complains that waiting for jenkins to be up doesn\u0027t return in less time than that.\n\nI\u0027m inclined to just document the unintended consequences of picking bad values and add warnings where sensible.\n\nDoes this make sense?","commit_id":"205f5f203cc4ed7916ccd640cc52f565d6e5d575"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"5dc608d6183f1855af0288e135b3734360cb1b28","unresolved":false,"context_lines":[{"line_number":1361,"context_line":"                    while True:"},{"line_number":1362,"context_line":"                        # when not in normal node, most requests will"},{"line_number":1363,"context_line":"                        # be ignored or fail"},{"line_number":1364,"context_line":"                        yield self.get_info()[\u0027mode\u0027] \u003d\u003d \u0027NORMAL\u0027"},{"line_number":1365,"context_line":"                else:"},{"line_number":1366,"context_line":"                    yield False"},{"line_number":1367,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1a122d0e_556c68cf","line":1364,"updated":"2016-04-29 01:22:57.000000000","message":"This call will timeout on _GLOBAL_DEFAULT_TIMEOUT instead of the timeout that\u0027s pased into this function so even if you call \"j.wait_for_normal_op(5)\" and the jenkins server does not respond within 5 seconds it will continue to wait longer than 5 seconds.  I think we need to temporarily set _GLOBAL_DEFAULT_TIMEOUT before making this call?","commit_id":"205f5f203cc4ed7916ccd640cc52f565d6e5d575"},{"author":{"_account_id":1054,"name":"Darragh Bailey","email":"daragh.bailey@gmail.com","username":"dbailey-k"},"change_message_id":"706f0a46a5cd7cc3602e851faf3652447da561f1","unresolved":false,"context_lines":[{"line_number":1361,"context_line":"                    while True:"},{"line_number":1362,"context_line":"                        # when not in normal node, most requests will"},{"line_number":1363,"context_line":"                        # be ignored or fail"},{"line_number":1364,"context_line":"                        yield self.get_info()[\u0027mode\u0027] \u003d\u003d \u0027NORMAL\u0027"},{"line_number":1365,"context_line":"                else:"},{"line_number":1366,"context_line":"                    yield False"},{"line_number":1367,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1a122d0e_5b3e52b8","line":1364,"in_reply_to":"1a122d0e_556c68cf","updated":"2016-04-29 10:20:37.000000000","message":"I think we need to separate between the different timeouts:\n\n * __init__ timeout: control connection timeouts\n * wait_for_normal_op: absolute timeout to wait for multiple connections to connect.\n\nAs this is an API, we should allow the consumer to control both options, and to respect them, presumably even if they could cause something stupid to happen.\n\nI don\u0027t think we should ever explicitly reset the timeout to _GLOBAL_DEFAULT_TIMEOUT, since that actually means by default to never timeout, or rather default to the system connection timeout which AFAIK is 15 minutes for TCP. Assuming you didn\u0027t get connection refused but rather just no response.\n\n\nThe questions remaining:\n\nIf someone using this API doesn\u0027t set the timeout when creating the jenkins object, is it correct to override the default timeout? What would be an appropriate value? I guess the total time of the passed timeout to this method might be most correct? If you can\u0027t connect within that time, should return false anyway.\n\nIf the API user puts in a bad value (what if they explicitly set _GLOBAL_DEFAULT_TIMEOUT), should we correct them or just warn them that it might be a bad idea?\n\nCurrently leaning towards just warning them instead of trying to correct them as I feel API\u0027s should warn about possible bad consequences, while it\u0027s more an application\u0027s job to prevent bad consequences.\n\nIf that makes sense to you, I\u0027m update the code and function docstring to reflect.","commit_id":"205f5f203cc4ed7916ccd640cc52f565d6e5d575"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"f629551962194f4e08da86317969b14470debb80","unresolved":false,"context_lines":[{"line_number":1657,"context_line":"        Setting timeout to be less than the configured connection timeout"},{"line_number":1658,"context_line":"        may result in this waiting for at least the connection timeout"},{"line_number":1659,"context_line":"        length of time before returning. It is recommended that the timeout"},{"line_number":1660,"context_line":"        here should be at least as long as any set connection timeout."},{"line_number":1661,"context_line":"        \u0027\u0027\u0027"},{"line_number":1662,"context_line":"        if timeout \u003c 0:"},{"line_number":1663,"context_line":"            raise ValueError(\"Timeout must be \u003e\u003d 0 not %d\" % timeout)"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a6eadb0_789b9566","line":1660,"updated":"2016-12-21 07:50:16.000000000","message":"The usage of this might result in unexpected behavior.  I\u0027m wondering if it might be beneficial to add one or more examples of this in the documentation which would also make this disclaimer more prominent to users.","commit_id":"7edb8ce46bf917fe28118723848d7ec892115b32"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"52a89bc6b1b5f2acb4f9748ca140815203a9adb3","unresolved":false,"context_lines":[{"line_number":1657,"context_line":"        Setting timeout to be less than the configured connection timeout"},{"line_number":1658,"context_line":"        may result in this waiting for at least the connection timeout"},{"line_number":1659,"context_line":"        length of time before returning. It is recommended that the timeout"},{"line_number":1660,"context_line":"        here should be at least as long as any set connection timeout."},{"line_number":1661,"context_line":"        \u0027\u0027\u0027"},{"line_number":1662,"context_line":"        if timeout \u003c 0:"},{"line_number":1663,"context_line":"            raise ValueError(\"Timeout must be \u003e\u003d 0 not %d\" % timeout)"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa48f94a_92943ce9","line":1660,"in_reply_to":"1a6eadb0_56e305d9","updated":"2016-12-21 17:34:05.000000000","message":"I think a usage example is important but I\u0027ll let you decide whether you want to add this info to the usage doc.  This description is clearer but might be too verbose/technical to include with usage example.","commit_id":"7edb8ce46bf917fe28118723848d7ec892115b32"},{"author":{"_account_id":1054,"name":"Darragh Bailey","email":"daragh.bailey@gmail.com","username":"dbailey-k"},"change_message_id":"cf6ddd839b97b229ab9e121e579d2012a4cff0f5","unresolved":false,"context_lines":[{"line_number":1657,"context_line":"        Setting timeout to be less than the configured connection timeout"},{"line_number":1658,"context_line":"        may result in this waiting for at least the connection timeout"},{"line_number":1659,"context_line":"        length of time before returning. It is recommended that the timeout"},{"line_number":1660,"context_line":"        here should be at least as long as any set connection timeout."},{"line_number":1661,"context_line":"        \u0027\u0027\u0027"},{"line_number":1662,"context_line":"        if timeout \u003c 0:"},{"line_number":1663,"context_line":"            raise ValueError(\"Timeout must be \u003e\u003d 0 not %d\" % timeout)"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a6eadb0_56e305d9","line":1660,"in_reply_to":"1a6eadb0_789b9566","updated":"2016-12-21 10:26:44.000000000","message":"I\u0027m guessing you mean \"Setting timeout to be less than the configured connection timeout may result in this waiting for at least the connection timeout length of time before returning\" isn\u0027t clear enough.\n\nShould I say:\n\n When your jenkins server is not responding to connection attempts,\n setting `timeout` less than the connection `timeout` set in the __init__,\n will result in always waiting for at least the connection `timeout` here.\n To avoid, you must set the connection timeout to the lowest value that you\n expect your jenkins instance to be able to return a valid response and\n ensure that timeout here is greater.","commit_id":"7edb8ce46bf917fe28118723848d7ec892115b32"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"f629551962194f4e08da86317969b14470debb80","unresolved":false,"context_lines":[{"line_number":1659,"context_line":"        length of time before returning. It is recommended that the timeout"},{"line_number":1660,"context_line":"        here should be at least as long as any set connection timeout."},{"line_number":1661,"context_line":"        \u0027\u0027\u0027"},{"line_number":1662,"context_line":"        if timeout \u003c 0:"},{"line_number":1663,"context_line":"            raise ValueError(\"Timeout must be \u003e\u003d 0 not %d\" % timeout)"},{"line_number":1664,"context_line":""},{"line_number":1665,"context_line":"        if (not self._timeout_warning_issued and"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a6eadb0_7846357c","line":1662,"updated":"2016-12-21 07:50:16.000000000","message":"I\u0027m still not sure why 0 is a valid timeout.  Also what would be the use case for using 0 seconds as a timeout?  This info would be nice to add next to an example usage of this method.","commit_id":"7edb8ce46bf917fe28118723848d7ec892115b32"},{"author":{"_account_id":1054,"name":"Darragh Bailey","email":"daragh.bailey@gmail.com","username":"dbailey-k"},"change_message_id":"cf6ddd839b97b229ab9e121e579d2012a4cff0f5","unresolved":false,"context_lines":[{"line_number":1659,"context_line":"        length of time before returning. It is recommended that the timeout"},{"line_number":1660,"context_line":"        here should be at least as long as any set connection timeout."},{"line_number":1661,"context_line":"        \u0027\u0027\u0027"},{"line_number":1662,"context_line":"        if timeout \u003c 0:"},{"line_number":1663,"context_line":"            raise ValueError(\"Timeout must be \u003e\u003d 0 not %d\" % timeout)"},{"line_number":1664,"context_line":""},{"line_number":1665,"context_line":"        if (not self._timeout_warning_issued and"}],"source_content_type":"text/x-python","patch_set":6,"id":"1a6eadb0_96375d4c","line":1662,"in_reply_to":"1a6eadb0_7846357c","updated":"2016-12-21 10:26:44.000000000","message":"0 means try one and return immediately, don\u0027t sleep, don\u0027t loop around multiple times if the connection succeeded in less than a second, just perform a single call and return the result.\n\nIt turns this into a non-blocking call to check for normal operation and of course helps testing return immediately.\n\nIs it worth re-factoring that out to a seperate method that can be called instead to check status? I suspect it would result in duplication, rather than reuse.\n\nOr just document the non-blocking single attempt behaviour with the method?","commit_id":"7edb8ce46bf917fe28118723848d7ec892115b32"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"52a89bc6b1b5f2acb4f9748ca140815203a9adb3","unresolved":false,"context_lines":[{"line_number":1659,"context_line":"        length of time before returning. It is recommended that the timeout"},{"line_number":1660,"context_line":"        here should be at least as long as any set connection timeout."},{"line_number":1661,"context_line":"        \u0027\u0027\u0027"},{"line_number":1662,"context_line":"        if timeout \u003c 0:"},{"line_number":1663,"context_line":"            raise ValueError(\"Timeout must be \u003e\u003d 0 not %d\" % timeout)"},{"line_number":1664,"context_line":""},{"line_number":1665,"context_line":"        if (not self._timeout_warning_issued and"}],"source_content_type":"text/x-python","patch_set":6,"id":"fa48f94a_92627c15","line":1662,"in_reply_to":"1a6eadb0_96375d4c","updated":"2016-12-21 17:34:05.000000000","message":"IMO documentation is all that\u0027s needed.  I think the description here should be part of a usage example.","commit_id":"7edb8ce46bf917fe28118723848d7ec892115b32"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"33b23f36e3e5dd6c50527089a15719a04b2678ac","unresolved":false,"context_lines":[{"line_number":1680,"context_line":"                    while True:"},{"line_number":1681,"context_line":"                        # json API will only return valid info once Jenkins"},{"line_number":1682,"context_line":"                        # is ready, so just check any known field exists"},{"line_number":1683,"context_line":"                        # when not in normal node, most requests will"},{"line_number":1684,"context_line":"                        # be ignored or fail"},{"line_number":1685,"context_line":"                        yield \u0027mode\u0027 in self.get_info()"},{"line_number":1686,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a3c09a3_79d5fee2","line":1683,"range":{"start_line":1683,"start_character":45,"end_line":1683,"end_character":49},"updated":"2017-01-18 17:43:19.000000000","message":"node/mode","commit_id":"abc9008ae4aed8ecac79591b6ee7885f6671b06d"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"85765c36fb18f386d0a4fa3274ce41009c3f6188","unresolved":false,"context_lines":[{"line_number":1680,"context_line":"                    while True:"},{"line_number":1681,"context_line":"                        # json API will only return valid info once Jenkins"},{"line_number":1682,"context_line":"                        # is ready, so just check any known field exists"},{"line_number":1683,"context_line":"                        # when not in normal node, most requests will"},{"line_number":1684,"context_line":"                        # be ignored or fail"},{"line_number":1685,"context_line":"                        yield \u0027mode\u0027 in self.get_info()"},{"line_number":1686,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a3905b3_d5964b4b","line":1683,"range":{"start_line":1683,"start_character":45,"end_line":1683,"end_character":49},"in_reply_to":"7a3c09a3_79d5fee2","updated":"2017-01-20 16:17:14.000000000","message":"Done","commit_id":"abc9008ae4aed8ecac79591b6ee7885f6671b06d"}],"tests/test_jenkins.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"a8b395eadd5b49b7eac485574c38ad65c8246287","unresolved":false,"context_lines":[{"line_number":1439,"context_line":"                  return_value\u003djson.dumps({\u0027mode\u0027: \u0027NORMAL\u0027}))"},{"line_number":1440,"context_line":"    def test_wait_for_normal_op(self, jenkins_mock):"},{"line_number":1441,"context_line":"        j \u003d jenkins.Jenkins(\u0027http://example.com\u0027, \u0027test\u0027, \u0027test\u0027)"},{"line_number":1442,"context_line":"        self.assertEqual(True, j.wait_for_normal_op(0))"},{"line_number":1443,"context_line":""},{"line_number":1444,"context_line":"    @patch.object(jenkins.Jenkins, \u0027jenkins_open\u0027,"},{"line_number":1445,"context_line":"                  side_effect\u003djenkins.EmptyResponseException())"}],"source_content_type":"text/x-python","patch_set":3,"id":"da86d52c_468d1a2a","line":1442,"updated":"2015-02-13 16:53:21.000000000","message":"I think you should add a test to validate the looping back around and to verify that timeouts are set up properly.","commit_id":"426dd4c7b99a98685aaa1b448b8b393abae56ac2"},{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"191fc6a110c51013bec1d2ad969f52eb340055dc","unresolved":false,"context_lines":[{"line_number":229,"context_line":"                  return_value\u003d\"Version42\")"},{"line_number":230,"context_line":"    def test_wait_for_normal_op(self, version_mock, jenkins_mock):"},{"line_number":231,"context_line":"        j \u003d jenkins.Jenkins(\u0027http://example.com\u0027, \u0027test\u0027, \u0027test\u0027)"},{"line_number":232,"context_line":"        self.assertEqual(True, j.wait_for_normal_op(0))"},{"line_number":233,"context_line":""},{"line_number":234,"context_line":"    @patch.object(jenkins.Jenkins, \u0027jenkins_open\u0027,"},{"line_number":235,"context_line":"                  side_effect\u003djenkins.EmptyResponseException())"}],"source_content_type":"text/x-python","patch_set":5,"id":"1a6eadb0_4172854a","line":232,"updated":"2016-12-20 16:40:04.000000000","message":"It\u0027d probably be better to use assertTrue() and assertFalse() here and on line 240.","commit_id":"80f838b52a1bb871e6fd3c6eb61416e8589b0640"}]}
