Fail gracefully if /proc/self/status is not available.
@@ -7,6 +7,7 @@ class BaseANN(object):
pass
def get_index_size(self, process):
"""Returns the size of the index in kB or -1 if not implemented."""
+ try:
statusfile = open("/proc/%(pid)s/status" % {"pid" : str(process)}, "r")
for line in statusfile.readlines():
if "VmRSS" in line:
@@ -21,4 +22,6 @@ class BaseANN(object):
if unit == "gB":
val *= 1e6
return val
+ except:
+ print("Couldn't open status file, no index size available.")
return -1
