Merge "Allow disabling ZKObject loading error logs"
This commit is contained in:
@@ -968,6 +968,7 @@ class PipelineChangeList(zkobject.ShardedZKObject):
|
||||
# sharded, that may produce an error. If that happens, don't
|
||||
# delete the object, just retry.
|
||||
delete_on_error = False
|
||||
log_error_missing = False
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -1053,6 +1054,7 @@ class PipelineSummary(zkobject.ShardedZKObject):
|
||||
log = logging.getLogger("zuul.PipelineSummary")
|
||||
truncate_on_create = True
|
||||
delete_on_error = False
|
||||
log_error_missing = False
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -2743,6 +2745,7 @@ class NodesetRequest(zkobject.LockableZKObject):
|
||||
class NodesetRequestRevision(zkobject.ZKObject):
|
||||
# We don't want to re-create the request in case it was deleted
|
||||
makepath = False
|
||||
log_error_missing = False
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -3153,6 +3156,7 @@ class ProviderNodeSnapshot(zkobject.LockableZKObject):
|
||||
class ProviderNodeAssignment(zkobject.ZKObject):
|
||||
# We don't want to re-create the node in case it was deleted
|
||||
makepath = False
|
||||
log_error_missing = False
|
||||
ASSIGNMENT_PATH = 'assignment'
|
||||
|
||||
# This object allows us to change the request to which a node is
|
||||
|
||||
+5
-3
@@ -157,6 +157,7 @@ class ZKObject:
|
||||
io_writer_class = sharding.RawZKIO
|
||||
truncate_on_create = False
|
||||
delete_on_error = False
|
||||
log_error_missing = True
|
||||
makepath = True
|
||||
|
||||
# Implementations of these two methods are required
|
||||
@@ -427,9 +428,10 @@ class ZKObject:
|
||||
cls.io_reader_class,
|
||||
context, path)
|
||||
context.profileEvent('get', path)
|
||||
except Exception:
|
||||
context.log.error(
|
||||
"Exception loading ZKObject at %s", path)
|
||||
except Exception as exc:
|
||||
if cls.log_error_missing or not isinstance(exc, NoNodeError):
|
||||
context.log.error(
|
||||
"Exception loading ZKObject at %s", path)
|
||||
if cls.delete_on_error:
|
||||
cls._delete(context, path)
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user