2011-09-06 38 views
3

到目前爲止,我一直只與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

+0

您的回溯看上去板缺或不完整的... – seriyPS

+0

@seriyPS,你是對的。我添加了最後的錯誤。 – Geo

回答

1

看起來像Windows的特定不便......你有沒有嘗試提供完整路徑蟒蛇可執行命令行像

C:\code\python27\bin\python.exe manage.py celeryd_multi start 3 --settings=settings -l info 

此外,使用完整路徑Python的文件可以是有用的

C:\code\python27\bin\python.exe C:\path\to\your\project\manage.py celeryd_multi start 3 --settings=settings -l info 
+0

這不起作用。坦率地說,爲什麼這需要完整的路徑,而只是「芹菜」開箱即用? – Geo

+0

是的,這看起來像一個Windows特定的問題。它應該按照預期工作,但我沒有足夠的資源來正確維護Windows。迫切需要幫助在Windows上維護Celery! – asksol

+0

順便說一句,如果這是一個bug,那麼你應該在bugtracker上打開一個問題:http://github.com/ask/celery/issues它可能需要一段時間,但最終可能會被修復。 – asksol

相關問題