diff options
author | Yunlian Jiang <yunlian@google.com> | 2013-10-04 11:14:59 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-07 18:31:36 +0000 |
commit | 70fceb7f11f176a0de829514b99c5907107b76d2 (patch) | |
tree | ce5b05a3d5ee8b4ffc6a2f064d350d24ed4c9a55 /crosperf/results_cache.py | |
parent | ae02af5938d3fe75180dea5a6e8fa7a075b302d7 (diff) | |
download | toolchain-utils-70fceb7f11f176a0de829514b99c5907107b76d2.tar.gz |
crosperf: remove cache if --rerun=True is set.
If rerun=True, the data in the cache is useless, so remove it first
to avoid data corrupture.
BUG=None
TEST=The cache dir is removed.
Change-Id: I59b219c57cc99aaea7a734ef6e7fd91007cedfd3
Reviewed-on: https://chrome-internal-review.googlesource.com/146065
Reviewed-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
Commit-Queue: Yunlian Jiang <yunlian@google.com>
Tested-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'crosperf/results_cache.py')
-rw-r--r-- | crosperf/results_cache.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py index 15ab29b1..da796598 100644 --- a/crosperf/results_cache.py +++ b/crosperf/results_cache.py @@ -4,6 +4,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +"""Module to deal with result cache.""" + import getpass import glob import hashlib @@ -276,6 +278,7 @@ class Result(object): return None return result + class TelemetryResult(Result): def __init__(self, logger, label): @@ -312,7 +315,7 @@ class TelemetryResult(Result): labels = lines[0].split(",") for line in lines[1:]: fields = line.split(",") - if (len(fields) != len(labels)): + if len(fields) != len(labels): continue for i in range(1, len(labels)): key = "%s %s" % (fields[0], labels[i]) @@ -354,6 +357,7 @@ class CacheConditions(object): class ResultsCache(object): + """ This class manages the key of the cached runs without worrying about what is exactly stored (value). The value generation is handled by the Results class. @@ -442,6 +446,9 @@ class ResultsCache(object): def ReadResult(self): if CacheConditions.FALSE in self.cache_conditions: + cache_dir = self._GetCacheDirForWrite() + command = "rm -rf {0}".format(cache_dir) + self._ce.RunCommand(command) return None cache_dir = self._GetCacheDirForRead() |