我曾经有过这样的芹菜和信号
def calculate(self, input):
result = input * 2
if result > 4:
result_higher_then_four.send(result)
return result
其中result_higher_then_four
显然代表了信号的功能。
然后我介绍芹菜和我的功能看起来像下面,我再也没有收到信号。我想信号是按每个进程绑定的,因为芹菜在不同的进程中运行,这意味着我无法在主进程中捕捉到信号。我应该使用thread_local
来解决这个问题吗?还是我忽略了显而易见的?
感谢
@task
def calculate(self, input):
result = input * 2
if result > 4:
result_higher_then_four.send(result)
return result
@ChillarAnand是 – user2298943 2014-09-07 11:13:26