Handle the case where an hour directory disappears between listing the

hours and trying to list the segments in that hour. This could happen if the
backfiller is deleting old hours.
pull/120/head
Christopher Usher 5 years ago
parent 3207dd6878
commit 34e8d0a64b

@ -192,7 +192,7 @@ class CoverageChecker(object):
hours = [name for name in os.listdir(path) if not name.startswith('.')] hours = [name for name in os.listdir(path) if not name.startswith('.')]
except OSError as e: except OSError as e:
if e.errno == errno.ENOENT: if e.errno == errno.ENOENT:
self.logger.warning('{} does not exist') self.logger.warning('{} does not exist'.format(path))
break break
hours.sort() hours.sort()
@ -207,7 +207,12 @@ class CoverageChecker(object):
# based on common.segments.best_segments_by_start # based on common.segments.best_segments_by_start
# but more complicated to capture more detailed metrics # but more complicated to capture more detailed metrics
hour_path = os.path.join(self.base_dir, self.channel, quality, hour) hour_path = os.path.join(self.base_dir, self.channel, quality, hour)
segment_names = [name for name in os.listdir(hour_path) if not name.startswith('.')] try:
segment_names = [name for name in os.listdir(hour_path) if not name.startswith('.')]
except OSError as e:
if e.errno == errno.ENOENT:
self.logger.warning('{} does not exist'.format(hour_path))
break
segment_names.sort() segment_names.sort()
parsed = [] parsed = []
bad_segment_count = 0 bad_segment_count = 0

Loading…
Cancel
Save