Celery更改arg参数并重新运行

问题描述

假设我有一些obj,可以进行一些操作。 失败时,我想更改obj的属性并以较低的soft_time_limit

重新运行该方法
class SomeClass:
    flag = True
    def do():
        if flag:
           # do something
        else:
           # do something different

obj = SomeClass()

@app.bind(soft_time_limit=7)
def do_something(o):
    o.do()
    # if everything correct,do nothing,on exception (including timeout) change the flag and rerun,soft_time_limit should be 5
    o.flag = False
    o.do()
    # return result or raise exception if any,no mo retries

我是芹菜的新手,不知道该怎么做。我试图编写基于类的Task,但没有成功。

唯一的要求是所有这些都应在一个任务/进程下运行。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)