)]}'
{"jenkins/__init__.py":[{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"8e8f0b097604e9b235c2b6079477381cfc271522","unresolved":false,"context_lines":[{"line_number":429,"context_line":"           the last build completes."},{"line_number":430,"context_line":""},{"line_number":431,"context_line":"        :param name: Job name, ``str``"},{"line_number":432,"context_line":"        :param timeout: timeout in seconds (default: 10), ``int``"},{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        Example::"},{"line_number":435,"context_line":"            \u003e\u003e\u003e j \u003d Jenkins()"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a41bdd9_bd3d7bc5","line":432,"updated":"2015-07-16 05:21:07.000000000","message":"would be better to throw a Timeout Exception so users can distinguise whether\nthe timeout occurred or the job completed it\u0027s build","commit_id":"9c135a604539279a4db098766c22d6e5fe7f7b42"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"8e8f0b097604e9b235c2b6079477381cfc271522","unresolved":false,"context_lines":[{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        Example::"},{"line_number":435,"context_line":"            \u003e\u003e\u003e j \u003d Jenkins()"},{"line_number":436,"context_line":"            \u003e\u003e\u003e last_build \u003d j.wait_for_build(\u0027TestJob\u0027)"},{"line_number":437,"context_line":"        \u0027\u0027\u0027"},{"line_number":438,"context_line":"        while self.is_building(name):"},{"line_number":439,"context_line":"            time.sleep(1)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a41bdd9_dd387fd5","line":436,"updated":"2015-07-16 05:21:07.000000000","message":"better example would be..\n\n j.build_job(\u0027TestJob\u0027)\n # wait 1 minute for job to complete\n j.wait_for_build(\u0027TestJob\u0027, timeout\u003d60)\n print \u0027TestJob completed\u0027","commit_id":"9c135a604539279a4db098766c22d6e5fe7f7b42"},{"author":{"_account_id":2475,"name":"Antoine Musso","email":"hashar@free.fr","username":"hashar"},"change_message_id":"8c89b1e8e60e7dd5b46549af291eb58fa58b9f8e","unresolved":false,"context_lines":[{"line_number":439,"context_line":"            time.sleep(1)"},{"line_number":440,"context_line":"            timeout \u003d timeout - 1"},{"line_number":441,"context_line":"            if timeout \u003c\u003d 0:"},{"line_number":442,"context_line":"                break"},{"line_number":443,"context_line":""},{"line_number":444,"context_line":"    def get_queue_info(self):"},{"line_number":445,"context_line":"        \u0027\u0027\u0027:returns: list of job dictionaries, ``[dict]``"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_0fd98021","line":442,"updated":"2015-07-20 19:25:51.000000000","message":"There is an issue with jobs that run very fast. By the time you trigger the build and then wait for it, the build is already complete and that it is going to loop.\n\nThere is also an issue when jobs are run multiple times. If only one build can run at anytime and a build is already happening, the build will be considered running while it is really enqueued.  Same effect when a job can run concurrently and a build is already running :-(\n\nAccording to Jenkins API, the \u003cjob name\u003e/build POST returns a 201:\n\n\u003e To programmatically schedule a new build, post to job/build. If the build has parameters, post to job/buildWithParameters and provide the parameters as form data.\n\u003e Either way, the successful queueing will result in 201 status code with Location HTTP header pointing the URL of the item in the queue. By polling the api/xml sub-URL of the queue item, you can track the status of the queued task. Generally, the task will go through some state transitions, then eventually it becomes either cancelled (look for the \"cancelled\" boolean property), or gets executed (look for the \"executable\" property that typically points to the AbstractBuild object.) \n\n\nhttps://issues.jenkins-ci.org/browse/JENKINS-12827 has some more details (resolved/wontfix).\n\nSo you poll the entry in the queue with something like /queue/item/25/api/xml and once the build starts you get the build #.  Though that still does not solve the issue of short living jobs that would disappear from the queue rather quickly.\n\nSeems the queue items have a 300 seconds TTL from https://issues.jenkins-ci.org/browse/JENKINS-26228 . So that should be good enough :)","commit_id":"9c135a604539279a4db098766c22d6e5fe7f7b42"},{"author":{"_account_id":6987,"name":"Khai Do","email":"zaro0508@gmail.com","username":"zaro0508"},"change_message_id":"8e8f0b097604e9b235c2b6079477381cfc271522","unresolved":false,"context_lines":[{"line_number":439,"context_line":"            time.sleep(1)"},{"line_number":440,"context_line":"            timeout \u003d timeout - 1"},{"line_number":441,"context_line":"            if timeout \u003c\u003d 0:"},{"line_number":442,"context_line":"                break"},{"line_number":443,"context_line":""},{"line_number":444,"context_line":"    def get_queue_info(self):"},{"line_number":445,"context_line":"        \u0027\u0027\u0027:returns: list of job dictionaries, ``[dict]``"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a41bdd9_7d3373f6","line":442,"updated":"2015-07-16 05:21:07.000000000","message":"raise timeout exception here","commit_id":"9c135a604539279a4db098766c22d6e5fe7f7b42"}]}
