MCPcopy
hub / github.com/celery/celery / on_start

Method on_start

celery/apps/worker.py:128–166  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

126 trace.setup_worker_optimizations(self.app, self.hostname)
127
128 def on_start(self):
129 app = self.app
130 super().on_start()
131
132 # this signal can be used to, for example, change queues after
133 # the -Q option has been applied.
134 signals.celeryd_after_setup.send(
135 sender=self.hostname, instance=self, conf=app.conf,
136 )
137
138 if self.purge:
139 self.purge_messages()
140
141 if not self.quiet:
142 self.emit_banner()
143
144 self.set_process_status('-active-')
145 self.install_platform_tweaks(self)
146 if not self._custom_logging and self.redirect_stdouts:
147 app.log.redirect_stdouts(self.redirect_stdouts_level)
148
149 # TODO: Remove the following code in Celery 6.0
150 # This qualifies as a hack for issue #6366.
151 warn_deprecated = True
152 config_source = app._config_source
153 if isinstance(config_source, str):
154 # Don't raise the warning when the settings originate from
155 # django.conf:settings
156 warn_deprecated = config_source.lower() not in [
157 'django.conf:settings',
158 ]
159
160 if warn_deprecated:
161 if app.conf.maybe_warn_deprecated_settings():
162 logger.warning(
163 "Please run `celery upgrade settings path/to/settings.py` "
164 "to avoid these warnings and to allow a smoother upgrade "
165 "to Celery 6.0."
166 )
167
168 def emit_banner(self):
169 # Dump configuration to screen so we have some basic information

Callers 5

startMethod · 0.45
ensure_startedMethod · 0.45

Calls 7

purge_messagesMethod · 0.95
emit_bannerMethod · 0.95
set_process_statusMethod · 0.95
redirect_stdoutsMethod · 0.80
sendMethod · 0.45