python - 未发现 djutils 队列命令

标签 python django multithreading task-queue

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

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 异步执行任务(例如,您想使用 celery 发送电子邮件,只需编写 0 行代码,就有一个应用程序可以实现这一点。)

关于python - 未发现 djutils 队列命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10216662/

相关文章:

python - click.Choice 多个参数

python - 如何强制 2 个 Python 子进程一个接一个地运行

python - 设置经纪人网址

python - 属性错误 : 'module' object has no attribute 'index'

java - SQLite 减少 for 循环时间

python - 数字 : How can I improve this code to find the number of divisors of big numbers? 的除数

python - 使用过滤后的相关对象集进行注释

java - 每隔 24 小时安排一次

c - 关于多线程和段错误的问题

python - 编译多个模块时 import_array() 出现 Numpy/CAPI 错误