本文整理汇总了Python中celery.signals.task_prerun.connect方法的典型用法代码示例。如果您正苦于以下问题:Python task_prerun.connect方法的具体用法?Python task_prerun.connect怎么用?Python task_prerun.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.signals.task_prerun
的用法示例。
在下文中一共展示了task_prerun.connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from celery.signals import task_prerun [as 别名]
# 或者: from celery.signals.task_prerun import connect [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
task_prerun.connect(self.on_task_start)
task_postrun.connect(self.on_start_end)
示例2: init_app
# 需要导入模块: from celery.signals import task_prerun [as 别名]
# 或者: from celery.signals.task_prerun import connect [as 别名]
def init_app(self, app):
self.app = app
new_celery = celery.Celery(
app.import_name,
broker=app.config["CELERY_BROKER_URL"],
backend=app.config["CELERY_RESULT_BACKEND"],
)
# XXX(dcramer): why the hell am I wasting time trying to make Celery work?
self.celery.__dict__.update(vars(new_celery))
self.celery.conf.update(app.config)
worker_process_init.connect(self._worker_process_init)
task_postrun.connect(self._task_postrun)
task_prerun.connect(self._task_prerun)
示例3: install
# 需要导入模块: from celery.signals import task_prerun [as 别名]
# 或者: from celery.signals.task_prerun import connect [as 别名]
def install(app=None):
if app is not None:
copy_configuration(app)
installed = scout_apm.core.install()
if not installed:
return
before_task_publish.connect(before_task_publish_callback)
task_prerun.connect(task_prerun_callback)
task_postrun.connect(task_postrun_callback)