in services/jenkins-run-statistics/jenkins_utils.py [0:0]
def retrieve_nodes(self):
"""
Retrieve all Jenkins nodes associated with this run.
:return: List JenkinsNode
"""
try:
response = requests.get(url=self._get_blue_ocean_api() + 'nodes',
allow_redirects=True).json()
except json.decoder.JSONDecodeError:
# Jenkins sometimes prints a 404 as HTML with a 200 code...
return None
if 'code' in response and response['code'] is not 200:
logging.error('Error retrieving nodes for run %s: %s', self, response['message'])
return None
jenkins_nodes = list()
for json_node_entry in response:
if not json_node_entry['state']:
logging.debug('Step %s of %s is empty, skipping', json_node_entry['displayName'], self)
logging.debug(json_node_entry)
continue
jenkins_nodes.append(JenkinsNode(parent_run=self, json_node_entry=json_node_entry))
return jenkins_nodes