def poll_job_in_queue(self, location, jenkins_server):
try_count = <NUM_LIT:0><EOL>location = location + '<STR_LIT>'<EOL>self.log.info('<STR_LIT>', location)<EOL>while try_count < self.max_try_before_job_appears:<EOL><INDENT>location_answer = jenkins_request_with_headers(jenkins_server,<EOL>Request(location))<EOL>if location_answer is not None:<EOL><INDENT>json_response = json.loads(location_answer['<STR_LIT:body>'])<EOL>if '<STR_LIT>' in json_response:<EOL><INDENT>build_number = json_response['<STR_LIT>']['<STR_LIT>']<EOL>self.log.info('<STR_LIT>',<EOL>build_number)<EOL>return build_number<EOL><DEDENT><DEDENT>try_count += <NUM_LIT:1><EOL>time.sleep(self.sleep_time)<EOL><DEDENT>raise AirflowException("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>self.max_try_before_job_appears)<EOL>
This method poll the jenkins queue until the job is executed.
When we trigger a job through an API call,
the job is first put in the queue without having a build number assigned.
Thus we have to wait the job exit the queue to know its build number.
To do so, we have to add /api/json (or /api/xml) to the location
returned by the build_job call and poll this file.
When a 'executable' block appears in the json, it means the job execution started
and the field 'number' then contains the build number.

:param location: Location to poll, returned in the header of the build_job call
:param jenkins_server: The jenkins server to poll
:return: The build_number corresponding to the triggered job