Python celery.signals.task_prerun.connect() Examples

The following are 3 code examples for showing how to use celery.signals.task_prerun.connect(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module celery.signals.task_prerun , or try the search function .

Example 1
Project: KubeOperator   Author: KubeOperator   File: logger.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        task_prerun.connect(self.on_task_start)
        task_postrun.connect(self.on_start_end) 
Example 2
Project: zeus   Author: getsentry   File: celery.py    License: Apache License 2.0 5 votes vote down vote up
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) 
Example 3
Project: scout_apm_python   Author: scoutapp   File: celery.py    License: MIT License 5 votes vote down vote up
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)