Commit 8c482bca authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

add messages when warning

parent 7c82fd9a
......@@ -49,6 +49,36 @@ class UpdateMessage(Message):
(self.archive, self.objname, self.serial))
class AlreadyProbedMessage(Message):
def __init__(self, *args, **kwargs):
Message.__init__(self, *args, **kwargs)
self.archive = kwargs["archive"]
self.objname = kwargs["objname"]
self.serial = kwargs["serial"]
self.logger.warning("Serial mismatch in probing archive: %s, "
"object: '%s'" % (self.archive, self.objname))
class HeartbeatNoProbeMessage(Message):
def __init__(self, *args, **kwargs):
Message.__init__(self, *args, **kwargs)
self.archive = kwargs["archive"]
self.objname = kwargs["objname"]
self.heartbeat = kwargs["heartbeat"]
self.logger.warning("Object '%s' is being synced; "
"Probe in archive %s aborted." %
(self.objname, self.archive))
class HeartbeatNoDecideMessage(Message):
def __init__(self, *args, **kwargs):
Message.__init__(self, *args, **kwargs)
self.objname = kwargs["objname"]
self.heartbeat = kwargs["heartbeat"]
self.logger.warning("Object '%s' already handled; aborting."
% self.objname)
class LiveInfoUpdateMessage(Message):
def __init__(self, *args, **kwargs):
Message.__init__(self, *args, **kwargs)
......
......@@ -120,12 +120,15 @@ class FileSyncer(object):
if beat is not None:
if utils.younger_than(
beat["tstamp"], self.settings.action_max_wait):
logger.warning("Object '%s' is being synced; "
"Probe aborted." % objname)
msg = messaging.HeartbeatNoProbeMessage(
archive=archive, objname=objname, heartbeat=beat,
logger=logger)
self.messager.put(msg)
return
if db_state.serial != ref_state.serial:
logger.warning("Serial mismatch in probing archive: %s, "
"object: '%s'" % (archive, objname))
msg = messaging.AlreadyProbedMessage(
archive=archive, objname=objname, serial=serial, logger=logger)
self.messager.put(msg)
return
live_state = client.probe_file(objname, db_state, ref_state, ident)
if live_state is not None:
......@@ -202,8 +205,9 @@ class FileSyncer(object):
else:
if utils.younger_than(
beat["tstamp"], self.settings.action_max_wait):
logger.warning("Object '%s' already handled; aborting."
% objname)
msg = messaging.HeartbeatNoDecideMessage(
objname=objname, heartbeat=beat, logger=logger)
self.messager.put(msg)
return None
logger.warning("Ignoring previous run: %s %s" %
(objname, beat))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment