MCPcopy Create free account
hub / github.com/celery/celery / setup_schedule

Method setup_schedule

celery/beat.py:592–628  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

590 return self._open_schedule()
591
592 def setup_schedule(self):
593 try:
594 self._store = self._open_schedule()
595 # In some cases there may be different errors from a storage
596 # backend for corrupted files. Example - DBPageNotFoundError
597 # exception from bsddb. In such case the file will be
598 # successfully opened but the error will be raised on first key
599 # retrieving.
600 self._store.keys()
601 except Exception as exc: # pylint: disable=broad-except
602 self._store = self._destroy_open_corrupted_schedule(exc)
603
604 self._create_schedule()
605
606 tz = self.app.conf.timezone
607 stored_tz = self._store.get('tz')
608 if stored_tz is not None and stored_tz != tz:
609 warning('Reset: Timezone changed from %r to %r', stored_tz, tz)
610 self._store.clear() # Timezone changed, reset db!
611 utc = self.app.conf.enable_utc
612 stored_utc = self._store.get('utc_enabled')
613 if stored_utc is not None and stored_utc != utc:
614 choices = {True: 'enabled', False: 'disabled'}
615 warning('Reset: UTC changed from %s to %s',
616 choices[stored_utc], choices[utc])
617 self._store.clear() # UTC setting changed, reset db!
618 entries = self._store.setdefault('entries', {})
619 self.merge_inplace(self.app.conf.beat_schedule)
620 self.install_default_entries(self.schedule)
621 self._store.update({
622 '__version__': __version__,
623 'tz': tz,
624 'utc_enabled': utc,
625 })
626 self.sync()
627 debug('Current schedule:\n' + '\n'.join(
628 repr(entry) for entry in entries.values()))
629
630 def _create_schedule(self):
631 for _ in (1, 2):

Callers

nothing calls this directly

Calls 13

_open_scheduleMethod · 0.95
_create_scheduleMethod · 0.95
syncMethod · 0.95
debugFunction · 0.85
keysMethod · 0.80
merge_inplaceMethod · 0.80
getMethod · 0.45
clearMethod · 0.45
setdefaultMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected