芹菜文档说明我应该能够使用Jython运行它。不幸的是,我就是不能让它工作。下面是我尝试运行它时得到的错误:
Traceback (most recent call last):
File "/home/linoor/jython2.7.0/bin/celery", line 11, in
sys.exit(main())
File "/home/linoor/jython2.7.0/Lib/site-packages/celery/__main__.py", line 29, in main
from celery.bin.celery import main
File "/home/linoor/jython2.7.0/Lib/site-packages/celery/bin/__init__.py", line 3, in
from .base import Option
File "/home/linoor/jython2.7.0/Lib/site-packages/celery/bin/base.py", line 86, in
from celery import VERSION_BANNER, Celery, maybe_patch_concurrency
File "/home/linoor/jython2.7.0/Lib/site-packages/celery/five.py", line 307, in __getattr__
module = __import__(self._object_origins[name], None, None, [name])
File "/home/linoor/jython2.7.0/Lib/site-packages/celery/app/__init__.py", line 14, in
from celery import _state
File "/home/linoor/jython2.7.0/Lib/site-packages/celery/_state.py", line 20, in
from celery.utils.threads import LocalStack
File "/home/linoor/jython2.7.0/Lib/site-packages/celery/utils/__init__.py", line 27, in
from celery.exceptions import CPendingDeprecationWarning, CDeprecationWarning
File "/home/linoor/jython2.7.0/Lib/site-packages/celery/exceptions.py", line 15, in
from billiard.exceptions import ( # noqa
File "/home/linoor/jython2.7.0/Lib/site-packages/billiard/__init__.py", line 60, in
from .process import Process, current_process, active_children
File "/home/linoor/jython2.7.0/Lib/site-packages/billiard/process.py", line 25, in
from multiprocessing import process as _mproc
ImportError: No module named multiprocessing
所以我尝试安装多进程,但随后发生了以下情况:
Downloading/unpacking multiprocessing
Downloading multiprocessing-2.6.2.1.tar.gz (108kB): 108kB downloaded
Running setup.py (path:/tmp/pip_build_linoor/multiprocessing/setup.py) egg_info for package multiprocessing
Installing collected packages: multiprocessing
Running setup.py install for multiprocessing
building 'multiprocessing._multiprocessing' extension
error: Compiling extensions is not supported on Jython
Complete output from command /home/linoor/jython2.7.0/bin/jython -c "import setuptools, tokenize;__file__='/tmp/pip_build_linoor/multiprocessing/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --record /tmp/pip-EnQW3c-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.java1.7.0_79-2.7
creating build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/queues.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/tests.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/sharedctypes.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/synchronize.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/heap.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/pool.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/connection.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/__init__.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/util.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/process.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/reduction.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/managers.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/forking.py -> build/lib.java1.7.0_79-2.7/multiprocessing
copying Lib/multiprocessing/patch.py -> build/lib.java1.7.0_79-2.7/multiprocessing
creating build/lib.java1.7.0_79-2.7/multiprocessing/dummy
copying Lib/multiprocessing/dummy/connection.py -> build/lib.java1.7.0_79-2.7/multiprocessing/dummy
copying Lib/multiprocessing/dummy/__init__.py -> build/lib.java1.7.0_79-2.7/multiprocessing/dummy
creating build/lib.java1.7.0_79-2.7/multiprocessing/examples
copying Doc/includes/mp_benchmarks.py -> build/lib.java1.7.0_79-2.7/multiprocessing/examples
copying Doc/includes/mp_synchronize.py -> build/lib.java1.7.0_79-2.7/multiprocessing/examples
copying Doc/includes/mp_workers.py -> build/lib.java1.7.0_79-2.7/multiprocessing/examples
copying Doc/includes/__init__.py -> build/lib.java1.7.0_79-2.7/multiprocessing/examples
copying Doc/includes/mp_newtype.py -> build/lib.java1.7.0_79-2.7/multiprocessing/examples
copying Doc/includes/mp_distributing.py -> build/lib.java1.7.0_79-2.7/multiprocessing/examples
copying Doc/includes/mp_webserver.py -> build/lib.java1.7.0_79-2.7/multiprocessing/examples
copying Doc/includes/mp_pool.py -> build/lib.java1.7.0_79-2.7/multiprocessing/examples
running build_ext
building 'multiprocessing._multiprocessing' extension
error: Compiling extensions is not supported on Jython
据我所知,在Jython中不可能使用multiprocessing
包,因为它需要C扩展(链接到SO问题)。
所以它是所有可能运行芹菜与Jython毕竟吗?
谢谢!
这里有一个关于在jython上使用线程而不是多进程运行芹菜的讨论:https://github.com/celery/celery/issues/96