From cf24999b40b2877dc35f4a77ebc43f29b1dbc960 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Sun, 15 Jun 2014 15:14:54 +0100 Subject: Remove some cache key related log messages There's no need to log every time we look something up in a dict. This just makes log files huge. The CacheKeyComputer.compute_key() function still logs the first time it calculates a cache key for an Artifact instance. This message now includes the hex string that is used to identify the artifact. --- morphlib/cachekeycomputer.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/morphlib/cachekeycomputer.py b/morphlib/cachekeycomputer.py index 588fc8d3..cf44f76e 100644 --- a/morphlib/cachekeycomputer.py +++ b/morphlib/cachekeycomputer.py @@ -35,16 +35,14 @@ class CacheKeyComputer(object): def compute_key(self, artifact): try: ret = self._hashed[artifact] - logging.debug('returning cached key for artifact %s from source ', - (artifact.name, artifact.source.repo_name, - artifact.source.sha1, artifact.source.filename)) return ret except KeyError: - logging.debug('computing cache key for artifact %s from source ', - (artifact.name, artifact.source.repo_name, + ret = self._hash_id(self.get_cache_id(artifact)) + self._hashed[artifact] = ret + logging.debug('computed cache key %s for artifact %s from source ', + ret, (artifact.source.repo_name, artifact.source.sha1, artifact.source.filename)) - self._hashed[artifact] = self._hash_id(self.get_cache_id(artifact)) - return self._hashed[artifact] + return ret def _hash_id(self, cache_id): sha = hashlib.sha256() @@ -76,16 +74,8 @@ class CacheKeyComputer(object): def get_cache_id(self, artifact): try: ret = self._calculated[artifact] - logging.debug('returning cached id for artifact %s from source ' - 'repo %s, sha1 %s, filename %s' % - (artifact.name, artifact.source.repo_name, - artifact.source.sha1, artifact.source.filename)) return ret except KeyError: - logging.debug('computing cache id for artifact %s from source ' - 'repo %s, sha1 %s, filename %s' % - (artifact.name, artifact.source.repo_name, - artifact.source.sha1, artifact.source.filename)) cacheid = self._calculate(artifact) self._calculated[artifact] = cacheid return cacheid -- cgit v1.2.1