到目前爲止,我一直只與python manage.py celeryd
工作,開始像這樣:我應該如何處理來自代碼的celeryd_multi?
python manage.py celeryd -l info --settings=settings
從我的觀點中的代碼,這是否:
BinaryExecTask.delay(request.POST["binary_path"])
從我settings.py
代碼,是這樣的:
import djcelery
djcelery.setup_loader()
BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
#celery
BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "guest"
BROKER_PASSWORD = "guest"
BROKER_VHOST = "/"
,它會在後臺執行一些二進制文件。事情是,一些二進制文件需要很短的時間才能運行,而其他文件可能需要半小時。使用celeryd
,我的所有任務都將被阻止,直到當前任務完成它的執行。我看到一些here開始celeryd_multi,但運行的例子:
python manage.py celeryd_multi start 3 --settings=settings -l info
給出了這樣的錯誤:
celeryd-multi v2.3.1
> Starting nodes...
> celery1.x: Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "c:\code\python27\lib\site-packages\django-1.3-py2.7.egg\django\core\management\_
line 438, in execute_manager
utility.execute()
File "c:\code\python27\lib\site-packages\django-1.3-py2.7.egg\django\core\management\_
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\code\python27\lib\site-packages\django_celery-2.3.3-py2.7.egg\djcelery\manage
s\celeryd_multi.py", line 22, in run_from_argv
["%s %s" % (argv[0], argv[1])] + argv[2:])
File "c:\code\python27\lib\site-packages\celery-2.3.1-py2.7.egg\celery\bin\celeryd_mul
172, in execute_from_commandline
self.commands[argv[0]](argv[1:], cmd)
File "c:\code\python27\lib\site-packages\celery-2.3.1-py2.7.egg\celery\bin\celeryd_mul
205, in start
retcode = self.waitexec(argv)
File "c:\code\python27\lib\site-packages\celery-2.3.1-py2.7.egg\celery\bin\celeryd_mul
354, in waitexec
pipe = Popen(argstr, env=self.env)
File "c:\code\python27\lib\subprocess.py", line 672, in __init__
errread, errwrite)
File "c:\code\python27\lib\subprocess.py", line 882, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
的celeryd-multi start 3 -c 3
拋出了同樣的錯誤。我應該怎麼做才能成功啓動一個芹菜實例,以便我可以同時運行更多任務?另外,我需要在我看來做一些不同的事情嗎?
編輯:一些調試導致我在這裏(站點包\芹菜-2.3.1-py2.7.egg \芹菜\ BIN \ celeryd_multi.py(354)waitexec)
351 def waitexec(self, argv, path=sys.executable):
352 args = " ".join([path] + list(argv))
353 -> argstr = shlex.split(args.encode("utf-8"))
354 pipe = Popen(argstr, env=self.env)
(Pdb) p argstr
['c:codepython27python.exe', 'manage.py', 'celeryd_detach', '-l', 'info', '[email protected]',
'-n', 'celery1.x', '[email protected]']
(Pdb) p Popen(argstr, env=self.env)
*** WindowsError: WindowsError(2, 'The system cannot find the file specified')
(Pdb)
所以,我們可以看到,Python的路徑被破壞:)。接下來我應該做什麼?
EDIT2:我開了一個問題here
您的回溯看上去板缺或不完整的... – seriyPS
@seriyPS,你是對的。我添加了最後的錯誤。 – Geo