mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
If a stats.pickle file cannot be read, print a better error message.
This commit is contained in:
parent
8d020aaba2
commit
d278b1220f
@ -12,6 +12,7 @@ from zope.interface import implements
|
|||||||
from foolscap.api import eventually, DeadReferenceError, Referenceable, Tub
|
from foolscap.api import eventually, DeadReferenceError, Referenceable, Tub
|
||||||
|
|
||||||
from allmydata.util import log
|
from allmydata.util import log
|
||||||
|
from allmydata.util.encodingutil import quote_output
|
||||||
from allmydata.interfaces import RIStatsProvider, RIStatsGatherer, IStatsProducer
|
from allmydata.interfaces import RIStatsProvider, RIStatsGatherer, IStatsProducer
|
||||||
|
|
||||||
class LoadMonitor(service.MultiService):
|
class LoadMonitor(service.MultiService):
|
||||||
@ -252,7 +253,12 @@ class PickleStatsGatherer(StdOutStatsGatherer):
|
|||||||
|
|
||||||
if os.path.exists(self.picklefile):
|
if os.path.exists(self.picklefile):
|
||||||
f = open(self.picklefile, 'rb')
|
f = open(self.picklefile, 'rb')
|
||||||
|
try:
|
||||||
self.gathered_stats = pickle.load(f)
|
self.gathered_stats = pickle.load(f)
|
||||||
|
except Exception:
|
||||||
|
print ("Error while attempting to load pickle file %s.\nYou may need to delete this file.\n" %
|
||||||
|
quote_output(os.path.abspath(self.picklefile)))
|
||||||
|
raise
|
||||||
f.close()
|
f.close()
|
||||||
else:
|
else:
|
||||||
self.gathered_stats = {}
|
self.gathered_stats = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user