提交 12cdbddd 编写于 作者: M Megvii Engine Team

fix(ci): clean fastrun cache in windows and macos ci

GitOrigin-RevId: d1a010287f5b9441f6813d0eebd5088e4da88ea3
上级 31705913
......@@ -20,8 +20,14 @@ from ..version import __version__
class _FakeRedisConn:
cache_file = None
_is_shelve = False
_dict = {}
def __init__(self):
if os.getenv("MGE_FASTRUN_CACHE_TYPE") == "MEMORY":
self._dict = {}
self._is_shelve = False
else:
try:
from ..hub.hub import _get_megengine_home
......@@ -48,6 +54,10 @@ class _FakeRedisConn:
self._dict[key] = val
def clear(self):
print("{} cache item in {} deleted".format(len(self._dict), self.cache_file))
self._dict.clear()
def __del__(self):
if self._is_shelve:
self._dict.close()
......@@ -87,3 +97,8 @@ class PersistentCacheOnServer(_PersistentCache):
key = self._make_key(category, key)
self._prev_get_refkeep = conn.get(key)
return self._prev_get_refkeep
def clean(self):
conn = self._conn
if isinstance(conn, _FakeRedisConn):
conn.clear()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册