Created
November 17, 2017 18:01
-
-
Save pbelskiy/919ec917de007636749b4d50032d3fef to your computer and use it in GitHub Desktop.
speedup get_build() of jenkinsapi python module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/jenkinsapi/job.py b/jenkinsapi/job.py | |
index 280cf93..20c6932 100644 | |
--- a/jenkinsapi/job.py | |
+++ b/jenkinsapi/job.py | |
@@ -90,7 +90,7 @@ class Job(JenkinsBase, MutableJenkinsThing): | |
def poll(self, tree=None): | |
data = super(Job, self).poll(tree=tree) | |
- if not tree: | |
+ if not tree and self.jenkins.lazy is False: | |
self._data = self._add_missing_builds(self._data) | |
else: | |
return data | |
@@ -392,7 +392,7 @@ class Job(JenkinsBase, MutableJenkinsThing): | |
def get_build(self, buildnumber): | |
assert isinstance(buildnumber, int) | |
try: | |
- url = self.get_build_dict()[buildnumber] | |
+ url = self.url + str(buildnumber) | |
return Build(url, buildnumber, job=self) | |
except KeyError: | |
raise NotFound('Build #%s not found' % buildnumber) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment