SasanAhmadi commented on code in PR #22802:
URL: https://github.com/apache/airflow/pull/22802#discussion_r844792537
##########
airflow/providers/jenkins/operators/jenkins_job_trigger.py:
##########
@@ -153,9 +153,18 @@ def poll_job_in_queue(self, location: str, jenkins_server:
Jenkins) -> int:
# once it will be available in python-jenkins (v > 0.4.15)
self.log.info('Polling jenkins queue at the url %s', location)
while try_count < self.max_try_before_job_appears:
- location_answer = jenkins_request_with_headers(
- jenkins_server, Request(method='POST', url=location)
- )
+ try:
+ location_answer = jenkins_request_with_headers(
+ jenkins_server, Request(method='POST', url=location)
+ )
+ # we don't want to fail the operator, this will continue to poll
+ # until max_try_before_job_appears reached
+ except (HTTPError, JenkinsException) as ex:
+ self.log.info(f'polling failed, retry polling. Failure reason:
{ex}')
Review Comment:
corrected, thanks for great comment!
##########
airflow/providers/jenkins/operators/jenkins_job_trigger.py:
##########
@@ -168,6 +177,7 @@ def poll_job_in_queue(self, location: str, jenkins_server:
Jenkins) -> int:
return build_number
try_count += 1
time.sleep(self.sleep_time)
+
raise AirflowException(
"The job hasn't been executed after polling " f"the queue
{self.max_try_before_job_appears} times"
Review Comment:
applied
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]