当前位置: 首页>>代码示例>>Python>>正文


Python WorkController.on_start方法代码示例

本文整理汇总了Python中celery.worker.WorkController.on_start方法的典型用法代码示例。如果您正苦于以下问题:Python WorkController.on_start方法的具体用法?Python WorkController.on_start怎么用?Python WorkController.on_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在celery.worker.WorkController的用法示例。


在下文中一共展示了WorkController.on_start方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_start

# 需要导入模块: from celery.worker import WorkController [as 别名]
# 或者: from celery.worker.WorkController import on_start [as 别名]
    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:
            warnings.warn(RuntimeWarning(
                'Running the worker with superuser privileges is discouraged!',
            ))

        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)
开发者ID:EzyInsights,项目名称:celery,代码行数:30,代码来源:worker.py

示例2: on_start

# 需要导入模块: from celery.worker import WorkController [as 别名]
# 或者: from celery.worker.WorkController import on_start [as 别名]
    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 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)
开发者ID:pimiento,项目名称:celery,代码行数:33,代码来源:worker.py

示例3: on_start

# 需要导入模块: from celery.worker import WorkController [as 别名]
# 或者: from celery.worker.WorkController import on_start [as 别名]
    def on_start(self):
        app = self.app
        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=app.conf,
        )

        if self.purge:
            self.purge_messages()

        # Dump configuration to screen so we have some basic information
        # for when users sends bug reports.
        use_image = self._term_supports_images()
        if use_image:
            self.termimage(static.logo_as_base64())
        print(safe_str(''.join([
            string(self.colored.cyan(
                ' \n', self.startup_info(artlines=not use_image))),
            string(self.colored.reset(self.extra_info() or '')),
        ])), file=sys.__stdout__)
        self.set_process_status('-active-')
        self.install_platform_tweaks(self)
        if not self._custom_logging and self.redirect_stdouts:
            app.log.redirect_stdouts(self.redirect_stdouts_level)
开发者ID:chenqiangzhishen,项目名称:celery,代码行数:29,代码来源:worker.py

示例4: on_start

# 需要导入模块: from celery.worker import WorkController [as 别名]
# 或者: from celery.worker.WorkController import on_start [as 别名]
    def on_start(self):
        WorkController.on_start(self)

        # apply task execution optimizations
        trace.setup_worker_optimizations(self.app)

        # 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:
            warnings.warn(RuntimeWarning(
                'Running celeryd with superuser privileges is discouraged!'))

        if self.purge:
            self.purge_messages()

        # Dump configuration to screen so we have some basic information
        # for when users sends bug reports.
        print(str(self.colored.cyan(' \n', self.startup_info())) +
              str(self.colored.reset(self.extra_info() or '')))
        self.set_process_status('-active-')
        self.setup_logging()
        self.install_platform_tweaks(self)
开发者ID:quoter,项目名称:celery,代码行数:28,代码来源:worker.py

示例5: on_start

# 需要导入模块: from celery.worker import WorkController [as 别名]
# 或者: from celery.worker.WorkController import on_start [as 别名]
    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("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)
开发者ID:huyidao625,项目名称:celery,代码行数:33,代码来源:worker.py

示例6: on_start

# 需要导入模块: from celery.worker import WorkController [as 别名]
# 或者: from celery.worker.WorkController import on_start [as 别名]
    def on_start(self):
        app = self.app
        WorkController.on_start(self)

        # this signal can be used to, for example, change queues after
        # the -Q option has been applied.
        signals.celeryd_after_setup.send(
            sender=self.hostname, instance=self, conf=app.conf,
        )

        if self.purge:
            self.purge_messages()

        if not self.quiet:
            self.emit_banner()

        self.set_process_status('-active-')
        self.install_platform_tweaks(self)
        if not self._custom_logging and self.redirect_stdouts:
            app.log.redirect_stdouts(self.redirect_stdouts_level)
开发者ID:jwasserzug,项目名称:celery,代码行数:22,代码来源:worker.py


注:本文中的celery.worker.WorkController.on_start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。