Last active
July 23, 2017 21:12
-
-
Save Jimilian/af2810d4b6be942f933ddc8830703b1d to your computer and use it in GitHub Desktop.
Compare performance of basic use cases for two the most popular python libraries for Jenkins
This file contains 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
#!/usr/bin/python | |
from __future__ import absolute_import | |
import time | |
import jenkinsapi # python -m pip install jenkinsapi | |
import jenkins # python -m pip install python-jenkins | |
jenksins_url= # i.e. "http://myjenkins" | |
login= | |
password= | |
job_name= | |
# http://pythonhosted.org/jenkinsapi/index.html | |
j1 = jenkinsapi.jenkins.Jenkins(jenkins_url, login, password, lazy=True) | |
# https://python-jenkins.readthedocs.io/en/latest/index.html | |
j2 = jenkins.Jenkins(jenkins_url, login, password) | |
for i in range(10): | |
s = time.time() | |
print("Version:", j1.version) | |
print("Get version for jenkinsapi is done in:", time.time() - s, "s") | |
s = time.time() | |
print("Version:", j2.get_version()) | |
print("Get version for python-jenkins is done in:", time.time() - s, "s") | |
s = time.time() | |
print("Jenkins job config length is", len(j2.get_job_config(job_name))) | |
print("Get config for python-jenkins is done in:", time.time() - s, "s") | |
s = time.time() | |
print("Jenkins job config length is", len(j1.get_job(job_name).get_config())) | |
print("Get config for jenkinsapi is done in:", time.time() - s, "s") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment