我正在尝试使用 Django Celery 使用 RabbitMQ 配置计划任务。在为我的项目目录中的celery类和一些任务创建对象之后,当我尝试使用以下命令配置Worker时
“ celery -A myproj worker ”我得到以下追溯
Traceback (most recent call last):
File "c:\users\murugk7\envs\celery_test\lib\site-packages\celery\worker\worker.py", line 203, in sta
rt
self.blueprint.start(self)
File "c:\users\murugk7\envs\celery_test\lib\site-packages\celery\bootsteps.py", line 119, in start
step.start(parent)
File "c:\users\murugk7\envs\celery_test\lib\site-packages\celery\bootsteps.py", line 370, in start
return self.obj.start()
File "c:\users\murugk7\envs\celery_test\lib\site-packages\celery\concurrency\base.py", line 131, in
start
self.on_start()
File "c:\users\murugk7\envs\celery_test\lib\site-packages\celery\concurrency\prefork.py", line 112,
in on_start
**self.options)
File "c:\users\murugk7\envs\celery_test\lib\site-packages\billiard\pool.py", line 1008, in __init__
self._create_worker_process(i)
File "c:\users\murugk7\envs\celery_test\lib\site-packages\billiard\pool.py", line 1117, in _create_w
orker_process
w.start()
File "c:\users\murugk7\envs\celery_test\lib\site-packages\billiard\process.py", line 122, in start
self._popen = self._Popen(self)
File "c:\users\murugk7\envs\celery_test\lib\site-packages\billiard\context.py", line 383, in _Popen
return Popen(process_obj)
File "c:\users\murugk7\envs\celery_test\lib\site-packages\billiard\popen_spawn_win32.py", line 64, i
n __init__
_winapi.CloseHandle(ht)
TypeError: must be integer<k>, not _subprocess_handle
(celery_test) C:\kavin\Assigner\assigner>Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\murugk7\envs\celery_test\lib\site-packages\billiard\spawn.py", line 159, in spawn_mai
n
new_handle = steal_handle(parent_pid, pipe_handle)
File "c:\users\murugk7\envs\celery_test\lib\site-packages\billiard\reduction.py", line 121, in steal
_handle
_winapi.PROCESS_DUP_HANDLE, False, source_pid)
WindowsError: [Error 87] The parameter is incorrect
在settings.py中,它有
app = Celery('assigner',
broker='amqp://myuser:mypass@localhost/my_Vhost',
backend='rpc://',
include=['assigner.tasks'])
在tasks.py中,它有
from __future__ import absolute_import
from assigner.celery import app
import time
@app.task
def longtime_add(x, y):
print 'long time task begins'
# sleep 5 seconds
time.sleep(5)
print 'long time task finished'
return x + y
我正在使用 Django-1.8 ,芹菜-4.0 , amqp = 2.1.1 其中 myporj 是我的Django项目名称
请帮我解决这个问题。
答案 0 :(得分:1)
我也发现了这个错误。
原因很简单。芹菜4.x只是不支持窗户。
http://docs.celeryproject.org/en/latest/faq.html#does-celery-support-windows
所以,我想你需要尝试早期版本或切换到Linux系统。