Commit 57f8615f authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Make argument to CleanCacheUnlocked mandatory

Not passing the argument means it has the value None. Iterating None
doesn't work:
  >>> "123" in None
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
  TypeError: iterable argument required

Hence I rename it to "exclude" instead of "exceptions", which may be
confusing, and make it mandatory. If one wants to clean all cache
entries, an empty list can be passed.

Reviewed-by: iustinp
parent 10b207d4
......@@ -436,18 +436,18 @@ class JobStorage(object):
logging.debug("Writing job %s to %s",, filename)
data=serializer.DumpJson(job.Serialize(), indent=False))
def _CleanCacheUnlocked(self, exceptions=None):
def _CleanCacheUnlocked(self, exclude):
"""Clean the memory cache.
The exceptions argument contains job IDs that should not be
assert isinstance(exceptions, list)
assert isinstance(exclude, list)
for job in self._memcache.values():
if in exceptions:
if in exclude:
if job.GetStatus() not in (constants.JOB_STATUS_QUEUED,
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