def on_start(self): if not self._custom_logging and self.redirect_stdouts: self.app.log.redirect_stdouts(self.redirect_stdouts_level) WorkController.on_start(self) # this signal can be used to e.g. change queues after # the -Q option has been applied. signals.celeryd_after_setup.send( sender=self.hostname, instance=self, conf=self.app.conf, ) if not self.app.conf.value_set_for('CELERY_ACCEPT_CONTENT'): warnings.warn(CDeprecationWarning(W_PICKLE_DEPRECATED)) if self.purge: self.purge_messages() # Dump configuration to screen so we have some basic information # for when users sends bug reports. print(safe_str(''.join([ string(self.colored.cyan(' \n', self.startup_info())), string(self.colored.reset(self.extra_info() or '')), ])), file=sys.__stdout__) self.set_process_status('-active-') self.install_platform_tweaks(self)
def on_start(self): if not self._custom_logging and self.redirect_stdouts: self.app.log.redirect_stdouts(self.redirect_stdouts_level) WorkController.on_start(self) # this signal can be used to e.g. change queues after # the -Q option has been applied. signals.celeryd_after_setup.send( sender=self.hostname, instance=self, conf=self.app.conf, ) if getattr(os, 'getuid', None) and os.getuid() == 0: accept_encoding = self.app.conf.CELERY_ACCEPT_CONTENT if ('pickle' in accept_encoding or 'application/x-python-serialize' in accept_encoding): if not C_FORCE_ROOT: raise RuntimeError(ROOT_DISALLOWED) warnings.warn(RuntimeWarning(ROOT_DISCOURAGED)) if not self.app.conf.value_set_for('CELERY_ACCEPT_CONTENT'): warnings.warn(CDeprecationWarning(W_PICKLE_DEPRECATED)) if self.purge: self.purge_messages() # Dump configuration to screen so we have some basic information # for when users sends bug reports. sys.__stdout__.write( str(self.colored.cyan(' \n', self.startup_info())) + str(self.colored.reset(self.extra_info() or '')) + '\n' ) self.set_process_status('-active-') self.install_platform_tweaks(self)
def warn_deprecated(description=None, deprecation=None, removal=None, alternative=None): ctx = {'description': description, 'deprecation': deprecation, 'removal': removal, 'alternative': alternative} if deprecation is not None: w = CPendingDeprecationWarning(PENDING_DEPRECATION_FMT.format(**ctx)) else: w = CDeprecationWarning(DEPRECATION_FMT.format(**ctx)) warnings.warn(w)
def warn(description=None, deprecation=None, removal=None, alternative=None, stacklevel=2): """Warn of (pending) deprecation.""" ctx = {'description': description, 'deprecation': deprecation, 'removal': removal, 'alternative': alternative} if deprecation is not None: w = CPendingDeprecationWarning(PENDING_DEPRECATION_FMT.format(**ctx)) else: w = CDeprecationWarning(DEPRECATION_FMT.format(**ctx)) warnings.warn(w, stacklevel=stacklevel)
def warn_deprecated(description=None, deprecation=None, removal=None, alternative=None): ctx = { "description": description, "deprecation": deprecation, "removal": removal, "alternative": alternative } if deprecation is not None: w = CPendingDeprecationWarning(PENDING_DEPRECATION_FMT % ctx) else: w = CDeprecationWarning(DEPRECATION_FMT % ctx) warnings.warn(w)
# -*- coding: utf-8 -*- from __future__ import absolute_import import warnings from celery.schedules import schedule, crontab_parser, crontab # noqa from celery.exceptions import CDeprecationWarning warnings.warn( CDeprecationWarning( "celery.task.schedules is deprecated and renamed to celery.schedules"))