我想知道是否有一种方法来监控一项任务一旦使用python就完成还是失败。我有一个事件,我想启动根据某项任务的结果。
发布于 2017-04-07 10:12:06
您可以以芹菜@shared_task的形式运行您的任务,其中包含一个try except块:
@shared_task
def my_task(input1, input2, ...):
Setting up...
try:
Do stuff
fire_success_event() <- Your success event
except Exception:
The above stuff failed
fire_fail_event() <- your fail event
return 1 <- fail
return 0 <- success祝你好运:)
https://stackoverflow.com/questions/43273898
复制相似问题