我正在尝试使用django-utils在并行线程中异步启动许多命令(这些命令处理I / O的99.99%)。但是,我不断收到以下错误:

QueueException: MyProject.maintenanceInterface.commands.queuecmd_refreshDataAsync not found in CommandRegistry


该函数refreshDataAsync在maintenanceInterface内部的commands.py中-而maintenanceInterface在已安装应用程序的列表中。

我正在像这样运行队列使用者:

python .\manage.py queue_consumer


当我查看队列使用者日志时,它将告诉我它已找到函数(在init处):

djutils.commands.queuecmd_delayed_resize
djutils.queue.queue.QueueCommand
djutils.queue.queue.PeriodicQueueCommand
maintenanceInterface.commands.queuecmd_refreshDataAsync
2012-04-18 16:57:10,598:djutils.queue.logger:INFO:Starting periodic command execution thread


并且仍然抛出异常。

我在某处错过了一步吗?

最佳答案

这不是一个简单的答案,但确实是一个不错的建议,只需使用celery和django celery进行异步处理即可。

您可以使用django-utils(至少就异步而言)来做所有事情,并且可以做更多的事情(很多后端,可以命名的任何类型的设置/参数),也很少有相关项目使用celery来完成。异步的事情(例如,您想用芹菜发送电子邮件,您编写了0行代码,有一个用于该应用程序的应用程序。)

10-08 01:15