def sync(self):
        info('Writing entries...')
        _tried = set()
        try:
            with commit_on_success():
                while self._dirty:
                    try:
                        name = self._dirty.pop()
                        _tried.add(name)
                        self.schedule[name].save()
                    except (__HOLE__, ObjectDoesNotExist):
                        pass
        except DATABASE_ERRORS as exc:
            # retry later
            self._dirty |= _tried
            error('Database error while sync: %r', exc, exc_info=1)
dataset/ETHPy150Open celery/django-celery/djcelery/schedulers.py/DatabaseScheduler.sync