'Truncate data beyond this date in all ctables.'

def truncate(self, date):

    truncate_slice_end = self.data_len_for_day(date)
    glob_path = os.path.join(self._rootdir, '*', '*', '*.bcolz')
    sid_paths = sorted(glob(glob_path))
    for sid_path in sid_paths:
        file_name = os.path.basename(sid_path)
        try:
            table = bcolz.open(rootdir=sid_path)
        except IOError:
            continue
        if (table.len <= truncate_slice_end):
            logger.info('{0}    not    past    truncate    date={1}.', file_name, date)
            continue
        logger.info('Truncating    {0}    at    end_date={1}', file_name, date.date())
        table.resize(truncate_slice_end)
    metadata = BcolzMinuteBarMetadata.read(self._rootdir)
    metadata.end_session = date
    metadata.write(self._rootdir)
