

def _timestamp_progress_dir(self):
    'Timestamp the checkpoint.'
    for _ in xrange(2):
        timestamp = self._checkpoint_timestamp()
        final_dir = os.path.join(self.config.backup_dir, timestamp)
        try:
            os.rename(self.config.in_progress_dir, final_dir)
            return
        except OSError:
            logger.warning('Extreme, unexpected race condition, retrying (%s)', timestamp)
    logger.error('Unable to finalize checkpoint, %s -> %s', self.config.in_progress_dir, final_dir)
    raise errors.ReverterError('Unable to finalize checkpoint renaming')

dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/reverter.py Reverter._timestamp_progress_dir/original