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

Method start

celery/beat.py:1042–1080  ·  view source on GitHub ↗
(self, embedded_process=False)

Source from the content-addressed store, hash-verified

1040 self.remote_control, self.hostname)
1041
1042 def start(self, embedded_process=False):
1043 info('beat: Starting...')
1044 debug('beat: Ticking with max interval->%s',
1045 humanize_seconds(self.scheduler.max_interval))
1046
1047 signals.beat_init.send(sender=self)
1048 if embedded_process:
1049 signals.beat_embedded_init.send(sender=self)
1050 platforms.set_process_title('celery beat')
1051
1052 self.effective_max_interval = self.scheduler.max_interval
1053
1054 if self.remote_control:
1055 self._pidbox = BeatPidbox(self)
1056 self._pidbox.start()
1057
1058 # Stamp before the first pass, so a beat that wedges before it
1059 # ever ticks goes stale rather than looking perpetually healthy.
1060 self._last_tick = time.monotonic()
1061
1062 try:
1063 while not self._is_shutdown.is_set():
1064 interval = self.scheduler.tick()
1065 self._last_tick = time.monotonic()
1066 if interval and interval > 0.0:
1067 debug('beat: Waking up %s.',
1068 humanize_seconds(interval, prefix='in '))
1069 time.sleep(interval)
1070 if self.scheduler.should_sync():
1071 self.scheduler._do_sync()
1072 except (KeyboardInterrupt, SystemExit):
1073 self._is_shutdown.set()
1074 finally:
1075 # Persist the schedule before spending time joining the
1076 # pidbox thread: a supervisor may follow SIGTERM with
1077 # SIGKILL, and the schedule is the state worth keeping.
1078 self.sync()
1079 if self._pidbox is not None:
1080 self._pidbox.stop()
1081
1082 def sync(self):
1083 self.scheduler.close()

Callers 11

start_schedulerMethod · 0.95
myapp.pyFile · 0.45
mysecureapp.pyFile · 0.45
tasks.pyFile · 0.45
celery.pyFile · 0.45
myapp.pyFile · 0.45
myapp.pyFile · 0.45
myapp.pyFile · 0.45
startMethod · 0.45
runMethod · 0.45
runMethod · 0.45

Calls 14

syncMethod · 0.95
infoFunction · 0.85
debugFunction · 0.85
humanize_secondsFunction · 0.85
BeatPidboxClass · 0.85
set_process_titleMethod · 0.80
is_setMethod · 0.80
should_syncMethod · 0.80
_do_syncMethod · 0.80
sendMethod · 0.45
tickMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected