我有以下代码:
@retry(stop_max_attempt_number=2)
def a_func:
do_somthing
def a_func_thread:
process = multiprocessing.Process(target=a_func, args=[])
process.start()
我看到的是,当我直接调用一个函数时,decorator就工作了。但是,当我将它用作进程中的目标函数时,进程似乎根本不尊重decorator。我是不是错过了一些很简单的东西
Tags:
Decorator将始终工作,因为Decorator仅在定义函数时被调用,并且Decorator调用的结果随后存储为函数名
在
target=a_func
处,a_func
是调用@retry decorator的结果相关问题 更多 >
编程相关推荐