为什么芹菜更喜欢基于函数的任务而不是基于类的任务?

2024-04-23 17:29:50 发布

您现在位置:Python中文网/ 问答频道 /正文

What’s new in Celery 4.0 (latentcall)的描述中,写了以下内容:

If you’re still using class based tasks, then you need to register these manually: ...

以及:

The best practice is to use custom task classes only for overriding general behavior, and then using the task decorator to realize the task.

两者都建议您使用基于函数的任务来完成芹菜任务。为什么芹菜更喜欢基于函数的任务而不是基于类的任务?我找不到任何理由阻止人们用类编写任务是有意义的


Tags: theto函数inreyounewtask