diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2014-06-15 15:14:54 +0100 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2014-08-29 09:01:17 +0000 |
commit | cf24999b40b2877dc35f4a77ebc43f29b1dbc960 (patch) | |
tree | a96682f3144c971911f886bd4e2e6918ab331505 | |
parent | 8c9aea626d1308a876d145d379ac5f23905fa9b4 (diff) | |
download | morph-cf24999b40b2877dc35f4a77ebc43f29b1dbc960.tar.gz |
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.
-rw-r--r-- | morphlib/cachekeycomputer.py | 20 |
1 files 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 |