Commit f3c51cc8 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Reduce logging

parent e3eeda31
......@@ -49,7 +49,7 @@ class SqliteFileStateDB(FileStateDB):
self.init()
def init(self):
logger.warning("Initializing DB '%s'" % self.dbname)
logger.info("Initializing DB '%s'" % self.dbname)
db = self.db
Q = ("create table if not exists "
......
......@@ -273,12 +273,12 @@ class LocalfsTargetHandle(object):
return
try:
os.rename(fspath, hidden_path)
logger.info("Hiding file '%s' to '%s'" %
(fspath, hidden_path))
logger.debug("Hiding file '%s' to '%s'" %
(fspath, hidden_path))
except OSError as e:
if e.errno in [OS_NO_FILE_OR_DIR, OS_NOT_A_DIR]:
self.unregister_hidden_name(hidden_filename)
logger.info("File '%s' does not exist" % fspath)
logger.debug("File '%s' does not exist" % fspath)
return
else:
raise e
......@@ -329,7 +329,7 @@ class LocalfsTargetHandle(object):
os.rename(self.hidden_path, stash_path)
def finalize(self, filepath, live_info):
logger.info("Finalizing file '%s'" % filepath)
logger.debug("Finalizing file '%s'" % filepath)
if live_info == {}:
return
if live_info[LOCALFS_TYPE] == common.T_FILE:
......@@ -351,7 +351,7 @@ class LocalfsTargetHandle(object):
status = path_status(filepath)
if status == LOCAL_FILE:
try:
logger.info("Cleaning up file '%s'" % filepath)
logger.debug("Cleaning up file '%s'" % filepath)
os.unlink(filepath)
except:
pass
......@@ -407,12 +407,12 @@ class LocalfsSourceHandle(object):
(self.objname, stage_path))
return
logger.info("Staging file '%s' to '%s'" % (self.objname, stage_path))
logger.debug("Staging file '%s' to '%s'" % (self.objname, stage_path))
try:
shutil.copy2(fspath, stage_path)
except IOError as e:
if e.errno in [OS_NO_FILE_OR_DIR, OS_IS_DIR]:
logger.info("Source is not a regural file: '%s'" % fspath)
logger.debug("Source is not a regular file: '%s'" % fspath)
self.unregister_stage_name(stage_filename)
return
else:
......@@ -565,7 +565,7 @@ class LocalfsFileClient(FileClient):
db_cands = dict((name, self.none_info())
for name in self.list_files())
candidates.update(db_cands)
logger.info("Candidates: %s" % candidates)
logger.debug("Candidates: %s" % candidates)
return candidates
@transaction()
......@@ -627,14 +627,14 @@ class LocalfsFileClient(FileClient):
path = event.src_path
if path.startswith(self.CACHEPATH):
return
logger.info("Handling %s" % event)
logger.debug("Handling %s" % event)
handle_path(path)
def on_deleted(this, event):
path = event.src_path
if path.startswith(self.CACHEPATH):
return
logger.info("Handling %s" % event)
logger.debug("Handling %s" % event)
handle_path(path)
def on_modified(this, event):
......@@ -643,7 +643,7 @@ class LocalfsFileClient(FileClient):
path = event.src_path
if path.startswith(self.CACHEPATH):
return
logger.info("Handling %s" % event)
logger.debug("Handling %s" % event)
handle_path(path)
def on_moved(this, event):
......@@ -652,7 +652,7 @@ class LocalfsFileClient(FileClient):
if src_path.startswith(self.CACHEPATH) or \
dest_path.startswith(self.CACHEPATH):
return
logger.info("Handling %s" % event)
logger.debug("Handling %s" % event)
handle_path(src_path)
handle_path(dest_path)
......
......@@ -125,9 +125,8 @@ class SyncMessage(Message):
self.archive = kwargs["archive"]
self.serial = kwargs["serial"]
self.info = kwargs["info"]
self.logger.info("Syncing archive: %s, object: '%s', serial: %s "
"info: %s" %
(self.archive, self.objname, self.serial, self.info))
self.logger.info("Syncing archive: %s, object: '%s', serial: %s"
% (self.archive, self.objname, self.serial))
class AckSyncMessage(Message):
......
......@@ -181,7 +181,7 @@ class PithosTargetHandle(object):
def safe_object_del(self, objname, etag):
del_name = self.mk_del_name(objname, etag)
logger.info("Moving temporarily to '%s'" % del_name)
logger.debug("Moving upstream temporarily to '%s'" % del_name)
self._move_object(objname, etag, del_name)
self._del_object(del_name)
......@@ -194,17 +194,19 @@ class PithosTargetHandle(object):
if_etag_match=etag)
except ClientError as e:
if e.status == 404:
logger.warning("'%s' not found; already moved?" % objname)
logger.warning("Upstream '%s' not found; already moved?"
% objname)
else:
raise
def _del_object(self, del_name):
try:
self.endpoint.del_object(del_name)
logger.info("Deleted tmp '%s'" % del_name)
logger.debug("Deleted upstream tmp '%s'" % del_name)
except ClientError as e:
if e.status == 404:
logger.warning("'%s' not found; already deleted?" % del_name)
logger.warning("Upstream '%s' not found; already deleted?"
% del_name)
else:
raise
......@@ -227,11 +229,11 @@ class PithosTargetHandle(object):
try:
if source_handle.info_is_deleted_or_unhandled():
if etag is not None:
logger.info("Deleting object '%s'" % self.target_objname)
logger.debug("Deleting object '%s'" % self.target_objname)
self.safe_object_del(self.target_objname, etag)
live_info = {}
elif source_handle.info_is_dir():
logger.info("Creating dir '%s'" % self.target_objname)
logger.debug("Creating dir '%s'" % self.target_objname)
r = self.directory_put(self.target_objname, etag)
synced_etag = r.headers["etag"]
live_info = {"pithos_etag": synced_etag,
......@@ -334,8 +336,8 @@ class PithosFileClient(FileClient):
for name in newly_deleted_names)
candidates.update(newly_deleted)
logger.info("Candidates since %s: %s" %
(last_modified, candidates))
logger.debug("Candidates since %s: %s" %
(last_modified, candidates))
return candidates
@transaction()
......
......@@ -198,8 +198,7 @@ class FileSyncer(object):
with self.heartbeat.lock() as hb:
beat = hb.get(objname)
logger.info("object: %s heartbeat: %s" %
(objname, beat))
logger.debug("object: %s heartbeat: %s" % (objname, beat))
if beat is not None:
if beat["ident"] == ident:
msg = messaging.HeartbeatReplayDecideMessage(
......@@ -332,9 +331,9 @@ class FileSyncer(object):
source = synced_source_state.archive
target = synced_target_state.archive
tinfo = synced_target_state.info
logger.info("Acking archive: %s, object: '%s', serial: %s "
"info: %s" %
(target, objname, serial, tinfo))
logger.debug("Acking archive: %s, object: '%s', serial: %s "
"info: %s" %
(target, objname, serial, tinfo))
decision_state = db.get_state(self.DECISION, objname)
sync_state = db.get_state(self.SYNC, objname)
......@@ -395,7 +394,7 @@ class FileSyncer(object):
pass
def decide_all_archives(self):
logger.info("Checking candidates to sync")
logger.debug("Checking candidates to sync")
self.probe_all()
self.decide_archive()
......
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