josh-fell commented on a change in pull request #22421:
URL: https://github.com/apache/airflow/pull/22421#discussion_r833328675



##########
File path: airflow/providers/jenkins/hooks/jenkins.py
##########
@@ -46,3 +49,20 @@ def __init__(self, conn_id: str = default_conn_name) -> None:
     def get_jenkins_server(self) -> jenkins.Jenkins:
         """Get jenkins server"""
         return self.jenkins_server
+
+    def get_build_building_state(self, job_name: str, build_number: 
Optional[int]) -> bool:
+        """Get build building state"""
+        try:
+            if not build_number:
+                self.log.info("Build number not specified, getting latest 
build info from Jenkins")
+                job_info = self.jenkins_server.get_job_info(job_name)
+                build_number_to_check = job_info['lastBuild']['number']
+            else:
+                build_number_to_check = build_number
+
+            self.log.info(f"Getting build info for {job_name} build number: 
#{build_number_to_check}")

Review comment:
       ```suggestion
               self.log.info("Getting build info for %s build number: #%s", 
job_name, build_number_to_check)
   ```
   We shouldn't mix f-strings within logging to ensure the formatting is not 
done until the very, very last moment when it's needed. You can read this 
[quick 
reference](https://dev.to/izabelakowal/what-is-the-best-string-formatting-technique-for-logging-in-python-d1d)
 for a little insight as to why.




-- 
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]


Reply via email to