get_running_builds very slow to return results

Bug #1826803 reported by Bao Haojun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python Jenkins
New
Undecided
Unassigned

Bug Description

In our site, I have found get_running_builds to be very slow.

I have found that it's because depth=2 is used when calling get_node_info, and it seems to be fixed by the following patch:

    diff --git a/jenkins/__init__.py b/jenkins/__init__.py
    index b443756..20cc17c 100755
    --- a/jenkins/__init__.py
    +++ b/jenkins/__init__.py
    @@ -1411,7 +1411,7 @@ class Jenkins(object):
                 else:
                     node_name = node['name']
                 try:
    - info = self.get_node_info(node_name, depth=2)
    + info = self.get_node_info(node_name, depth=1)
                 except JenkinsException as e:
                     # Jenkins may 500 on depth >0. If the node info comes back
                     # at depth 0 treat it as a node not running any jobs.

After we change the depth to 1, I can still get the list of running builds, so depth=2 seems to be a waste. But I may be missing something here, is there a reason why we must use depth=2 instead of depth=1?

Revision history for this message
Bao Haojun (baohaojun) wrote :

When using depth=2, it takes 6 minutes to return, after changing it to depth=1, it takes 2 seconds only.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.