def _delete_measures_files_for_metric(self, metric_id, files):
for f in files:
try:
os.unlink(self._build_measure_path(metric_id, f))
except OSError as e:
# Another process deleted it in the meantime, no prob'
if e.errno != errno.ENOENT:
raise
try:
os.rmdir(self._build_measure_path(metric_id))
except OSError as e:
# ENOENT: ok, it has been removed at almost the same time
# by another process
# ENOTEMPTY: ok, someone pushed measure in the meantime,
# we'll delete the measures and directory later
# EEXIST: some systems use this instead of ENOTEMPTY
if e.errno not in (errno.ENOENT, errno.ENOTEMPTY, errno.EEXIST):
raise
评论列表
文章目录