get_running_builds(): intermittent 'node[%s] does not exist exception' while running on Cloudbees:

Bug #2059213 reported by Marco Carcano
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python Jenkins
New
Undecided
Unassigned

Bug Description

The below exception happens intermittently.

I guess that this may be caused when an agent is released from a Client Master in the same time the API call are happening:

This is the full trace:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/jenkins/__init__.py", line 588, in jenkins_request
    return self._response_handler(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/jenkins/__init__.py", line 541, in _response_handler
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://client-master.mycompany.corp/computer/agent-08/api/json?depth=2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/jenkins/__init__.py", line 1592, in get_node_info
    response = self.jenkins_open(requests.Request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/jenkins/__init__.py", line 562, in jenkins_open
    return self.jenkins_request(req, add_crumb, resolve_auth).text
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/jenkins/__init__.py", line 602, in jenkins_request
    raise NotFoundException('Requested item could not be found')
jenkins.NotFoundException: Requested item could not be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/scripts/amp.py", line 2524, in <module>
    check_running_jobs(config.pipeline, mr, args, credentials)
  File "/scripts/amp.py", line 2230, in check_running_jobs
    jenkins_check_running_jobs(jenkins_jobs, mr, args, credentials)
  File "/scripts/amp.py", line 1727, in jenkins_check_running_jobs
    builds=jenkins_conn.get_running_builds()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/jenkins/__init__.py", line 1538, in get_running_builds
    info = self.get_node_info(node_name, depth=2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/jenkins/__init__.py", line 1600, in get_node_info
    raise JenkinsException('node[%s] does not exist' % name)
jenkins.JenkinsException: node[agent-08] does not exist

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.