zuul/zuul/zk/exceptions.py
James E. Blair 098442b95b Use kazoo.retry in zkobject
It appears that the division of retryable/non-retryable exceptions
is not exactly as asserted in the comments in the retry handlers
in zkobject.  The kazoo.retry module has a class that implements
retry handling with the correct set of retryable exceptions, so
let's use that instead.

The main thing we lose here is the log messages indicating we are
in a retry loop.  There doesn't appear to be a good way to hook
into KazooRetry for that (we could log in the interrupt method,
but that is called every 0.1 seconds).

The InvalidObjectError exception appears to be unused, so it is
removed (since continuing to use it would make the exception handling
more complex).

Change-Id: I1278cd27873374b4efd90504d7166c74c6057b52
2022-03-14 09:20:56 -07:00

32 lines
948 B
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from kazoo.exceptions import KazooException
class ZuulZooKeeperException(KazooException):
"""Base exception class for all custom ZK exceptions"""
pass
class LockException(ZuulZooKeeperException):
pass
class NoClientException(ZuulZooKeeperException):
def __init__(self):
super().__init__("No zookeeper client!")
class JobRequestNotFound(ZuulZooKeeperException):
pass