diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2014-09-02 16:23:58 +0000 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2014-09-02 16:23:58 +0000 |
commit | f96452965e8065466bdd7188e66dded581bdc1a7 (patch) | |
tree | df8b8e88e1c107b044875d17c51977207f54d900 | |
parent | 6517fd82be115388dda0532aedd6a835345635e6 (diff) | |
parent | cf24999b40b2877dc35f4a77ebc43f29b1dbc960 (diff) | |
download | morph-f96452965e8065466bdd7188e66dded581bdc1a7.tar.gz |
Merge branch 'sam/less-cache-key-logging'
Reviewed-By: Richard Maw <richard.maw@codethink.co.uk>
Reviewed-By: Lars Wirzenius <lars.wirzenius@codethink.co.uk>
-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 |