當前位置: 首頁>>代碼示例>>Python>>正文


Python task_postrun.connect方法代碼示例

本文整理匯總了Python中celery.signals.task_postrun.connect方法的典型用法代碼示例。如果您正苦於以下問題:Python task_postrun.connect方法的具體用法?Python task_postrun.connect怎麽用?Python task_postrun.connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在celery.signals.task_postrun的用法示例。


在下文中一共展示了task_postrun.connect方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from celery.signals import task_postrun [as 別名]
# 或者: from celery.signals.task_postrun 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) 
開發者ID:KubeOperator,項目名稱:KubeOperator,代碼行數:6,代碼來源:logger.py

示例2: init_app

# 需要導入模塊: from celery.signals import task_postrun [as 別名]
# 或者: from celery.signals.task_postrun 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) 
開發者ID:getsentry,項目名稱:zeus,代碼行數:17,代碼來源:celery.py

示例3: install

# 需要導入模塊: from celery.signals import task_postrun [as 別名]
# 或者: from celery.signals.task_postrun 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) 
開發者ID:scoutapp,項目名稱:scout_apm_python,代碼行數:13,代碼來源:celery.py

示例4: create_app

# 需要導入模塊: from celery.signals import task_postrun [as 別名]
# 或者: from celery.signals.task_postrun import connect [as 別名]
def create_app(config):
    """ Create a fully configured Celery application object.

    Args:
        config (Config): A reference to a lightflow configuration object.

    Returns:
        Celery: A fully configured Celery application object.
    """

    # configure the celery logging system with the lightflow settings
    setup_logging.connect(partial(_initialize_logging, config), weak=False)
    task_postrun.connect(partial(_cleanup_workflow, config), weak=False)

    # patch Celery to use cloudpickle instead of pickle for serialisation
    patch_celery()

    # create the main celery app and load the configuration
    app = Celery('lightflow')
    app.conf.update(**config.celery)

    # overwrite user supplied settings to make sure celery works with lightflow
    app.conf.update(
        task_serializer='pickle',
        accept_content=['pickle'],
        result_serializer='pickle',
        task_default_queue=DefaultJobQueueName.Task
    )

    if isinstance(app.conf.include, list):
        app.conf.include.extend(LIGHTFLOW_INCLUDE)
    else:
        if len(app.conf.include) > 0:
            raise ConfigOverwriteError(
                'The content in the include config will be overwritten')
        app.conf.include = LIGHTFLOW_INCLUDE

    return app 
開發者ID:AustralianSynchrotron,項目名稱:lightflow,代碼行數:40,代碼來源:app.py


注:本文中的celery.signals.task_postrun.connect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。