用户登录
用户注册

分享至

删除 celery 中的 Task/PeriodicTask

  • 作者: 陌涵
  • 来源: 51数据库
  • 2022-11-30

问题描述

如何删除 celery 中的常规 Task 或 PeriodicTask?

How can I delete a regular Task or PeriodicTask in celery?

推荐答案

您撤销任务:参见文档:

Control.revoke(task_id, destination=None, terminate=False, signal='SIGTERM', **kwargs)
    Tell all (or specific) workers to revoke a task by id.

    If a task is revoked, the workers will ignore the task and not execute it after all.

    Parameters: 
        task_id – Id of the task to revoke.
        terminate – Also terminate the process currently working on the task (if any).
        signal – Name of signal to send to process if terminate. Default is TERM.
软件
前端设计
程序设计
Java相关